Skip to content

#2058 fix github authentication for vsccode - #2072

Merged
hohwille merged 21 commits into
devonfw:mainfrom
quando632:fix/2058-vscode-authentication
Sep 11, 2026
Merged

hohwille merged 21 commits into
devonfw:mainfrom
quando632:fix/2058-vscode-authentication

Conversation

@quando632

@quando632 quando632 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2058

Implemented changes

Vscode.java can now isolate VSCode via a named --profile instead of --user-data-dir.

--user-data-dir moves VSCode's IPC lock to a custom path. The OS-level vscode:// protocol handler (used by GitHub/Copilot OAuth callbacks) always targets VSCode's default data directory, so it could never find the running window and instead spawned a second, unauthenticated one.

--profile keeps the IPC lock at the default location while still giving each project and workspace its own isolated profile (separate auth sessions, extension state, settings). The profile name is ideasy-«project»-«workspace»: it contains the project name in addition to the workspace name because every IDEasy project has a main workspace by default and all of them would otherwise share a single profile.

As discussed in the daily, the new behaviour is behind a feature toggle so that it can be merged without risk:

VSCODE_PROFILE_ENABLED behaviour
unset or false (default) unchanged: --user-data-dir=«ideMetadataPath»/config
true new: --profile=ideasy-«project»-«workspace»

Once we are confident that the new behaviour works in all scenarios (multiple projects, multiple workspaces, vscode/vscodium), a follow-up PR can activate it by default and eventually remove both the toggle and the old behaviour.

--extensions-dir (per-project plugin isolation) is unaffected in both cases.

Note: enabling the toggle starts with a fresh VSCode profile. Settings, extension state and logins from the previous --user-data-dir are not migrated, so you have to log in once after enabling it.

Testing instructions

Automated tests

mvn -pl cli test -Dtest=VscodeTest

Both toggle states are covered:

  • testConfigureToolArgsUsesIdeMetadataPathForUserData - toggle disabled (default), --user-data-dir is used
  • testConfigureToolArgsUsesProfileIfFeatureToggleEnabled - toggle enabled, --profile including the project name is used

1. Default behaviour is unchanged (toggle disabled)

Do not set VSCODE_PROFILE_ENABLED and run:

ide vscode

Expected result:

  • VSCode starts as before with --user-data-dir pointing into the IDE metadata folder.
  • Settings, extensions and logins are exactly as before this PR.
  • The authentication problem of VSCode authentication not working with IDEasy #2058 still reproduces. This is intended while the toggle is disabled.

2. Enable the feature toggle

Add this to $IDE_HOME/conf/ide.properties (user specific, not to the shared settings):

VSCODE_PROFILE_ENABLED=true

Then run:

ide vscode

Expected result:

  • VSCode starts with --profile=ideasy-«project»-«workspace» and without any --user-data-dir.
  • The profile is new and therefore empty, so you are not logged in yet.

3. Auth fix verification (toggle enabled)

  1. Open Copilot and select Continue with GitHub.
  2. Complete the browser login flow.

Expected result:

  • Auth shows immediately.
  • No Developer: Reload Window needed.

4. Persistence verification (toggle enabled)

  1. Close VSCode.
  2. Reopen via ide vscode.

Expected result:

  • Still authenticated.

5. Per-project and per-workspace isolation (toggle enabled)

  1. Open a second workspace, and additionally a workspace of a different IDEasy project.
  2. Log in with a different GitHub account.

Expected result:

  • Each project and workspace maintains its own isolated authentication state.
  • Different GitHub accounts can be used independently.
  • In particular two different projects that both use the main workspace do not share a profile.

6. Plugins and settings in the new profile (toggle enabled)

VSCode tracks extension enablement per profile, and user level settings live inside the user-data-dir.

Expected result / to be verified:

  • Plugins installed by IDEasy (via --extensions-dir) are present and enabled in the new profile.
  • Workspace settings from .vscode/settings.json (e.g. java.jdt.ls.java.home) are still applied, since VSCode reads them from the opened workspace folder independent of the profile.
  • User level settings that lived inside the old user-data-dir are no longer read. Currently these are only telemetry opt-outs. If we want to keep them, they have to be migrated in the settings repo as a follow-up.

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@coveralls

coveralls commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 34616800230

Coverage increased (+0.01%) to 73.918%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 5 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

5 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/tool/vscode/Vscode.java 3 85.45%
com/devonfw/tools/ide/variable/IdeVariables.java 1 94.44%
com/devonfw/tools/ide/version/VersionSegment.java 1 91.34%

Coverage Stats

Coverage Status
Relevant Lines: 18803
Covered Lines: 14525
Line Coverage: 77.25%
Relevant Branches: 8403
Covered Branches: 5585
Branch Coverage: 66.46%
Branches in Coverage %: Yes
Coverage Strength: 3.29 hits per line

💛 - Coveralls

@quando632 quando632 added vscode Microsoft visual studio code bugfix PR that fixes a bug issue configuration should be configurable or configuration change labels Jun 24, 2026
@quando632 quando632 self-assigned this Jun 24, 2026
@quando632 quando632 moved this from 🆕 New to Team Review in IDEasy board Jun 24, 2026
@quando632 quando632 moved this from Team Review to 🆕 New in IDEasy board Jun 24, 2026
@quando632
quando632 marked this pull request as ready for review June 24, 2026 12:32
@quando632 quando632 moved this from 🆕 New to Team Review in IDEasy board Jun 24, 2026
@laert-ll

laert-ll commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Tested it locally and the problem is fixed!

I have a question/concern however: if I understand this correctly, removing --user-data-dir means also that VSCodes per-workspace data is not isolated anymore, and all the projects share the same user settings, keybindings, cache, themes etc. Is this intended behavior? Or is there maybe an alternative to this?

@quando632

quando632 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Yeah you are right. I have changed it to --profile. Now the VSCodes per-workspace data should be isolated. Can you check if it is working correctly now?

@laert-ll

laert-ll commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Tested it again locally and everything works as intended!

@quando632 quando632 moved this from Team Review to 👀 In review in IDEasy board Jul 8, 2026
Comment thread cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java Outdated
Comment thread cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java Outdated
…hentication

# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/tool/vscode/Vscode.java
#	cli/src/test/java/com/devonfw/tools/ide/tool/vscode/VscodeTest.java
…roject name in profile

The profile name now contains the project name in addition to the workspace name,
so that different IDEasy projects (that all have a 'main' workspace by default) no
longer share a single VSCode profile.

The switch from --user-data-dir to --profile is put behind the new feature toggle
VSCODE_PROFILE_ENABLED (disabled by default) so that the legacy behaviour remains
unchanged until the new one has been verified for all scenarios.

@hohwille hohwille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quando632 thanks for your update with the feature toggle. Now ready for merge. 👍

Comment thread documentation/variables.adoc Outdated
@hohwille hohwille added this to the release:2026.09.002 milestone Sep 11, 2026
Comment thread CHANGELOG.adoc Outdated
@quando632

Copy link
Copy Markdown
Contributor Author

Retest on SNAPSHOT 2026.09.002-09_16_07-SNAPSHOT - Windows 11: passed.

The only issue found is that plugins installed by IDEasy are not enabled in the freshly created profile. This is a known, minor issue and is already fixed by #2479 (pending review), so no separate bug issue is created here.

@quando632 quando632 added the QA approved Label a PR that has been re-testet via nightly SNAPSHOT after merge and commented. label Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR that fixes a bug issue configuration should be configurable or configuration change QA approved Label a PR that has been re-testet via nightly SNAPSHOT after merge and commented. vscode Microsoft visual studio code

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

VSCode authentication not working with IDEasy

5 participants