Skip to content

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

Merged
Sheng Chen (jdneo) merged 2 commits into
microsoft:mainfrom
travkin79:fix-408-ws-only
Nov 4, 2026
Merged

Sheng Chen (jdneo) merged 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.

@jdneo

Copy link
Copy Markdown
Member

If we announce only the Eclipse workspace root, will CLS still finds all skills and are .md under each IProject? I remember it is not.

@travkin79

Copy link
Copy Markdown
Contributor Author

If we announce only the Eclipse workspace root, will CLS still finds all skills and are .md under each IProject? I remember it is not.

I tested this with a skill in .github/skills/demo/SKILL.md in a project located outside the Eclipse workspace
directory. The agent finds and uses it with this PR, just as on main. Edits to the skill also show up in new
conversations. I think, custom instructions are also still found, since I still see them in the "Custom instructions" preferences page.

Announcing only the workspace root doesn't affect discovery. According to Copilot's analysis, the CLS takes the folders to search for skills, instructions, prompts and agents from each request's workspaceFolders parameter (copilot/customSkill/list and similar requests, conversation/create, conversation/turn). It doesn't use the folders announced via workspace/workspaceFolders. The plugin fills those parameters with all projects, or with the referenced projects, depending on the custom-instructions scope setting. The CLS re-reads changed files based on their modification time.

@jdneo

Copy link
Copy Markdown
Member

Dietrich Travkin (@travkin79) just for a double confirm, in your case, if we choose report git root + latest CLS, the performance issue will still occur, is it correct?

@travkin79

Dietrich Travkin (travkin79) commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Hello Sheng Chen (@jdneo),

Dietrich Travkin (Dietrich Travkin (@travkin79)) just for a double confirm, in your case, if we choose report git root + latest CLS, the performance issue will still occur, is it correct?

Yes, exactly. I took this PR which only send the workspace root to CLS, adapted the CLS version in com.microsoft.copilot.eclipse.core/copilot-agent/package.json to 1.565.2, built copilot for eclipse with npm i -f and ./mvnw clean verify on the git repo root directory, and tested if the 10+ min hang still occurs with our 400+ Eclipse projects (original comment). It still occurred.

@jdneo

Copy link
Copy Markdown
Member

Ok, one potentially issue with the workspace root approach is that those md files in the project level will not auto updated (requires a ide restart). But that seems to be acceptable.

@iloveeclipse

Copy link
Copy Markdown
Contributor

So can we get this merged?

@jdneo
Sheng Chen (jdneo) merged commit 0c075b7 into microsoft:main Nov 4, 2026
4 checks passed
@jdneo

Copy link
Copy Markdown
Member

Merged, the nightly release should available tomorrow

@jdneo

Copy link
Copy Markdown
Member

Thank you Dietrich Travkin (@travkin79) for contribution.

@jdneo

Copy link
Copy Markdown
Member

Andrey Loskutov (@iloveeclipse) Is everything ok with the new nightly? I'm about to bump versions.

@iloveeclipse

Copy link
Copy Markdown
Contributor

Is everything ok with the new nightly? I'm about to bump versions.

So far yes. Latest nightly fixes 3 major issues for us (some were fixed before) :

  • Chat view "hangs" for ~10 minutes because of CLS indexing (fixed here)
  • Chat view can't work with "Auto" mode
  • Chat view can't work without opened editor if there is at least one closed project.

So in sum, these fixes together would qualify for 0.22 version bump :-)

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.

4 participants