Skip to content

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 into
redhat-developer:mainfrom
lagergren:fix/dap-mappings-no-language-id
Nov 24, 2026

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #1837

What

The Mappings tab of a DAP server had a Language Id column, and the DAP templates filled it in. A DAP server doesn't use
the 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 languageId of textDocument/didOpen. The column was only there because DAP and LSP
share 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

  • AbstractServerMappingTablePanel and its three subclasses (LanguageServerMappingTablePanel,
    FileTypeServerMappingTablePanel, FileNamePatternServerMappingTablePanel) get a constructor with a
    withLanguageId flag. The existing constructors keep the column, so the language server settings and any plugin
    that uses these panels are unchanged.
  • DAPServerMappingsPanel creates its three tables without the column.
  • The 10 DAP templates lose their 23 languageId values. The language server templates keep theirs.
  • A DAP server configured before this change keeps any language ID it has. It's still stored, just not shown, and it
    was never used.
  • The languageId attribute of the DAP extension point mappings stays, so plugins that set it still load.
  • Docs: docs/dap/UserGuide.md no longer describes the column. The edb and Perl pages no longer list the language IDs
    that their templates filled in. The screenshot docs/dap/images/DAP_config_type_mappings.png still shows the column.

Tests

  • New DAPServerMappingsPanelTest: a DAP server's mappings tables have no Language Id column, and a language
    server's still have one.
  • BundledTemplateCommandsTest:
    • New check that DAP template mappings have no language ID, and that language server template mappings do.
    • aFileTypeOfATemplateGoesToOneLanguage checks only mappings that have a language ID.
  • On IC 2024.2, 2025.3 and IU 2026.3, the dap.*, settings.* and launching.templates.* tests pass: 544 on each, with
    0 failures and 0 skipped.

Behaviour change

Before After
The Mappings tab of a DAP server has a Language Id column, and a DAP server created from a template gets a language ID for each mapping The Mappings tab of a DAP server has no Language Id column, and the DAP templates give no language ID

…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
@lagergren lagergren added this to the 0.30.2 milestone Nov 24, 2026
@lagergren lagergren added the enhancement New feature or request label Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • DAP server mapping tables no longer show a Language ID column, while language server mapping tables retain it.
    • DAP setup templates and instructions no longer request language IDs for file mappings.
  • Documentation
    • Updated DAP guidance to reflect the available mapping settings.

DAP mapping tables no longer show the Language Id column. Existing language-server mapping tables retain it. DAP templates and setup examples no longer specify language IDs, and template tests check that distinction.

Changes: DAP mapping language IDs

Layer / File(s) Summary
Optional Language Id column
src/main/java/com/redhat/devtools/lsp4ij/settings/ui/AbstractServerMappingTablePanel.java, src/main/java/com/redhat/devtools/lsp4ij/settings/ui/FileNamePatternServerMappingTablePanel.java, src/main/java/com/redhat/devtools/lsp4ij/settings/ui/FileTypeServerMappingTablePanel.java, src/main/java/com/redhat/devtools/lsp4ij/settings/ui/LanguageServerMappingTablePanel.java, src/main/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPServerMappingsPanel.java, src/test/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPServerMappingsPanelTest.java
Mapping table panels now accept a withLanguageId option. Existing constructors keep the column enabled by default. DAP mapping panels disable it, and tests check that language-server panels retain it.
DAP mappings and template validation
src/main/resources/templates/dap/*/template.json, src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java, src/main/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPServerMappingsPanel.java, docs/dap/UserGuide.md, docs/dap/user-defined-dap/erlang-edb.md, docs/dap/user-defined-dap/perl-dap.md
DAP template mappings and setup examples omit language IDs. Template mapping tests accept missing IDs and check that DAP mappings omit them while language-server mappings include them. The DAP guide no longer describes the Language Id column.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Other · Severity of issue fixed: Low

Suggested reviewers: angelozerr, muescha

Merge Risk: Minimal · up to 2648b

This change hides the Language Id column in DAP mapping tables and removes language IDs from the bundled DAP templates. Language-server mapping tables are unchanged. DAP matching and launch do not depend on the language ID, so existing and new DAP configurations should behave as before. The change looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the DAP Mappings tab loses the Language Id column, and DAP templates stop giving language IDs. The changeset matches this: it adds withLanguageId options to the mappin…
Description check Passed The description is detailed and on-topic. It links issue #1837, explains why the DAP Language Id column is removed, lists the code, template, doc and test changes, and gives a before/after behaviour t…
Linked Issues check Passed Issue #1837 has one directly linked target. Its coding requirements are: (1) the DAP Mappings tab should hide the Language Id column, and (2) the DAP templates should drop their languageId values. The…
Out of Scope Changes check Passed Every changed area connects to the #1837 scope. The withLanguageId constructor flags on AbstractServerMappingTablePanel and its three subclasses are the mechanism for hiding the column for DAP. The ex…
Full details: Title check

Explanation

The title names the main change: the DAP Mappings tab loses the Language Id column, and DAP templates stop giving language IDs. The changeset matches this: it adds withLanguageId options to the mapping panels, hides the column in DAPServerMappingsPanel, removes languageId values from 10 DAP templates, and updates docs and tests. The title is long and uses a 'feat:' prefix, but it is accurate and specific.

Full details: Description check

Explanation

The description is detailed and on-topic. It links issue #1837, explains why the DAP Language Id column is removed, lists the code, template, doc and test changes, and gives a before/after behaviour table. It also notes that the screenshot still shows the column.

Full details: Linked Issues check

Explanation

Issue #1837 has one directly linked target. Its coding requirements are: (1) the DAP Mappings tab should hide the Language Id column, and (2) the DAP templates should drop their languageId values. The PR meets both. DAPServerMappingsPanel builds its three mapping tables with withLanguageId=false, so the column is absent for DAP. The new DAPServerMappingsPanelTest checks that DAP tables have no Language Id column and that language server tables keep it. The 10 DAP templates lose their languageId values, and the language server templates keep theirs. BundledTemplateCommandsTest checks this split. Issue question 3 asks for the DAP user guide to state that DAP does not use the value. The PR removes the column paragraph from docs/dap/UserGuide.md and updates the edb and Perl pages. The screenshot docs/dap/images/DAP_config_type_mappings.png still shows the column. That is documentation, not a coding requirement, so it does not change this result. The PR does not implement the separate shared-panel rework or the duplicated-mappings bug, which the PR and the issue discussion mark as out of scope. Test results are reported by the author. This assessment relies on the PR summary and the test code described there. I did not re-run the tests.

Full details: Out of Scope Changes check

Explanation

Every changed area connects to the #1837 scope. The withLanguageId constructor flags on AbstractServerMappingTablePanel and its three subclasses are the mechanism for hiding the column for DAP. The existing constructors keep their behaviour, so language server settings are unchanged. The DAPServerMappingsPanel change applies the flag. The template edits remove only languageId values from DAP templates. The DAP extension point languageId attribute is kept, so plugins still load, which is within the agreed scope. The documentation edits match the removed column and values. The tests cover the new behaviour and the changed BundledTemplateCommandsTest assertion. No change in the summary alters DAP debugging logic, file matching, or language server behaviour.

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: f5cdecdd-4ca8-4e85-9f5b-299a99d0d91e
Commits

Reviewing files that changed from the base of the PR and between 436b029 and 2648b97.

Files selected for processing: 20

  • docs/dap/UserGuide.md
  • docs/dap/user-defined-dap/erlang-edb.md
  • docs/dap/user-defined-dap/perl-dap.md
  • src/main/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPServerMappingsPanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/AbstractServerMappingTablePanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/FileNamePatternServerMappingTablePanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/FileTypeServerMappingTablePanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/settings/ui/LanguageServerMappingTablePanel.java
  • src/main/resources/templates/dap/buildx-dockerfile/template.json
  • src/main/resources/templates/dap/codelldb/template.json
  • src/main/resources/templates/dap/erlang-edb/template.json
  • src/main/resources/templates/dap/go-delve/template.json
  • src/main/resources/templates/dap/julia/template.json
  • src/main/resources/templates/dap/perl-dap/template.json
  • src/main/resources/templates/dap/python-debugpy/template.json
  • src/main/resources/templates/dap/ruby-rdbg/template.json
  • src/main/resources/templates/dap/swift-lldb/template.json
  • src/main/resources/templates/dap/vscode-js-debug/template.json
  • src/test/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPServerMappingsPanelTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/launching/templates/BundledTemplateCommandsTest.java
Files with no reviewable changes: 1

  • docs/dap/UserGuide.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.68421% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.15%. Comparing base (436b029) to head (2648b97).

Files with missing lines Patch % Lines
...j/settings/ui/AbstractServerMappingTablePanel.java 71.42% 2 Missing ⚠️
...ngs/ui/FileNamePatternServerMappingTablePanel.java 66.66% 1 Missing ⚠️
...j/settings/ui/FileTypeServerMappingTablePanel.java 66.66% 1 Missing ⚠️
...j/settings/ui/LanguageServerMappingTablePanel.java 66.66% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren
lagergren merged commit 084bf75 into redhat-developer:main Nov 24, 2026
9 checks passed
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 |
lagergren added a commit that referenced this pull request Nov 25, 2026
Retakes the DAP Mappings screenshots without the Language Id column that #2173 removed, and the Terminate Thread screenshots with the run state of each thread (#2181). Adds a screenshot of Terminate Thread in the Frames view (#2217).

Fixes #2187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAP Mappings tab: what is the Language Id column for? Maybe remove it?

1 participant