Multi-line Strings Break lsp-execute-code-action
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- emacs-lisp, java
- Domain
- developer-experience, devtools
Research direction
Reproduce the issue with the shown Main.java example, then start from the lsp-execute-code-action path and the c-clear-string-fences error reported in the Emacs messages buffer. Trace how multiline strings affect the action and marker handling; done means missing Java objects are populated successfully while the multiline string remains present.
Written by the indexing model from the issue text.
Description
Describe the bug
Multi-line String literals completely breaks lsp code actions.
To Reproduce
- Create an
exampledirectory. - Inside create a
Main.javafile. - Inside
Main.javacreate the followingMainclass.
class Main {
List<Object> l = new ArrayList<Object>();
}
- Call
lsp-execute-code-action, import the dependencies and notice the code actions still working. - Remove the imported objects and Create a multiline String. Your file should now look like this:
class Main {
List<Object> l = new ArrayList<Object>();
String s = """
hello
""";
}
- Attempt to
lsp-execute-code-actiononce again.
From here, you'll see an error message in the mini buffer and messages buffer similar to the following:
c-clear-string-fences: Args out of range: #<marker (moves after insertion) at 131 in Main.java>, #<marker (moves after insertion) at 131 in Main.java>
Expected behavior
Emacs should populate the missing objects like normal.
Logs
I think this is purely a client error as there are no lsp errors, but errors generated by emacs.
Work-Around
Comment out all the multiline strings and revert the buffer. You will now be able to execute code actions once again.
- Dominant language
- Emacs Lisp
- Stars
- 696
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from emacs-lsp/lsp-java
-
dap-java discards module paths from resolveClasspath causing JPMS-modular projects fail to launchOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in emacs-lsp/lsp-java
Similar issues
-
Difficulty 2/5 Half a day Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
JustJarethB/invoicer#54 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
comp/tools P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
NousResearch/hermes-agent#126059 ·
Maintainers usually reply within 1 day