diff --git a/client/src/common/client.ts b/client/src/common/client.ts index 8fd622253..1e4e7d990 100644 --- a/client/src/common/client.ts +++ b/client/src/common/client.ts @@ -1434,9 +1434,9 @@ export abstract class BaseLanguageClient implements FeatureClient entry[1]).reverse()) { - feature.dispose(); + feature.clear(); } if (mode === 'stop' && this._diagnostics !== undefined) { this._diagnostics.dispose(); diff --git a/client/src/common/configuration.ts b/client/src/common/configuration.ts index 666d32aee..0f30d482d 100644 --- a/client/src/common/configuration.ts +++ b/client/src/common/configuration.ts @@ -87,7 +87,7 @@ export class ConfigurationFeature implements StaticFeature { return result; } - public dispose(): void { + public clear(): void { } } @@ -149,11 +149,11 @@ export type $ConfigurationOptions = { export class SyncConfigurationFeature implements DynamicFeature { - private isDisposed: boolean; + private isCleared: boolean; private readonly _listeners: Map; constructor(private _client: FeatureClient) { - this.isDisposed = false; + this.isCleared = false; this._listeners = new Map(); } @@ -170,6 +170,7 @@ export class SyncConfigurationFeature implements DynamicFeature { value.forEach(disposable => disposable.dispose()); }); diff --git a/client/src/common/features.ts b/client/src/common/features.ts index 2848a7a15..cbdd9f234 100644 --- a/client/src/common/features.ts +++ b/client/src/common/features.ts @@ -155,17 +155,18 @@ export interface StaticFeature { getState(): FeatureState; /** - * Called when the client is stopped to dispose this feature. Usually a feature - * un-registers listeners registered hooked up with the VS Code extension host. + * Called when the client is stopped or re-started to clear this feature. + * Usually a feature un-registers listeners registered hooked up with the + * VS Code extension host. */ - dispose(): void; + clear(): void; } export namespace StaticFeature { export function is (value: any): value is StaticFeature { const candidate: StaticFeature = value; return candidate !== undefined && candidate !== null && - Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.dispose) && + Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.clear) && (candidate.fillInitializeParams === undefined || Is.func(candidate.fillInitializeParams)); } } @@ -237,17 +238,18 @@ export interface DynamicFeature { unregister(id: string): void; /** - * Called when the client is stopped to dispose this feature. Usually a feature - * un-registers listeners registered hooked up with the VS Code extension host. + * Called when the client is stopped or re-started to clear this feature. + * Usually a feature un-registers listeners registered hooked up with the + * VS Code extension host. */ - dispose(): void; + clear(): void; } export namespace DynamicFeature { export function is(value: any): value is DynamicFeature { const candidate: DynamicFeature = value; return candidate !== undefined && candidate !== null && - Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.dispose) && + Is.func(candidate.fillClientCapabilities) && Is.func(candidate.initialize) && Is.func(candidate.getState) && Is.func(candidate.clear) && (candidate.fillInitializeParams === undefined || Is.func(candidate.fillInitializeParams)) && Is.func(candidate.register) && Is.func(candidate.unregister) && candidate.registrationType !== undefined; } @@ -285,7 +287,7 @@ export abstract class DynamicDocumentFeature implements Dyn public abstract registrationType: RegistrationType; public abstract register(data: RegistrationData): void; public abstract unregister(id: string): void; - public abstract dispose(): void; + public abstract clear(): void; /** * Returns the state the feature is in. @@ -424,7 +426,7 @@ export abstract class TextDocumentEventFeature

{ value.disposable.dispose(); }); @@ -618,7 +620,7 @@ export abstract class WorkspaceFeature implements DynamicFeature } } - public dispose(): void { + public clear(): void { this._registrations.forEach((registration) => { registration.disposable.dispose(); }); diff --git a/client/src/common/fileOperations.ts b/client/src/common/fileOperations.ts index 6f8b7ae4e..c9536c0e8 100644 --- a/client/src/common/fileOperations.ts +++ b/client/src/common/fileOperations.ts @@ -130,7 +130,7 @@ abstract class FileOperationFeature> implements DynamicFea } } - public dispose(): void { + public clear(): void { this._filters.clear(); if (this._listener) { this._listener.dispose(); @@ -276,8 +276,8 @@ abstract class CachingNotificationFileOperationFeature { for (let disposable of disposables) { disposable.dispose(); diff --git a/client/src/common/notebook.ts b/client/src/common/notebook.ts index b5909e6f8..252cdb0fc 100644 --- a/client/src/common/notebook.ts +++ b/client/src/common/notebook.ts @@ -964,7 +964,7 @@ export class NotebookDocumentSyncFeature implements DynamicFeature { disposable.dispose(); } - public dispose(): void { + public clear(): void { for (let disposable of this._listeners.values()) { disposable.dispose(); } diff --git a/testbed/client/src/extension.ts b/testbed/client/src/extension.ts index 1e2b745ef..2c9305432 100644 --- a/testbed/client/src/extension.ts +++ b/testbed/client/src/extension.ts @@ -27,7 +27,7 @@ export async function activate(context: ExtensionContext) { { scheme: 'file', pattern: '**/.vscode/test.txt' } ], synchronize: { - configurationSection: 'testbed' + // configurationSection: 'testbed' // fileEvents: workspace.createFileSystemWatcher('**/*'), }, diagnosticCollectionName: 'markers', diff --git a/testbed/server/src/server.ts b/testbed/server/src/server.ts index 96ab34818..0d1378ac0 100644 --- a/testbed/server/src/server.ts +++ b/testbed/server/src/server.ts @@ -17,7 +17,7 @@ import { TextEdit, ProposedFeatures, DiagnosticTag, InsertTextFormat, SelectionRangeRequest, SelectionRange, InsertReplaceEdit, SemanticTokensClientCapabilities, SemanticTokensLegend, SemanticTokensBuilder, SemanticTokensRegistrationType, SemanticTokensRegistrationOptions, ProtocolNotificationType, ChangeAnnotation, WorkspaceChange, CompletionItemKind, DiagnosticSeverity, - DocumentDiagnosticReportKind, WorkspaceDiagnosticReport, NotebookDocuments, CompletionList, DocumentLinkResolveRequest + DocumentDiagnosticReportKind, WorkspaceDiagnosticReport, NotebookDocuments, CompletionList, DocumentLinkResolveRequest, DidChangeConfigurationNotification } from 'vscode-languageserver/node'; import { @@ -187,6 +187,7 @@ connection.onInitialize((params, cancel, progress): Thenable | }); connection.onInitialized((params) => { + void connection.client.register(DidChangeConfigurationNotification.type, undefined); connection.workspace.onDidChangeWorkspaceFolders((event) => { connection.console.log('Workspace folder changed received'); });