You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: start the commands of the templates without sh -c or sh -s - #1976
LSP4IJ splits a command at its spaces, so sh -c typescript-language-server --stdio gave sh three arguments, and sh -c runs only the first one: the language server started without --stdio. With sh -s, sh reads its commands from the standard input instead: the Ruby LSP template never started ruby-lsp, and the Ruby Debug installer waited for commands.
Templates and installers start their commands directly, as the other templates do:
TypeScript, Stylelint, gopls, Harper, Perl, SysML, EO, rust-analyzer and wgsl-analyzer drop sh -c.
Ruby LSP starts ruby-lsp, and the installers of Ruby LSP and Ruby Debug run gem install ruby-lsp and gem install debug.
The HTML template, which quoted its command correctly, now starts node "…" --stdio, as its Windows command already did.
The Windows commands are unchanged.
The user guide no longer advises sh -c or cmd /c for the environment variables. LSP4IJ gives the command its environment and looks the command up in that PATH, and a non-interactive shell adds nothing to it. The guide now says to use a shell only for shell syntax, with the whole command in double quotes. The template docs' example and the gopls and rust-analyzer pages show the new commands.
Installers split a command given as a string with CommandUtils.createCommands, as LSP4IJ splits the command that starts a language server, instead of split(" "). An argument in double quotes now keeps its spaces. No bundled installer command has quotes or double spaces, so none of them changes.
Its installer, copied from the gopls one, set the command to jq-lsp -mode=stdio, an option of gopls that jq-lsp rejects, so the language server exited right after it was installed. It now sets jq-lsp, as the template starts it, and its hint names jq-lsp instead of gopls.
Not in this PR
Servers created before this fix keep their saved command, since LSP4IJ copies a template's command into a server's settings when it creates the server. Most of them got a working command from their installer ("update": true) the first time they started; a Ruby LSP server created from the template didn't. The 0.30.0 change notes (docs: change notes for 0.30.0 #1941) will say to create such a server again, or to remove sh -c or sh -s from its command.
BundledTemplateCommandsTest reads every template.json and installer.json of the bundled language servers and debug adapters. It fails on any command that starts with sh, unless it's sh -c with the whole command as one argument. On main it lists the 12 commands this PR fixes.
ExecTaskFactoryTest: a string command in an installer keeps an argument in double quotes together, and two spaces make no empty argument. Both tests fail with split(" ").
The whole test suite passes locally (1633 tests), except for 7 tests that fail on main on this Mac too: IntelliJ's "File accessed outside allowed roots", since macOS's temporary directory /var is /private/var. CI doesn't hit this.
The language servers themselves weren't started; none of them is installed here.
The jq-lsp installer, copied from the gopls one, set the command to
'jq-lsp -mode=stdio' after installing. jq-lsp stops on an option it
doesn't know, so the language server exited at once after it was
installed. The command is now 'jq-lsp', as the template starts it, and
the installer's hint names jq-lsp instead of gopls.
Fixesredhat-developer#1956
LSP4IJ splits a command at its spaces, so 'sh -c typescript-language-server
--stdio' gave sh three arguments, and sh -c runs only the first one: the
language server started without --stdio. The Ruby LSP template and the
installers of Ruby LSP and Ruby Debug used 'sh -s', with which sh reads
its commands from the standard input instead: ruby-lsp never started,
and 'gem install debug' waited for commands.
The templates and installers now start their commands directly, as the
others do. A shell adds no environment variables: LSP4IJ gives the
command its environment and looks it up in that PATH. The user guide no
longer advises sh -c or cmd /c for the environment variables, and says
to give a shell the whole command in double quotes, for shell syntax
only.
An installer now splits a command given as a string as LSP4IJ splits the
command which starts a language server, so an argument in double quotes
keeps its spaces.
Fixesredhat-developer#1954
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Documentation
Clarified how commands use configured environment variables and are found through PATH, including when to use a shell.
Updated setup examples for several language servers to use direct launch commands.
Bug Fixes
Corrected the JQ Language Server installation error message and default launch command.
Updated bundled language server and debugger templates to launch commands directly where shell execution isn’t needed.
String command parsing now uses CommandUtils.createCommands. Bundled LSP and DAP commands and documentation now use direct execution where shell syntax is not needed. Tests cover command parsing and scan bundled resources for shell-wrapped commands.
String commands now use CommandUtils.createCommands instead of splitting on spaces. Tests cover quoted arguments, repeated spaces, OS-specific values, and array commands.
Bundled commands remove unnecessary shell wrappers. The jq-lsp installer message and command are corrected. Documentation describes direct execution and shell use. A test scans bundled resources for shell-wrapped commands.
The change removes unnecessary shell wrappers from bundled templates and installers and adds tests for command parsing. No actionable merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix: start the commands of the templates without sh -c or sh -s" matches the main change. The PR removes sh -c and sh -s wrappers from bundled LSP and DAP templates and installers, and the …
Description check
The description is related to the changeset. It explains the sh -c and sh -s problem (#1954), the template and installer changes, the user guide update, the jq-lsp installer fix (#1956), the CommandUt…
Linked Issues check
Directly linked issue #1954 has coding requirements. Each is addressed at head dbac0b5: (1) Remove unneeded sh -c and incorrect sh -s from affected templates and Ruby installers. The raw summary l…
Out of Scope Changes check
All changed files relate to #1954 or to the jq-lsp fix that the PR description states (#1956). The jq-lsp installer diff changes the command from jq-lsp -mode=stdio to jq-lsp and corrects the fail…
Full details: Title check
Explanation
The title "fix: start the commands of the templates without sh -c or sh -s" matches the main change. The PR removes sh -c and sh -s wrappers from bundled LSP and DAP templates and installers, and the summary and objectives describe the same change. The title does not mention the jq-lsp installer fix or the installer parsing change, but those are secondary to the main change.
Full details: Description check
Explanation
The description is related to the changeset. It explains the sh -c and sh -s problem (#1954), the template and installer changes, the user guide update, the jq-lsp installer fix (#1956), the CommandUtils.createCommands change in installers, and the tests added. It also lists what is out of scope.
Full details: Linked Issues check
Explanation
Directly linked issue #1954 has coding requirements. Each is addressed at head dbac0b5:
(1) Remove unneeded sh -c and incorrect sh -s from affected templates and Ruby installers. The raw summary lists direct-command changes in the TypeScript, Stylelint, gopls, Harper, Perl, SysML, EO, rust-analyzer, wgsl-analyzer, Ruby LSP (template and installer), Ruby Debug installer, and HTML templates. Windows commands are unchanged.
(2) Update the template documentation example and explain the environment and shell usage. docs/UserDefinedLanguageServer.md and docs/UserDefinedLanguageServerTemplate.md are updated, as are the gopls and rust-analyzer pages.
(3) Use CommandUtils.createCommands for installer string commands. The ExecTaskFactory diff confirms fillCommand now calls CommandUtils.createCommands(command.getAsString()) in place of split(" ").
(4) Ruby LSP install-check timeout is explicitly out of scope and tracked in #1957. The PR does not change it.
Automated tests: BundledTemplateCommandsTest and ExecTaskFactoryTest are added. The author reports they pass. I did not run them; the pass result relies on the diff and the reported run.
Full details: Out of Scope Changes check
Explanation
All changed files relate to #1954 or to the jq-lsp fix that the PR description states (#1956). The jq-lsp installer diff changes the command from jq-lsp -mode=stdio to jq-lsp and corrects the failure message to name jq-lsp. This is a small, connected change. #1956 is not in the linked issue list, but the PR description and the PR objectives both state it as in scope. The test changes support the template and installer changes. The ExecTaskFactory getCommand visibility change supports the new unit test. The installer timeout check (#1957) is not changed, so no out-of-scope change of that kind appears.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 462d8f11-93a8-4a63-ba9f-8dab0d7cb0c1
Commits
Reviewing files that changed from the base of the PR and between 9d4537a and dbac0b5.
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.38%. Comparing base (9d4537a) to head (dbac0b5). ⚠️ Report is 1 commits behind head on main.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1954 and #1956, both collected in #1943.
sh -candsh -s(#1954)LSP4IJ splits a command at its spaces, so
sh -c typescript-language-server --stdiogaveshthree arguments, andsh -cruns only the first one: the language server started without--stdio. Withsh -s,shreads its commands from the standard input instead: the Ruby LSP template never startedruby-lsp, and the Ruby Debug installer waited for commands.This takes option 1 of muescha's options, no shell, which his second comment recommends.
sh -c.ruby-lsp, and the installers of Ruby LSP and Ruby Debug rungem install ruby-lspandgem install debug.node "…" --stdio, as its Windows command already did.sh -corcmd /cfor the environment variables. LSP4IJ gives the command its environment and looks the command up in thatPATH, and a non-interactive shell adds nothing to it. The guide now says to use a shell only for shell syntax, with the whole command in double quotes. The template docs' example and the gopls and rust-analyzer pages show the new commands.CommandUtils.createCommands, as LSP4IJ splits the command that starts a language server, instead ofsplit(" "). An argument in double quotes now keeps its spaces. No bundled installer command has quotes or double spaces, so none of them changes.jq-lsp (#1956)
Its installer, copied from the gopls one, set the command to
jq-lsp -mode=stdio, an option of gopls that jq-lsp rejects, so the language server exited right after it was installed. It now setsjq-lsp, as the template starts it, and its hint names jq-lsp instead of gopls.Not in this PR
"update": true) the first time they started; a Ruby LSP server created from the template didn't. The 0.30.0 change notes (docs: change notes for 0.30.0 #1941) will say to create such a server again, or to removesh -corsh -sfrom its command.How this was checked
BundledTemplateCommandsTestreads everytemplate.jsonandinstaller.jsonof the bundled language servers and debug adapters. It fails on any command that starts withsh, unless it'ssh -cwith the whole command as one argument. Onmainit lists the 12 commands this PR fixes.ExecTaskFactoryTest: a string command in an installer keeps an argument in double quotes together, and two spaces make no empty argument. Both tests fail withsplit(" ").mainon this Mac too: IntelliJ's "File accessed outside allowed roots", since macOS's temporary directory/varis/private/var. CI doesn't hit this.