[html][json] fix some missing dispose registrations

This commit is contained in:
Martin Aeschlimann 2022-03-02 11:57:04 +01:00
parent 11e60ebeec
commit 4274ec05b8
No known key found for this signature in database
GPG key ID: 2609A01E695523E3
2 changed files with 6 additions and 6 deletions

View file

@ -229,7 +229,7 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
const regionCompletionRegExpr = /^(\s*)(<(!(-(-\s*(#\w*)?)?)?)?)?$/;
const htmlSnippetCompletionRegExpr = /^(\s*)(<(h(t(m(l)?)?)?)?)?$/;
languages.registerCompletionItemProvider(documentSelector, {
toDispose.push(languages.registerCompletionItemProvider(documentSelector, {
provideCompletionItems(doc, pos) {
const results: CompletionItem[] = [];
let lineUntilPos = doc.getText(new Range(new Position(pos.line, 0), pos));
@ -278,7 +278,7 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
}
return results;
}
});
}));
const promptForLinkedEditingKey = 'html.promptForLinkedEditing';
if (extensions.getExtension('formulahendry.auto-rename-tag') !== undefined && (context.globalState.get(promptForLinkedEditingKey) !== false)) {

View file

@ -124,13 +124,13 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
let isClientReady = false;
commands.registerCommand('json.clearCache', async () => {
toDispose.push(commands.registerCommand('json.clearCache', async () => {
if (isClientReady && runtime.schemaRequests.clearCache) {
const cachedSchemas = await runtime.schemaRequests.clearCache();
await client.sendNotification(SchemaContentChangeNotification.type, cachedSchemas);
}
window.showInformationMessage(localize('json.clearCache.completed', "JSON schema cache cleared."));
});
}));
// Options to control the language client
const clientOptions: LanguageClientOptions = {
@ -306,9 +306,9 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations(context));
extensions.onDidChange(_ => {
toDispose.push(extensions.onDidChange(_ => {
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations(context));
});
}));
// manually register / deregister format provider based on the `json.format.enable` setting avoiding issues with late registration. See #71652.
updateFormatterRegistration();