Repository navigation
fix: the settings of the user-defined language servers and debug adapters keep the path macros of their commands, as stored - #2389
Merged
lagergren merged 1 commit intoDec 1, 2026
Conversation
…ters keep the path macros of their commands, as stored The storage of the application expands the path macros of a component when it loads it, so a command which an installer gave with $USER_HOME$ showed, and exported, with the path of the user's home after a restart. loadState collapses the command and the working directory again; the macros are resolved when the server starts, as before. Fixes redhat-developer#2384
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2389 +/- ##
==========================================
+ Coverage 59.80% 59.82% +0.02%
==========================================
Files 859 859
Lines 37602 37609 +7
Branches 7792 7793 +1
==========================================
+ Hits 22488 22501 +13
+ Misses 12031 12023 -8
- Partials 3083 3085 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@coderabbitai review |
Action performed
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #2384.
The Language Servers settings showed the commands of the user-defined language servers with the user's home written out:
C:/Users/…/.lsp4ij/lsp/clangd_snapshot_20260517/bin/clangd.exeinstead of$USER_HOME$/.lsp4ij/lsp/…. Exporting a server took that path too, and the settings stored it once they were applied.Cause
Nothing in LSP4IJ resolves the command it stores: the installers keep the macros.
${output.dir}and${check.file}are as written, as$USER_HOME$/.lsp4ij/lsp/clangd/…, andUICommandLineUpdaterstores the command as the installer gives it.IntelliJ does it. The storage of the application expands the path macros of a component's state when it loads it, and collapses paths into them when it saves it:
UserDefinedLanguageServerSettings.xmlkeeps$USER_HOME$.getCommandLine()returns the expanded path, and so does everything that reads it: the settings page, the export, and the next save of the settings.PathMacroManager.expandPaths(Element)applies no filter. APathMacroFilteronly acts when the storage collapses paths on save, so a filter can't keep the macros on load.The new test reproduces it: a state with
"$USER_HOME$/.lsp4ij/lsp/clangd/clangd_19.1.2/bin/clangd", saved and loaded as the application's storage does, came back as"/Users/…/.lsp4ij/lsp/clangd/…".Fix
loadStateofUserDefinedLanguageServerSettingscollapses the command and the working directory again, with the application'sPathMacroManager, through the newCommandUtils.collapsePathMacros. So doesloadStateofUserDefinedDebugAdapterServerSettingsfor its command. They show and export as the file stores them.CommandUtils.resolveCommandLine, as before.$USER_HOME$. That's how the storage has always written it in the file, and it starts the same.Behaviour changes
$USER_HOME$, as stored, and is resolved when the server startsTests
UserDefinedSettingsPathMacrosTest: a state goes through the application'sPathMacroManageras the storage handles a file: collapsed on save, expanded on load, thenloadState. It checks that:$USER_HOME$in its command and its working directory;$USER_HOME$;Without the fix, the first three fail with
/Users/marcus/…in place of$USER_HOME$.Platforms: the tests pass on 2024.2 and 2026.3.
Whole suite: 2,861 tests, 0 failures, 7 skipped.