apache / apache/grails-intellij-plugin

GSP page import types aren't available if multi-line syntax with \ is used

Open
#399 0 comments 0 reactions 0 assignees View on GitHub
bug imported-from-youtrack
Dominant language
Java
Stars
17
Forks
4
Avg merge
5d 15h
Merged PRs (30d)
4

Description

**Workaround**
Change to a comma sperator:
```
<%@ page import="\
com.test.Dto, \
com.test.Dto2 \
"%>
```
## **Steps to reproduce**

1. Have Java classes to import

2. Create a .gsp file where you import multiple types using a multi-line syntax with backslash `\` at the end of each line, after `;`:

```
<%@ page import="com.test.Dto; \
com.test.Dto2;" %>

<%
Dto a = null;
Dto2 b = null;
%>
```
3. Try to use IntelliSense features like code completion, work with the types

**Expected result** *(correct result)***:**

All imported types should be available.

* This is a legal syntax, as the GSP code runs without any issues. For code style reasons, this syntax may be preferred vs. having all imports in 1 line.
* Note: If you continued on another line (`\n`) without `\`, parsing GSP would fail with error: `org.codehaus.groovy.control.MultipleCompilationErrorsException` `startup failed:` `Unexpected input: '\n'`.

Ctrl+clicking on Dto2 should navigate to that class.

**Actual result** *(faulty result)***:**

Only the first type is available.

Ctrl+clicking on Dto2 says "Cannot find declaration to go to".

**Affected Plugin**

[Grails](https://plugins.jetbrains.com/plugin/18504-grails)

## **Environment & Additional information**

IU-241.18034.62, JRE 17.0.11+1-b1207.24x64 JetBrains s.r.o., OS Windows 10(amd64) v10.0 , screens 2400.0x1350.0
Auto-uploaded logs URL (accessible to JetBrains employees only): <

---

*Imported from [IDEA-356622](https://youtrack.jetbrains.com/issue/IDEA-356622) · Type: Bug · Votes: 0*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the multi-line GSP page import in the Grails plugin and locate the GSP import parsing and IntelliSense resolution entry points. Verify the behavior with imports separated by semicolons and trailing backslashes. Done means both Dto and Dto2 are available for completion and Ctrl+click navigation, while the legal GSP syntax continues to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.