Skip to content

Announce only the workspace root as workspace folder to the CLS - #504

Open
Dietrich Travkin (travkin79) wants to merge 2 commits into
microsoft:mainfrom
travkin79:fix-408-ws-only
Open

Dietrich Travkin (travkin79) wants to merge 2 commits into
microsoft:mainfrom
travkin79:fix-408-ws-only

Conversation

@travkin79

@travkin79 Dietrich Travkin (travkin79) commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Related to #408, #373

Since #373 removed the CopilotLanguageClient.workspaceFolders() override, LSP4E announces every open project as a
workspace folder in initialize and workspace/didChangeWorkspaceFolders. With ~400 projects, the CLS is
CPU-bound for 8 – 13 minutes after startup; with ~60 projects, for a few seconds (see analysis in #408).

Changes

Risks

  • Projects located outside the workspace directory are no longer known to the CLS as workspace folders.
  • If the workspace directory contains a large tree, recursive searches in the CLS may become more expensive.

Verification

Verified on RHEL 9.6 with ~400 projects: the CLS is no longer CPU-bound for minutes after starting Eclipse. The
custom instructions listed in the preferences are the same as before. Not yet verified: whether custom
instructions are applied in chat responses, and the other Copilot features.

This is a workaround; the root cause is in the CLS (see #408). Feel free to reject it in favour of a CLS fix.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Integration validation is needed to confirm startup improvement, initialization and folder-change behavior, and acceptable handling of external projects and large workspace directories.

No open issues 🎉

What changed in this PR

Restores workspace-root-only folder reporting to the Copilot language client to reduce startup delays in workspaces with many projects, addressing the regression described in #408 after #373.

Changes:

  • Overrides workspaceFolders() to return only the Eclipse workspace root.
  • Adds a test verifying that an open project does not appear as a separate workspace folder.
File Description
com.microsoft.copilot.eclipse.core/​src/​com/​microsoft/​copilot/​eclipse/​core/​lsp/​CopilotLanguageClient.java Restores workspace-root-only folder reporting.
com.microsoft.copilot.eclipse.core.test/​src/​com/​microsoft/​copilot/​eclipse/​core/​lsp/​CopilotLanguageClientTests.java Tests folder reporting with an open project.

Review effort: Balanced

@iloveeclipse

Copy link
Copy Markdown
Contributor

All my projects reside outside of the Eclipse workspace.
If I see it right, for our ~400 projects located in a single git repo, only the common root should be announced as "workspace folder" to CLS? And that would be the git working dir.

@travkin79

Dietrich Travkin (travkin79) commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

All my projects reside outside of the Eclipse workspace. If I see it right, for our ~400 projects located in a single git repo, only the common root should be announced as "workspace folder" to CLS? And that would be the git working dir.

Yes, that's one option..

With this PR we announce only the Eclipse workspace root, exactly as 0.20 did (#136 until #373). Chat, custom
instructions, prompts, modes and MCP requests pass the project folders explicitly per request, so the CLS still
gets the projects where these features need them. On RHEL the list of custom instructions was unchanged; I have
not yet verified everything else (e.g. instructions being applied in responses).

Announcing the common git root instead would also reduce the number of folders, but that root is a huge tree (in
our case 55 GB with ~82k directories), which the CLS would then watch. That might trade one performance problem
for another.

The proper fix is in the CLS: it calls rewatchAll() for every added folder one by one, with O(N²) path checks
(see the analysis in #408). Processing the added folders as one batch would make this PR unnecessary.

Andrey Loskutov (@iloveeclipse), it would be great if you could find some time to test this PR with some of your workspaces.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Related to microsoft#408

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants