Repository navigation
feat: the Mappings tab of a DAP server shows no Language Id column, and the DAP templates give no language ID, which a DAP server doesn't use - #2173
Merged
lagergren merged 1 commit intoNov 24, 2026
Conversation
…nd the DAP templates give no language ID, which a DAP server doesn't use A language server receives the language ID of a mapping as the languageId of textDocument/didOpen. A DAP server doesn't use it: LSP4IJ neither sends it to the debug adapter nor uses it to decide which files are debuggable. The mapping table panels get a constructor with a withLanguageId flag. Their existing constructors keep the column, so the language server settings and plugins that use the panels are unchanged. Fixes redhat-developer#1837
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2173 +/- ##
==========================================
+ Coverage 54.12% 54.15% +0.02%
==========================================
Files 831 831
Lines 35275 35286 +11
Branches 5527 5528 +1
==========================================
+ Hits 19092 19108 +16
+ Misses 13364 13357 -7
- Partials 2819 2821 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
lagergren
added a commit
that referenced
this pull request
Nov 24, 2026
…a development IDE, not the stale ones of the VFS (#2190) Fixes #1949 Design by @muescha, from the review of #2080, which is no longer on GitHub. This PR takes their proposal, with the refresh limited to development builds, as agreed there. ## What After the LSP4IJ JAR is rebuilt at the same path, as in `runIde` or with a SNAPSHOT, *Choose template...* in the New Language Server dialog and the DAP dialog keep showing the old templates, even after a restart. `ServerTemplateManager.getTemplateRoot()` reads them through `JarFileSystem`, whose content is the VFS cache, which survives restarts. Nothing refreshes a plugin's JAR, since the plugin's class loader reads it directly, not through the VFS. #2080 refreshed the JAR in `getTemplateRoot()` with `refreshAndFindFileByPath`. That runs in the constructor of the template services, which may be created under the read lock. There, a synchronous refresh logs "Do not perform a synchronous refresh under read lock" and doesn't refresh. ## Change - **New `TemplateJarRefreshActivity`** (`postStartupActivity`, `DumbAware`) refreshes the templates' JAR, synchronously, once per IDE start: - it runs in a project activity's coroutine, where no read lock is held; - an `AtomicBoolean` makes it run once, not once per project; - it runs only when `IntelliJPlatformUtils.isDevMode()`. A released LSP4IJ has its version in its JAR's name, so a new version is read from a new path, and users' IDEs do nothing new at startup. - **`getTemplateRoot()` still uses `findFileByPath`,** with a comment that it must never refresh. - **One refresh session for the `.jar` file and the JAR root together** (`VfsUtil.markDirtyAndRefresh(false, true, true, localJar, jarRoot)`), not two in a row: - A refresh of the `.jar` file alone refreshes the content only of a JAR that the IDE has opened since it started, and at a new start it usually hasn't. The content is refreshed because each file in a JAR has the `.jar` file's time stamp. - If the JAR is open, a change of the `.jar` file makes `VfsImplUtil` refresh its content again, asynchronously. With two sessions, that refresh could scan first, and the second session would return before the changes are applied. - **Dynamic reload:** once a project's startup activities have run, `StartupManagerImpl` starts the project activities of a plugin loaded dynamically for the projects already open. The reloaded plugin has a new class loader, so a new flag, and `VfsImplUtil` drops the plugin's open JARs when it is unloaded. So a reload refreshes like a new start. - **What it doesn't change:** a template service created before the refresh keeps the old templates until the next start, as today. The templates are only needed after a user action, so the refresh has long finished by then. ## Tests New `TemplateJarRefreshActivityTest` (4 tests): - **Main test:** a JAR built in a temp directory is read through `JarFileSystem`, then rebuilt at the same path with changed content and an extra template folder. A new start is simulated by closing the JAR and keeping the VFS cache. The templates are stale until `refreshOnce` runs on a background thread without the read lock, and new after it. - **Once:** a second run doesn't refresh. - **Not in dev mode:** nothing is refreshed. - **`getTemplateRoot()` never refreshes:** creating a `ServerTemplateManager` under a read action leaves dirty files of LSP4IJ's JAR dirty. Red-green: - Without the refresh, the main and once tests fail. - Refreshing only the `.jar` file, they fail too. - A synchronous refresh in `getTemplateRoot()` fails the guard test with "Do not perform a synchronous refresh under read lock". Results: - The `templates.*` and `launching.*` tests pass on IC 2024.2, 2025.3 and IU 2026.3, with 91 each and 0 failures or skipped. The new tests also pass headless on all three. - After the rebase onto main (with #2173), the same tests pass on 2024.2 (92, with 0 failures), and the new ones headless. Not checked by hand in `runIde`, which needs a GUI: the restart, and the dynamic reload. ## Behaviour change | Before | After | |---|---| | In a development IDE (`runIde`), after the LSP4IJ JAR is rebuilt at the same path, the New Language Server and DAP dialogs keep showing the old templates from the VFS cache, even after a restart | At the next start or plugin reload of a development IDE, they show the rebuilt JAR's templates. A released LSP4IJ does nothing new at startup |
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 #1837
What
The Mappings tab of a DAP server had a
Language Idcolumn, and the DAP templates filled it in. A DAP server doesn't usethe value: LSP4IJ doesn't send it to the debug adapter, and it doesn't decide which files are debuggable. Only a
language server uses it, as the
languageIdoftextDocument/didOpen. The column was only there because DAP and LSPshare the mapping tables, and it made users wonder what to enter.
As agreed in #1837, this removes only the column and the template values. The larger rework that muescha mentioned there,
a shared LSP/DAP mappings panel and the duplicated mappings after saving a run configuration, is theirs and stays separate.
Change
AbstractServerMappingTablePaneland its three subclasses (LanguageServerMappingTablePanel,FileTypeServerMappingTablePanel,FileNamePatternServerMappingTablePanel) get a constructor with awithLanguageIdflag. The existing constructors keep the column, so the language server settings and any pluginthat uses these panels are unchanged.
DAPServerMappingsPanelcreates its three tables without the column.languageIdvalues. The language server templates keep theirs.was never used.
languageIdattribute of the DAP extension point mappings stays, so plugins that set it still load.docs/dap/UserGuide.mdno longer describes the column. The edb and Perl pages no longer list the language IDsthat their templates filled in. The screenshot
docs/dap/images/DAP_config_type_mappings.pngstill shows the column.Tests
DAPServerMappingsPanelTest: a DAP server's mappings tables have noLanguage Idcolumn, and a languageserver's still have one.
BundledTemplateCommandsTest:aFileTypeOfATemplateGoesToOneLanguagechecks only mappings that have a language ID.dap.*,settings.*andlaunching.templates.*tests pass: 544 on each, with0 failures and 0 skipped.
Behaviour change
Language Idcolumn, and a DAP server created from a template gets a language ID for each mappingLanguage Idcolumn, and the DAP templates give no language ID