mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 00:59:03 +01:00
Contribute to html language server with a custom language. (#146731)
* Contribute to html language server with a custom language. Fixes #146730 Signed-off-by: azerr <azerr@redhat.com> * refactor out LanguageParticipants * restart client on language selector change * htmlLanguage -> htmlLanguageParticipants * tune autoInsert wording * tune autoInsert description Co-authored-by: azerr <azerr@redhat.com> Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
|
||||
import { window, workspace, Disposable, TextDocument, Position, SnippetString, TextDocumentChangeEvent, TextDocumentChangeReason, TextDocumentContentChangeEvent } from 'vscode';
|
||||
import { Runtime } from './htmlClient';
|
||||
import { LanguageParticipants } from './languageParticipants';
|
||||
|
||||
export function activateAutoInsertion(provider: (kind: 'autoQuote' | 'autoClose', document: TextDocument, position: Position) => Thenable<string>, supportedLanguages: { [id: string]: boolean }, runtime: Runtime): Disposable {
|
||||
export function activateAutoInsertion(provider: (kind: 'autoQuote' | 'autoClose', document: TextDocument, position: Position) => Thenable<string>, languageParticipants: LanguageParticipants, runtime: Runtime): Disposable {
|
||||
const disposables: Disposable[] = [];
|
||||
workspace.onDidChangeTextDocument(onDidChangeTextDocument, null, disposables);
|
||||
|
||||
@@ -33,7 +34,7 @@ export function activateAutoInsertion(provider: (kind: 'autoQuote' | 'autoClose'
|
||||
return;
|
||||
}
|
||||
const document = editor.document;
|
||||
if (!supportedLanguages[document.languageId]) {
|
||||
if (!languageParticipants.useAutoInsert(document.languageId)) {
|
||||
return;
|
||||
}
|
||||
const configurations = workspace.getConfiguration(undefined, document.uri);
|
||||
|
||||
Reference in New Issue
Block a user