Skip to content

fix: a DAP run configuration expands ~ in its paths without FileUtil.expandUserHome, which IntelliJ 2025.3 schedules for removal - #2329

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/dap-expand-user-home
Nov 28, 2026

Conversation

@lagergren

@lagergren lagergren commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #2327

Since #2302, a DAP run configuration expands a leading ~ in its Working directory and File with FileUtil.expandUserHome, which IntelliJ 2025.3 schedules for removal. This replaces it with LSP4IJ's own implementation, as #1927 did for findInPath. One commit, and no change for the user. For 0.30.2, which is the first release with #2302's call.

Why LSP4IJ's own implementation

No public API expands ~ on all of 2024.2 to 2026.3. In the jars of each release:

  • FileUtil.expandUserHome(String): public in 2024.2, 2025.1 and 2025.2. @Deprecated and @ApiStatus.ScheduledForRemoval in 2025.3 and 2026.3, where it calls the next one.
  • OSAgnosticPathUtil.expandUserHome(String): missing in 2024.2, 2025.1 and 2025.2, and public in 2025.3 and 2026.3.
  • In 2026.3 and not in 2024.2: EelPathUtils.expandUserHome(EelDescriptor, String), for a path of an Eel environment, and NioPathCompletion.expandHome, a suspend function of the file chooser's text field.

The jars of 2024.2 and 2026.3 have no other method of these names.

What it does

DAPRunConfigurationOptions.expandUserHome does what FileUtil.expandUserHome does in 2024.2, and OSAgnosticPathUtil.expandUserHome in 2026.3, going by their bytecode:

  • ~ alone is the user's home, from SystemProperties.getUserHome(), which is public and not deprecated on 2024.2 to 2026.3;
  • a ~ followed by / or \ is replaced with the user's home;
  • any other path stays as it is, such as ~user/file, ~file, or a path with a ~ further in.

Tests

The new testOnlyALeadingTildeAloneOrBeforeASeparatorIsTheHomeDirectory covers each of these cases. The tests of #2302 with ~ pass unchanged.

Headless, with the counts from the JUnit XMLs, for DAPRunConfigurationOptionsResolvedPathTest, DAPCommandLineStateTest, DAPRunConfigurationCheckTest, DAPSettingsEditorWorkingDirectoryTest and DAPExecutorRoutingTest:

IntelliJ Tests Failures
IC 2024.2 30 0
IU 2026.3 30 0

main's plugin verifier reports 1 usage of an API scheduled for removal against 2025.3 to 2026.3, this one. This
PR's reports none: "Compatible. 32 usages of deprecated API" against IU-263.7307.200, the 32 that main has too.

…expandUserHome, which IntelliJ 2025.3 schedules for removal

Since redhat-developer#2302, the Working directory and the File of a DAP run configuration take a leading ~, which
DAPRunConfigurationOptions.resolvePath expanded with FileUtil.expandUserHome. IntelliJ 2025.3 deprecates it and
schedules it for removal, and the plugin verifier reports it against 2025.3 to 2026.3: it is the only API scheduled for
removal that LSP4IJ uses. Its replacement, OSAgnosticPathUtil.expandUserHome, only exists from 2025.3. No other public
API expands ~ on 2024.2 to 2026.3: EelPathUtils.expandUserHome takes an EelDescriptor and doesn't exist in 2024.2, and
the file chooser's NioPathCompletion.expandHome is part of its text field.

DAPRunConfigurationOptions.expandUserHome does what both platform methods do, in 2024.2 and in 2026.3: ~ alone is the
user's home, a ~ before / or \ is replaced with it, and any other path, such as ~user/file, stays as it is. Nothing
changes for the user.

Fixes redhat-developer#2327
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Run configuration paths now correctly expand ~, ~/..., and ~\... to the current user’s home directory. Other tilde-prefixed paths, tildes elsewhere in a path, and empty paths remain unchanged.

DAPRunConfigurationOptions.resolvePath now uses a local helper to expand supported leading-tilde paths with SystemProperties.getUserHome(). Tests cover the supported prefixes and inputs that remain unchanged.

Changes: Run configuration path expansion

Layer / File(s) Summary
Local expansion and resolved-path tests
src/main/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPRunConfigurationOptions.java, src/test/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPRunConfigurationOptionsResolvedPathTest.java
resolvePath uses a local helper that expands ~, ~/, and ~\ with the system user home. Tests cover these prefixes and unchanged inputs, including ~user, non-leading tildes, and empty strings.

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

Change: Refactor

Merge Risk: Minimal · up to fcefe

This change replaces a scheduled-for-removal IntelliJ API with a local home-directory expansion helper and keeps the specified behavior. Tests cover the supported prefixes and the unchanged cases. There is no remaining merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: a DAP run configuration now expands ~ without FileUtil.expandUserHome, which IntelliJ 2025.3 schedules for removal. The raw summary confirms the change replaces the c…
Linked Issues check Passed [#2327] The objective is to stop using FileUtil.expandUserHome in DAP run-configuration path expansion, keep the same behavior, and avoid OSAgnosticPathUtil.expandUserHome, which is missing on 2024.2 …
Out of Scope Changes check Passed The changes stay within #2327. They consist of a local replacement for FileUtil.expandUserHome in DAPRunConfigurationOptions and a test update in DAPRunConfigurationOptionsResolvedPathTest. Both chang…
Description check Passed The description is specific and relevant to the changeset. It explains that a leading ~ in the DAP run configuration's Working directory and File is expanded by a new LSP4IJ expandUserHome helper …
Full details: Title check

Explanation

The title states the main change: a DAP run configuration now expands ~ without FileUtil.expandUserHome, which IntelliJ 2025.3 schedules for removal. The raw summary confirms the change replaces the call with a local expandUserHome helper in DAPRunConfigurationOptions. The title is long and includes rationale, but it is specific and related to the changeset.

Full details: Linked Issues check

Explanation

[#2327] The objective is to stop using FileUtil.expandUserHome in DAP run-configuration path expansion, keep the same behavior, and avoid OSAgnosticPathUtil.expandUserHome, which is missing on 2024.2 to 2025.2. At head, DAPRunConfigurationOptions.resolvePath calls a new package-private static helper, expandUserHome(String). The helper returns SystemProperties.getUserHome() for a bare '', replaces a leading '' followed by '/' or '' with the user's home, and returns every other path unchanged, including 'user/file'. This matches the issue's requested behavior. SystemProperties is imported from com.intellij.util. The resolvePath flow for absolute, separator-leading, and relative paths is unchanged. The PR description reports that the existing #2302 tests with '' pass unchanged and that a new test covers the cases. I did not read the test file in this review, so the test results rest on the PR description and the summary. The implementation evidence is sufficient for the coding requirement.

Full details: Out of Scope Changes check

Explanation

The changes stay within #2327. They consist of a local replacement for FileUtil.expandUserHome in DAPRunConfigurationOptions and a test update in DAPRunConfigurationOptionsResolvedPathTest. Both changes serve the issue's objective. The FileUtil import remains because FileUtil.isAbsolute is still used. No unrelated behavior change appears in the reviewed head code. The whole-PR base is 0c5aa98, and the diff inspection tool was unavailable, so the file-level scope check relies on the full file read at head and the PR summary.

Full details: Description check

Explanation

The description is specific and relevant to the changeset. It explains that a leading ~ in the DAP run configuration's Working directory and File is expanded by a new LSP4IJ expandUserHome helper instead of the deprecated FileUtil.expandUserHome. It lists the supported cases, the reasons no public API covers all target IntelliJ versions, and the test coverage and verifier results. This matches the changeset summary, which adds the helper in DAPRunConfigurationOptions and a test for the expansion cases.

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: 8914403b-cb4e-403e-a603-cb0d88e8b85c
Commits

Reviewing files that changed from the base of the PR and between 0c5aa98 and fcefe9e.

Files selected for processing: 2

  • src/main/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPRunConfigurationOptions.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/configurations/DAPRunConfigurationOptionsResolvedPathTest.java

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

@lagergren lagergren added debt dap Debugging Adapter Protocol labels Nov 28, 2026
@lagergren lagergren added this to the 0.30.2 milestone Nov 28, 2026
@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.63%. Comparing base (0c5aa98) to head (fcefe9e).

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #2329     +/-   ##
=========================================
  Coverage   58.63%   58.63%             
=========================================
  Files         849      849             
  Lines       36704    36709      +5     
  Branches     7606     5766   -1840     
=========================================
+ Hits        21520    21526      +6     
- Misses      12183    12184      +1     
+ Partials     3001     2999      -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 55f8b05 into redhat-developer:main Nov 28, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dap Debugging Adapter Protocol debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAP: the expansion of ~ in a run configuration's paths uses FileUtil.expandUserHome, which IntelliJ 2025.3 schedules for removal

1 participant