Skip to content

VS Code Host doesn't deliver Rename event to all clients instantiated for each workspace folder in a multi-root workspace #200372

Description

@selim-nasir

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.83.0
  • OS Version: Windows 10 Enterprise 21H2
  • vscode-languageclient Version: 8.1.0

We have custom VS Code Language Client extension that creates an instance of vscode-languageclient.LanguageClient per workspace folder in a multi-rooted workspace. Each instance of LanguageClient starts an instance of custom Language Server (written in C#).
As an example, myworkspace folder comprises 3 workspace folders, for each of which a LanguageClient instance is created.

myworkspace.code-workspace
{
"folders": [
{
"path": "workspace-folderA"
},
{
"path": "workspace-folderB"
},
{
"path": "workspace-folderC"
}],
}

When the user hovers on an element in any code file in one of workspace folders, this hover event is delivered to all instances of Language Servers through LanguageClients. This is the expected behavior. But for renaming in VS Code, the behavior is different:

When the user renames an element in any code file in one of workspace folders (workspace-folderA, for example), rename event is delivered only one of Language Server instances (Language Server instance running for workspace-folderB, for example). Other Language Server instances never receive such event for handling. According to our business logic, all LanguageClients should be notified of renames, because there can be code elements in other workspace folders referencing the renamed element.

In case of renaming, the provideRenameEdits method inside the vscode-languageclient/lib/common/rename.js (from the installed module) is called only once for one of LanguageClients which sends the request to its associated Language Server. In case of hover though, provideHover method (hover.js) gets called for all LanguageClients, as expected. It may be the case that VS Code Host delivers rename event only to single LanguageClient. After many subsequent closing and reopening the workspace, it's been observed that the selection of LanguageClient to send the rename event is arbitrary.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions