Skip to content

Commit

Permalink
Fix client/registerCapability request when workspaces/didChangeWorksp… (
Browse files Browse the repository at this point in the history
#598)

* Fix client/registerCapability request when workspaces/didChangeWorkspaceFolder even if dynamicRegistration set to false

* rename hasWsChangeWatchedFileDynamicRegistration

Co-authored-by: unknown <[email protected]>
  • Loading branch information
msivasubramaniaan and unknown authored Nov 26, 2021
1 parent 47ba49b commit fcfe397
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/yamlServerInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class YAMLServerInit {
}
);
this.connection.onInitialized(() => {
if (this.yamlSettings.hasWorkspaceFolderCapability) {
if (this.yamlSettings.hasWsChangeWatchedFileDynamicRegistration) {
this.connection.workspace.onDidChangeWorkspaceFolders((changedFolders) => {
this.yamlSettings.workspaceFolders = workspaceFoldersChanged(this.yamlSettings.workspaceFolders, changedFolders);
});
Expand Down Expand Up @@ -88,6 +88,12 @@ export class YAMLServerInit {
this.yamlSettings.hasConfigurationCapability = !!(
this.yamlSettings.capabilities.workspace && !!this.yamlSettings.capabilities.workspace.configuration
);

this.yamlSettings.hasWsChangeWatchedFileDynamicRegistration = !!(
this.yamlSettings.capabilities.workspace &&
this.yamlSettings.capabilities.workspace.didChangeWatchedFiles &&
this.yamlSettings.capabilities.workspace.didChangeWatchedFiles.dynamicRegistration
);
this.registerHandlers();

return {
Expand Down
1 change: 1 addition & 0 deletions src/yamlSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class SettingsState {
hasConfigurationCapability = false;
useVSCodeContentRequest = false;
yamlVersion: YamlVersion = '1.2';
hasWsChangeWatchedFileDynamicRegistration = false;
}

export class TextDocumentTestManager extends TextDocuments<TextDocument> {
Expand Down

0 comments on commit fcfe397

Please sign in to comment.