@codingame/monaco-languageclient
Advanced tools
Comparing version 0.17.3 to 0.17.4
@@ -22,45 +22,43 @@ import type * as monaco from 'monaco-editor-core'; | ||
registerCompletionItemProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): Disposable; | ||
protected createCompletionProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): monaco.languages.CompletionItemProvider; | ||
protected createCompletionProvider(provider: CompletionItemProvider, ...triggerCharacters: string[]): monaco.languages.CompletionItemProvider; | ||
registerHoverProvider(selector: DocumentSelector, provider: HoverProvider): Disposable; | ||
protected createHoverProvider(selector: DocumentSelector, provider: HoverProvider): monaco.languages.HoverProvider; | ||
protected createHoverProvider(provider: HoverProvider): monaco.languages.HoverProvider; | ||
registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): Disposable; | ||
protected createSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): monaco.languages.SignatureHelpProvider; | ||
protected createSignatureHelpProvider(provider: SignatureHelpProvider, ...triggerCharacters: string[]): monaco.languages.SignatureHelpProvider; | ||
registerDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): Disposable; | ||
protected createDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): monaco.languages.DefinitionProvider; | ||
protected createDefinitionProvider(provider: DefinitionProvider): monaco.languages.DefinitionProvider; | ||
registerReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): Disposable; | ||
protected createReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): monaco.languages.ReferenceProvider; | ||
protected createReferenceProvider(provider: ReferenceProvider): monaco.languages.ReferenceProvider; | ||
registerDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): Disposable; | ||
protected createDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): monaco.languages.DocumentHighlightProvider; | ||
protected createDocumentHighlightProvider(provider: DocumentHighlightProvider): monaco.languages.DocumentHighlightProvider; | ||
registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider): Disposable; | ||
protected createDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider): monaco.languages.DocumentSymbolProvider; | ||
protected createDocumentSymbolProvider(provider: DocumentSymbolProvider): monaco.languages.DocumentSymbolProvider; | ||
registerCodeActionsProvider(selector: DocumentSelector, provider: CodeActionProvider): Disposable; | ||
protected createCodeActionProvider(selector: DocumentSelector, provider: CodeActionProvider): monaco.languages.CodeActionProvider; | ||
protected createCodeActionProvider(provider: CodeActionProvider): monaco.languages.CodeActionProvider; | ||
registerCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): Disposable; | ||
protected createCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): monaco.languages.CodeLensProvider; | ||
protected createCodeLensProvider(provider: CodeLensProvider): monaco.languages.CodeLensProvider; | ||
registerDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): Disposable; | ||
protected createDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): monaco.languages.DocumentFormattingEditProvider; | ||
protected createDocumentFormattingEditProvider(provider: DocumentFormattingEditProvider): monaco.languages.DocumentFormattingEditProvider; | ||
registerDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): Disposable; | ||
createDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): monaco.languages.DocumentRangeFormattingEditProvider; | ||
createDocumentRangeFormattingEditProvider(provider: DocumentRangeFormattingEditProvider): monaco.languages.DocumentRangeFormattingEditProvider; | ||
registerOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): Disposable; | ||
protected createOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): monaco.languages.OnTypeFormattingEditProvider; | ||
protected createOnTypeFormattingEditProvider(provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): monaco.languages.OnTypeFormattingEditProvider; | ||
registerRenameProvider(selector: DocumentSelector, provider: RenameProvider): Disposable; | ||
protected createRenameProvider(selector: DocumentSelector, provider: RenameProvider): monaco.languages.RenameProvider; | ||
protected createRenameProvider(provider: RenameProvider): monaco.languages.RenameProvider; | ||
registerDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): Disposable; | ||
protected createDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): monaco.languages.LinkProvider; | ||
protected createDocumentLinkProvider(provider: DocumentLinkProvider): monaco.languages.LinkProvider; | ||
registerImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): Disposable; | ||
protected createImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): monaco.languages.ImplementationProvider; | ||
protected createImplementationProvider(provider: ImplementationProvider): monaco.languages.ImplementationProvider; | ||
registerTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): Disposable; | ||
protected createTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): monaco.languages.TypeDefinitionProvider; | ||
protected createTypeDefinitionProvider(provider: TypeDefinitionProvider): monaco.languages.TypeDefinitionProvider; | ||
registerColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): Disposable; | ||
protected createDocumentColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): monaco.languages.DocumentColorProvider; | ||
protected createDocumentColorProvider(provider: DocumentColorProvider): monaco.languages.DocumentColorProvider; | ||
registerFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): Disposable; | ||
protected createFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): monaco.languages.FoldingRangeProvider; | ||
protected createFoldingRangeProvider(provider: FoldingRangeProvider): monaco.languages.FoldingRangeProvider; | ||
registerDocumentSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): Disposable; | ||
protected createSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentSemanticTokensProvider; | ||
protected createSemanticTokensProvider(provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentSemanticTokensProvider; | ||
registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable; | ||
protected createRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentRangeSemanticTokensProvider; | ||
protected createRangeSemanticTokensProvider(provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentRangeSemanticTokensProvider; | ||
protected matchModel(selector: string | DocumentFilter | DocumentSelector, model: MonacoModelIdentifier): boolean; | ||
protected matchLanguage(selector: string | DocumentFilter | DocumentSelector): Set<string>; | ||
protected matchLanguageByFilter(selector: string | DocumentFilter): string; | ||
} | ||
//# sourceMappingURL=monaco-languages.d.ts.map |
@@ -10,3 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
define(["require", "exports", "glob-to-regexp", "./services", "./monaco-diagnostic-collection", "./disposable"], function (require, exports, globToRegExp, services_1, monaco_diagnostic_collection_1, disposable_1) { | ||
define(["require", "exports", "glob-to-regexp", "./services", "./monaco-diagnostic-collection"], function (require, exports, globToRegExp, services_1, monaco_diagnostic_collection_1) { | ||
"use strict"; | ||
@@ -53,17 +53,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
registerCompletionItemProvider(selector, provider, ...triggerCharacters) { | ||
const completionProvider = this.createCompletionProvider(selector, provider, ...triggerCharacters); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCompletionItemProvider(language, completionProvider)); | ||
} | ||
; | ||
return providers; | ||
const completionProvider = this.createCompletionProvider(provider, ...triggerCharacters); | ||
return this._monaco.languages.registerCompletionItemProvider(selector, completionProvider); | ||
} | ||
createCompletionProvider(selector, provider, ...triggerCharacters) { | ||
createCompletionProvider(provider, ...triggerCharacters) { | ||
return { | ||
triggerCharacters, | ||
provideCompletionItems: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const wordUntil = model.getWordUntilPosition(position); | ||
@@ -87,15 +79,8 @@ const defaultRange = new this._monaco.Range(position.lineNumber, wordUntil.startColumn, position.lineNumber, wordUntil.endColumn); | ||
registerHoverProvider(selector, provider) { | ||
const hoverProvider = this.createHoverProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerHoverProvider(language, hoverProvider)); | ||
} | ||
return providers; | ||
const hoverProvider = this.createHoverProvider(provider); | ||
return this._monaco.languages.registerHoverProvider(selector, hoverProvider); | ||
} | ||
createHoverProvider(selector, provider) { | ||
createHoverProvider(provider) { | ||
return { | ||
provideHover: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -108,10 +93,6 @@ const hover = yield provider.provideHover(params, token); | ||
registerSignatureHelpProvider(selector, provider, ...triggerCharacters) { | ||
const signatureHelpProvider = this.createSignatureHelpProvider(selector, provider, ...triggerCharacters); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerSignatureHelpProvider(language, signatureHelpProvider)); | ||
} | ||
return providers; | ||
const signatureHelpProvider = this.createSignatureHelpProvider(provider, ...triggerCharacters); | ||
return this._monaco.languages.registerSignatureHelpProvider(selector, signatureHelpProvider); | ||
} | ||
createSignatureHelpProvider(selector, provider, ...triggerCharacters) { | ||
createSignatureHelpProvider(provider, ...triggerCharacters) { | ||
const signatureHelpTriggerCharacters = [...(provider.triggerCharacters || triggerCharacters || [])]; | ||
@@ -122,5 +103,2 @@ return { | ||
provideSignatureHelp: (model, position, token, context) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -133,15 +111,8 @@ const signatureHelp = yield provider.provideSignatureHelp(params, token, this.m2p.asSignatureHelpContext(context)); | ||
registerDefinitionProvider(selector, provider) { | ||
const definitionProvider = this.createDefinitionProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDefinitionProvider(language, definitionProvider)); | ||
} | ||
return providers; | ||
const definitionProvider = this.createDefinitionProvider(provider); | ||
return this._monaco.languages.registerDefinitionProvider(selector, definitionProvider); | ||
} | ||
createDefinitionProvider(selector, provider) { | ||
createDefinitionProvider(provider) { | ||
return { | ||
provideDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -154,15 +125,8 @@ const result = yield provider.provideDefinition(params, token); | ||
registerReferenceProvider(selector, provider) { | ||
const referenceProvider = this.createReferenceProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerReferenceProvider(language, referenceProvider)); | ||
} | ||
return providers; | ||
const referenceProvider = this.createReferenceProvider(provider); | ||
return this._monaco.languages.registerReferenceProvider(selector, referenceProvider); | ||
} | ||
createReferenceProvider(selector, provider) { | ||
createReferenceProvider(provider) { | ||
return { | ||
provideReferences: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asReferenceParams(model, position, context); | ||
@@ -175,15 +139,8 @@ const result = yield provider.provideReferences(params, token); | ||
registerDocumentHighlightProvider(selector, provider) { | ||
const documentHighlightProvider = this.createDocumentHighlightProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentHighlightProvider(language, documentHighlightProvider)); | ||
} | ||
return providers; | ||
const documentHighlightProvider = this.createDocumentHighlightProvider(provider); | ||
return this._monaco.languages.registerDocumentHighlightProvider(selector, documentHighlightProvider); | ||
} | ||
createDocumentHighlightProvider(selector, provider) { | ||
createDocumentHighlightProvider(provider) { | ||
return { | ||
provideDocumentHighlights: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -196,15 +153,8 @@ const result = yield provider.provideDocumentHighlights(params, token); | ||
registerDocumentSymbolProvider(selector, provider) { | ||
const documentSymbolProvider = this.createDocumentSymbolProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentSymbolProvider(language, documentSymbolProvider)); | ||
} | ||
return providers; | ||
const documentSymbolProvider = this.createDocumentSymbolProvider(provider); | ||
return this._monaco.languages.registerDocumentSymbolProvider(selector, documentSymbolProvider); | ||
} | ||
createDocumentSymbolProvider(selector, provider) { | ||
createDocumentSymbolProvider(provider) { | ||
return { | ||
provideDocumentSymbols: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentSymbolParams(model); | ||
@@ -217,15 +167,8 @@ const result = yield provider.provideDocumentSymbols(params, token); | ||
registerCodeActionsProvider(selector, provider) { | ||
const codeActionProvider = this.createCodeActionProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCodeActionProvider(language, codeActionProvider)); | ||
} | ||
return providers; | ||
const codeActionProvider = this.createCodeActionProvider(provider); | ||
return this._monaco.languages.registerCodeActionProvider(selector, codeActionProvider); | ||
} | ||
createCodeActionProvider(selector, provider) { | ||
createCodeActionProvider(provider) { | ||
return { | ||
provideCodeActions: (model, range, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeActionParams(model, range, context); | ||
@@ -247,15 +190,8 @@ let result = yield provider.provideCodeActions(params, token); | ||
registerCodeLensProvider(selector, provider) { | ||
const codeLensProvider = this.createCodeLensProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCodeLensProvider(language, codeLensProvider)); | ||
} | ||
return providers; | ||
const codeLensProvider = this.createCodeLensProvider(provider); | ||
return this._monaco.languages.registerCodeLensProvider(selector, codeLensProvider); | ||
} | ||
createCodeLensProvider(selector, provider) { | ||
createCodeLensProvider(provider) { | ||
return { | ||
provideCodeLenses: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeLensParams(model); | ||
@@ -266,5 +202,2 @@ const result = yield provider.provideCodeLenses(params, token); | ||
resolveCodeLens: provider.resolveCodeLens ? (model, codeLens, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return codeLens; | ||
} | ||
const protocolCodeLens = this.m2p.asCodeLens(codeLens); | ||
@@ -281,15 +214,8 @@ const result = yield provider.resolveCodeLens(protocolCodeLens, token); | ||
registerDocumentFormattingEditProvider(selector, provider) { | ||
const documentFormattingEditProvider = this.createDocumentFormattingEditProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentFormattingEditProvider(language, documentFormattingEditProvider)); | ||
} | ||
return providers; | ||
const documentFormattingEditProvider = this.createDocumentFormattingEditProvider(provider); | ||
return this._monaco.languages.registerDocumentFormattingEditProvider(selector, documentFormattingEditProvider); | ||
} | ||
createDocumentFormattingEditProvider(selector, provider) { | ||
createDocumentFormattingEditProvider(provider) { | ||
return { | ||
provideDocumentFormattingEdits: (model, options, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentFormattingParams(model, options); | ||
@@ -302,15 +228,8 @@ const result = yield provider.provideDocumentFormattingEdits(params, token); | ||
registerDocumentRangeFormattingEditProvider(selector, provider) { | ||
const documentRangeFormattingEditProvider = this.createDocumentRangeFormattingEditProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentRangeFormattingEditProvider(language, documentRangeFormattingEditProvider)); | ||
} | ||
return providers; | ||
const documentRangeFormattingEditProvider = this.createDocumentRangeFormattingEditProvider(provider); | ||
return this._monaco.languages.registerDocumentRangeFormattingEditProvider(selector, documentRangeFormattingEditProvider); | ||
} | ||
createDocumentRangeFormattingEditProvider(selector, provider) { | ||
createDocumentRangeFormattingEditProvider(provider) { | ||
return { | ||
provideDocumentRangeFormattingEdits: (model, range, options, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentRangeFormattingParams(model, range, options); | ||
@@ -323,10 +242,6 @@ const result = yield provider.provideDocumentRangeFormattingEdits(params, token); | ||
registerOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter) { | ||
const onTypeFormattingEditProvider = this.createOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerOnTypeFormattingEditProvider(language, onTypeFormattingEditProvider)); | ||
} | ||
return providers; | ||
const onTypeFormattingEditProvider = this.createOnTypeFormattingEditProvider(provider, firstTriggerCharacter, ...moreTriggerCharacter); | ||
return this._monaco.languages.registerOnTypeFormattingEditProvider(selector, onTypeFormattingEditProvider); | ||
} | ||
createOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter) { | ||
createOnTypeFormattingEditProvider(provider, firstTriggerCharacter, ...moreTriggerCharacter) { | ||
const autoFormatTriggerCharacters = [firstTriggerCharacter].concat(moreTriggerCharacter); | ||
@@ -336,5 +251,2 @@ return { | ||
provideOnTypeFormattingEdits: (model, position, ch, options, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentOnTypeFormattingParams(model, position, ch, options); | ||
@@ -347,15 +259,8 @@ const result = yield provider.provideOnTypeFormattingEdits(params, token); | ||
registerRenameProvider(selector, provider) { | ||
const renameProvider = this.createRenameProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerRenameProvider(language, renameProvider)); | ||
} | ||
return providers; | ||
const renameProvider = this.createRenameProvider(provider); | ||
return this._monaco.languages.registerRenameProvider(selector, renameProvider); | ||
} | ||
createRenameProvider(selector, provider) { | ||
createRenameProvider(provider) { | ||
return { | ||
provideRenameEdits: (model, position, newName, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asRenameParams(model, position, newName); | ||
@@ -368,15 +273,8 @@ const result = yield provider.provideRenameEdits(params, token); | ||
registerDocumentLinkProvider(selector, provider) { | ||
const linkProvider = this.createDocumentLinkProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerLinkProvider(language, linkProvider)); | ||
} | ||
return providers; | ||
const linkProvider = this.createDocumentLinkProvider(provider); | ||
return this._monaco.languages.registerLinkProvider(selector, linkProvider); | ||
} | ||
createDocumentLinkProvider(selector, provider) { | ||
createDocumentLinkProvider(provider) { | ||
return { | ||
provideLinks: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentLinkParams(model); | ||
@@ -402,15 +300,8 @@ const result = yield provider.provideDocumentLinks(params, token); | ||
registerImplementationProvider(selector, provider) { | ||
const implementationProvider = this.createImplementationProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerImplementationProvider(language, implementationProvider)); | ||
} | ||
return providers; | ||
const implementationProvider = this.createImplementationProvider(provider); | ||
return this._monaco.languages.registerImplementationProvider(selector, implementationProvider); | ||
} | ||
createImplementationProvider(selector, provider) { | ||
createImplementationProvider(provider) { | ||
return { | ||
provideImplementation: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -423,15 +314,8 @@ const result = yield provider.provideImplementation(params, token); | ||
registerTypeDefinitionProvider(selector, provider) { | ||
const typeDefinitionProvider = this.createTypeDefinitionProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerTypeDefinitionProvider(language, typeDefinitionProvider)); | ||
} | ||
return providers; | ||
const typeDefinitionProvider = this.createTypeDefinitionProvider(provider); | ||
return this._monaco.languages.registerTypeDefinitionProvider(selector, typeDefinitionProvider); | ||
} | ||
createTypeDefinitionProvider(selector, provider) { | ||
createTypeDefinitionProvider(provider) { | ||
return { | ||
provideTypeDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -444,15 +328,8 @@ const result = yield provider.provideTypeDefinition(params, token); | ||
registerColorProvider(selector, provider) { | ||
const documentColorProvider = this.createDocumentColorProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerColorProvider(language, documentColorProvider)); | ||
} | ||
return providers; | ||
const documentColorProvider = this.createDocumentColorProvider(provider); | ||
return this._monaco.languages.registerColorProvider(selector, documentColorProvider); | ||
} | ||
createDocumentColorProvider(selector, provider) { | ||
createDocumentColorProvider(provider) { | ||
return { | ||
provideDocumentColors: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -463,5 +340,2 @@ const result = yield provider.provideDocumentColors({ textDocument }, token); | ||
provideColorPresentations: (model, info, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -479,15 +353,8 @@ const range = this.m2p.asRange(info.range); | ||
registerFoldingRangeProvider(selector, provider) { | ||
const foldingRangeProvider = this.createFoldingRangeProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerFoldingRangeProvider(language, foldingRangeProvider)); | ||
} | ||
return providers; | ||
const foldingRangeProvider = this.createFoldingRangeProvider(provider); | ||
return this._monaco.languages.registerFoldingRangeProvider(selector, foldingRangeProvider); | ||
} | ||
createFoldingRangeProvider(selector, provider) { | ||
createFoldingRangeProvider(provider) { | ||
return { | ||
provideFoldingRanges: (model, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -502,10 +369,6 @@ const result = yield provider.provideFoldingRanges({ | ||
registerDocumentSemanticTokensProvider(selector, provider, legend) { | ||
const semanticTokensProvider = this.createSemanticTokensProvider(selector, provider, legend); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentSemanticTokensProvider(language, semanticTokensProvider)); | ||
} | ||
return providers; | ||
const semanticTokensProvider = this.createSemanticTokensProvider(provider, legend); | ||
return this._monaco.languages.registerDocumentSemanticTokensProvider(selector, semanticTokensProvider); | ||
} | ||
createSemanticTokensProvider(selector, provider, legend) { | ||
createSemanticTokensProvider(provider, legend) { | ||
return { | ||
@@ -517,5 +380,2 @@ getLegend() { | ||
provideDocumentSemanticTokens: (model, lastResultId, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -532,10 +392,6 @@ const result = yield provider.provideDocumentSemanticTokens({ | ||
registerDocumentRangeSemanticTokensProvider(selector, provider, legend) { | ||
const rangeSemanticTokensProvider = this.createRangeSemanticTokensProvider(selector, provider, legend); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentRangeSemanticTokensProvider(language, rangeSemanticTokensProvider)); | ||
} | ||
return providers; | ||
const rangeSemanticTokensProvider = this.createRangeSemanticTokensProvider(provider, legend); | ||
return this._monaco.languages.registerDocumentRangeSemanticTokensProvider(selector, rangeSemanticTokensProvider); | ||
} | ||
createRangeSemanticTokensProvider(selector, provider, legend) { | ||
createRangeSemanticTokensProvider(provider, legend) { | ||
return { | ||
@@ -546,5 +402,2 @@ getLegend() { | ||
provideDocumentRangeSemanticTokens: (model, range, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -577,26 +430,2 @@ const result = yield provider.provideDocumentRangeSemanticTokens({ | ||
} | ||
matchLanguage(selector) { | ||
const languages = new Set(); | ||
if (Array.isArray(selector)) { | ||
for (const filter of selector) { | ||
languages.add(this.matchLanguageByFilter(filter)); | ||
} | ||
} | ||
else { | ||
languages.add(this.matchLanguageByFilter(selector)); | ||
} | ||
if (languages.has('*')) { | ||
return new Set(['*']); | ||
} | ||
return languages; | ||
} | ||
matchLanguageByFilter(selector) { | ||
if (services_1.DocumentFilter.is(selector)) { | ||
if (!selector.language) { | ||
return '*'; | ||
} | ||
return selector.language; | ||
} | ||
return selector; | ||
} | ||
} | ||
@@ -603,0 +432,0 @@ exports.MonacoLanguages = MonacoLanguages; |
@@ -22,45 +22,43 @@ import type * as monaco from 'monaco-editor-core'; | ||
registerCompletionItemProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): Disposable; | ||
protected createCompletionProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): monaco.languages.CompletionItemProvider; | ||
protected createCompletionProvider(provider: CompletionItemProvider, ...triggerCharacters: string[]): monaco.languages.CompletionItemProvider; | ||
registerHoverProvider(selector: DocumentSelector, provider: HoverProvider): Disposable; | ||
protected createHoverProvider(selector: DocumentSelector, provider: HoverProvider): monaco.languages.HoverProvider; | ||
protected createHoverProvider(provider: HoverProvider): monaco.languages.HoverProvider; | ||
registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): Disposable; | ||
protected createSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): monaco.languages.SignatureHelpProvider; | ||
protected createSignatureHelpProvider(provider: SignatureHelpProvider, ...triggerCharacters: string[]): monaco.languages.SignatureHelpProvider; | ||
registerDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): Disposable; | ||
protected createDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): monaco.languages.DefinitionProvider; | ||
protected createDefinitionProvider(provider: DefinitionProvider): monaco.languages.DefinitionProvider; | ||
registerReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): Disposable; | ||
protected createReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): monaco.languages.ReferenceProvider; | ||
protected createReferenceProvider(provider: ReferenceProvider): monaco.languages.ReferenceProvider; | ||
registerDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): Disposable; | ||
protected createDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): monaco.languages.DocumentHighlightProvider; | ||
protected createDocumentHighlightProvider(provider: DocumentHighlightProvider): monaco.languages.DocumentHighlightProvider; | ||
registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider): Disposable; | ||
protected createDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider): monaco.languages.DocumentSymbolProvider; | ||
protected createDocumentSymbolProvider(provider: DocumentSymbolProvider): monaco.languages.DocumentSymbolProvider; | ||
registerCodeActionsProvider(selector: DocumentSelector, provider: CodeActionProvider): Disposable; | ||
protected createCodeActionProvider(selector: DocumentSelector, provider: CodeActionProvider): monaco.languages.CodeActionProvider; | ||
protected createCodeActionProvider(provider: CodeActionProvider): monaco.languages.CodeActionProvider; | ||
registerCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): Disposable; | ||
protected createCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): monaco.languages.CodeLensProvider; | ||
protected createCodeLensProvider(provider: CodeLensProvider): monaco.languages.CodeLensProvider; | ||
registerDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): Disposable; | ||
protected createDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): monaco.languages.DocumentFormattingEditProvider; | ||
protected createDocumentFormattingEditProvider(provider: DocumentFormattingEditProvider): monaco.languages.DocumentFormattingEditProvider; | ||
registerDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): Disposable; | ||
createDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): monaco.languages.DocumentRangeFormattingEditProvider; | ||
createDocumentRangeFormattingEditProvider(provider: DocumentRangeFormattingEditProvider): monaco.languages.DocumentRangeFormattingEditProvider; | ||
registerOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): Disposable; | ||
protected createOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): monaco.languages.OnTypeFormattingEditProvider; | ||
protected createOnTypeFormattingEditProvider(provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): monaco.languages.OnTypeFormattingEditProvider; | ||
registerRenameProvider(selector: DocumentSelector, provider: RenameProvider): Disposable; | ||
protected createRenameProvider(selector: DocumentSelector, provider: RenameProvider): monaco.languages.RenameProvider; | ||
protected createRenameProvider(provider: RenameProvider): monaco.languages.RenameProvider; | ||
registerDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): Disposable; | ||
protected createDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): monaco.languages.LinkProvider; | ||
protected createDocumentLinkProvider(provider: DocumentLinkProvider): monaco.languages.LinkProvider; | ||
registerImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): Disposable; | ||
protected createImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): monaco.languages.ImplementationProvider; | ||
protected createImplementationProvider(provider: ImplementationProvider): monaco.languages.ImplementationProvider; | ||
registerTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): Disposable; | ||
protected createTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): monaco.languages.TypeDefinitionProvider; | ||
protected createTypeDefinitionProvider(provider: TypeDefinitionProvider): monaco.languages.TypeDefinitionProvider; | ||
registerColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): Disposable; | ||
protected createDocumentColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): monaco.languages.DocumentColorProvider; | ||
protected createDocumentColorProvider(provider: DocumentColorProvider): monaco.languages.DocumentColorProvider; | ||
registerFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): Disposable; | ||
protected createFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): monaco.languages.FoldingRangeProvider; | ||
protected createFoldingRangeProvider(provider: FoldingRangeProvider): monaco.languages.FoldingRangeProvider; | ||
registerDocumentSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): Disposable; | ||
protected createSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentSemanticTokensProvider; | ||
protected createSemanticTokensProvider(provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentSemanticTokensProvider; | ||
registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable; | ||
protected createRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentRangeSemanticTokensProvider; | ||
protected createRangeSemanticTokensProvider(provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentRangeSemanticTokensProvider; | ||
protected matchModel(selector: string | DocumentFilter | DocumentSelector, model: MonacoModelIdentifier): boolean; | ||
protected matchLanguage(selector: string | DocumentFilter | DocumentSelector): Set<string>; | ||
protected matchLanguageByFilter(selector: string | DocumentFilter): string; | ||
} | ||
//# sourceMappingURL=monaco-languages.d.ts.map |
@@ -16,3 +16,2 @@ "use strict"; | ||
const monaco_diagnostic_collection_1 = require("./monaco-diagnostic-collection"); | ||
const disposable_1 = require("./disposable"); | ||
var MonacoModelIdentifier; | ||
@@ -56,17 +55,9 @@ (function (MonacoModelIdentifier) { | ||
registerCompletionItemProvider(selector, provider, ...triggerCharacters) { | ||
const completionProvider = this.createCompletionProvider(selector, provider, ...triggerCharacters); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCompletionItemProvider(language, completionProvider)); | ||
} | ||
; | ||
return providers; | ||
const completionProvider = this.createCompletionProvider(provider, ...triggerCharacters); | ||
return this._monaco.languages.registerCompletionItemProvider(selector, completionProvider); | ||
} | ||
createCompletionProvider(selector, provider, ...triggerCharacters) { | ||
createCompletionProvider(provider, ...triggerCharacters) { | ||
return { | ||
triggerCharacters, | ||
provideCompletionItems: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const wordUntil = model.getWordUntilPosition(position); | ||
@@ -90,15 +81,8 @@ const defaultRange = new this._monaco.Range(position.lineNumber, wordUntil.startColumn, position.lineNumber, wordUntil.endColumn); | ||
registerHoverProvider(selector, provider) { | ||
const hoverProvider = this.createHoverProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerHoverProvider(language, hoverProvider)); | ||
} | ||
return providers; | ||
const hoverProvider = this.createHoverProvider(provider); | ||
return this._monaco.languages.registerHoverProvider(selector, hoverProvider); | ||
} | ||
createHoverProvider(selector, provider) { | ||
createHoverProvider(provider) { | ||
return { | ||
provideHover: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -111,10 +95,6 @@ const hover = yield provider.provideHover(params, token); | ||
registerSignatureHelpProvider(selector, provider, ...triggerCharacters) { | ||
const signatureHelpProvider = this.createSignatureHelpProvider(selector, provider, ...triggerCharacters); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerSignatureHelpProvider(language, signatureHelpProvider)); | ||
} | ||
return providers; | ||
const signatureHelpProvider = this.createSignatureHelpProvider(provider, ...triggerCharacters); | ||
return this._monaco.languages.registerSignatureHelpProvider(selector, signatureHelpProvider); | ||
} | ||
createSignatureHelpProvider(selector, provider, ...triggerCharacters) { | ||
createSignatureHelpProvider(provider, ...triggerCharacters) { | ||
const signatureHelpTriggerCharacters = [...(provider.triggerCharacters || triggerCharacters || [])]; | ||
@@ -125,5 +105,2 @@ return { | ||
provideSignatureHelp: (model, position, token, context) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -136,15 +113,8 @@ const signatureHelp = yield provider.provideSignatureHelp(params, token, this.m2p.asSignatureHelpContext(context)); | ||
registerDefinitionProvider(selector, provider) { | ||
const definitionProvider = this.createDefinitionProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDefinitionProvider(language, definitionProvider)); | ||
} | ||
return providers; | ||
const definitionProvider = this.createDefinitionProvider(provider); | ||
return this._monaco.languages.registerDefinitionProvider(selector, definitionProvider); | ||
} | ||
createDefinitionProvider(selector, provider) { | ||
createDefinitionProvider(provider) { | ||
return { | ||
provideDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -157,15 +127,8 @@ const result = yield provider.provideDefinition(params, token); | ||
registerReferenceProvider(selector, provider) { | ||
const referenceProvider = this.createReferenceProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerReferenceProvider(language, referenceProvider)); | ||
} | ||
return providers; | ||
const referenceProvider = this.createReferenceProvider(provider); | ||
return this._monaco.languages.registerReferenceProvider(selector, referenceProvider); | ||
} | ||
createReferenceProvider(selector, provider) { | ||
createReferenceProvider(provider) { | ||
return { | ||
provideReferences: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asReferenceParams(model, position, context); | ||
@@ -178,15 +141,8 @@ const result = yield provider.provideReferences(params, token); | ||
registerDocumentHighlightProvider(selector, provider) { | ||
const documentHighlightProvider = this.createDocumentHighlightProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentHighlightProvider(language, documentHighlightProvider)); | ||
} | ||
return providers; | ||
const documentHighlightProvider = this.createDocumentHighlightProvider(provider); | ||
return this._monaco.languages.registerDocumentHighlightProvider(selector, documentHighlightProvider); | ||
} | ||
createDocumentHighlightProvider(selector, provider) { | ||
createDocumentHighlightProvider(provider) { | ||
return { | ||
provideDocumentHighlights: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -199,15 +155,8 @@ const result = yield provider.provideDocumentHighlights(params, token); | ||
registerDocumentSymbolProvider(selector, provider) { | ||
const documentSymbolProvider = this.createDocumentSymbolProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentSymbolProvider(language, documentSymbolProvider)); | ||
} | ||
return providers; | ||
const documentSymbolProvider = this.createDocumentSymbolProvider(provider); | ||
return this._monaco.languages.registerDocumentSymbolProvider(selector, documentSymbolProvider); | ||
} | ||
createDocumentSymbolProvider(selector, provider) { | ||
createDocumentSymbolProvider(provider) { | ||
return { | ||
provideDocumentSymbols: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentSymbolParams(model); | ||
@@ -220,15 +169,8 @@ const result = yield provider.provideDocumentSymbols(params, token); | ||
registerCodeActionsProvider(selector, provider) { | ||
const codeActionProvider = this.createCodeActionProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCodeActionProvider(language, codeActionProvider)); | ||
} | ||
return providers; | ||
const codeActionProvider = this.createCodeActionProvider(provider); | ||
return this._monaco.languages.registerCodeActionProvider(selector, codeActionProvider); | ||
} | ||
createCodeActionProvider(selector, provider) { | ||
createCodeActionProvider(provider) { | ||
return { | ||
provideCodeActions: (model, range, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeActionParams(model, range, context); | ||
@@ -250,15 +192,8 @@ let result = yield provider.provideCodeActions(params, token); | ||
registerCodeLensProvider(selector, provider) { | ||
const codeLensProvider = this.createCodeLensProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCodeLensProvider(language, codeLensProvider)); | ||
} | ||
return providers; | ||
const codeLensProvider = this.createCodeLensProvider(provider); | ||
return this._monaco.languages.registerCodeLensProvider(selector, codeLensProvider); | ||
} | ||
createCodeLensProvider(selector, provider) { | ||
createCodeLensProvider(provider) { | ||
return { | ||
provideCodeLenses: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeLensParams(model); | ||
@@ -269,5 +204,2 @@ const result = yield provider.provideCodeLenses(params, token); | ||
resolveCodeLens: provider.resolveCodeLens ? (model, codeLens, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return codeLens; | ||
} | ||
const protocolCodeLens = this.m2p.asCodeLens(codeLens); | ||
@@ -284,15 +216,8 @@ const result = yield provider.resolveCodeLens(protocolCodeLens, token); | ||
registerDocumentFormattingEditProvider(selector, provider) { | ||
const documentFormattingEditProvider = this.createDocumentFormattingEditProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentFormattingEditProvider(language, documentFormattingEditProvider)); | ||
} | ||
return providers; | ||
const documentFormattingEditProvider = this.createDocumentFormattingEditProvider(provider); | ||
return this._monaco.languages.registerDocumentFormattingEditProvider(selector, documentFormattingEditProvider); | ||
} | ||
createDocumentFormattingEditProvider(selector, provider) { | ||
createDocumentFormattingEditProvider(provider) { | ||
return { | ||
provideDocumentFormattingEdits: (model, options, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentFormattingParams(model, options); | ||
@@ -305,15 +230,8 @@ const result = yield provider.provideDocumentFormattingEdits(params, token); | ||
registerDocumentRangeFormattingEditProvider(selector, provider) { | ||
const documentRangeFormattingEditProvider = this.createDocumentRangeFormattingEditProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentRangeFormattingEditProvider(language, documentRangeFormattingEditProvider)); | ||
} | ||
return providers; | ||
const documentRangeFormattingEditProvider = this.createDocumentRangeFormattingEditProvider(provider); | ||
return this._monaco.languages.registerDocumentRangeFormattingEditProvider(selector, documentRangeFormattingEditProvider); | ||
} | ||
createDocumentRangeFormattingEditProvider(selector, provider) { | ||
createDocumentRangeFormattingEditProvider(provider) { | ||
return { | ||
provideDocumentRangeFormattingEdits: (model, range, options, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentRangeFormattingParams(model, range, options); | ||
@@ -326,10 +244,6 @@ const result = yield provider.provideDocumentRangeFormattingEdits(params, token); | ||
registerOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter) { | ||
const onTypeFormattingEditProvider = this.createOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerOnTypeFormattingEditProvider(language, onTypeFormattingEditProvider)); | ||
} | ||
return providers; | ||
const onTypeFormattingEditProvider = this.createOnTypeFormattingEditProvider(provider, firstTriggerCharacter, ...moreTriggerCharacter); | ||
return this._monaco.languages.registerOnTypeFormattingEditProvider(selector, onTypeFormattingEditProvider); | ||
} | ||
createOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter) { | ||
createOnTypeFormattingEditProvider(provider, firstTriggerCharacter, ...moreTriggerCharacter) { | ||
const autoFormatTriggerCharacters = [firstTriggerCharacter].concat(moreTriggerCharacter); | ||
@@ -339,5 +253,2 @@ return { | ||
provideOnTypeFormattingEdits: (model, position, ch, options, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentOnTypeFormattingParams(model, position, ch, options); | ||
@@ -350,15 +261,8 @@ const result = yield provider.provideOnTypeFormattingEdits(params, token); | ||
registerRenameProvider(selector, provider) { | ||
const renameProvider = this.createRenameProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerRenameProvider(language, renameProvider)); | ||
} | ||
return providers; | ||
const renameProvider = this.createRenameProvider(provider); | ||
return this._monaco.languages.registerRenameProvider(selector, renameProvider); | ||
} | ||
createRenameProvider(selector, provider) { | ||
createRenameProvider(provider) { | ||
return { | ||
provideRenameEdits: (model, position, newName, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asRenameParams(model, position, newName); | ||
@@ -371,15 +275,8 @@ const result = yield provider.provideRenameEdits(params, token); | ||
registerDocumentLinkProvider(selector, provider) { | ||
const linkProvider = this.createDocumentLinkProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerLinkProvider(language, linkProvider)); | ||
} | ||
return providers; | ||
const linkProvider = this.createDocumentLinkProvider(provider); | ||
return this._monaco.languages.registerLinkProvider(selector, linkProvider); | ||
} | ||
createDocumentLinkProvider(selector, provider) { | ||
createDocumentLinkProvider(provider) { | ||
return { | ||
provideLinks: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentLinkParams(model); | ||
@@ -405,15 +302,8 @@ const result = yield provider.provideDocumentLinks(params, token); | ||
registerImplementationProvider(selector, provider) { | ||
const implementationProvider = this.createImplementationProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerImplementationProvider(language, implementationProvider)); | ||
} | ||
return providers; | ||
const implementationProvider = this.createImplementationProvider(provider); | ||
return this._monaco.languages.registerImplementationProvider(selector, implementationProvider); | ||
} | ||
createImplementationProvider(selector, provider) { | ||
createImplementationProvider(provider) { | ||
return { | ||
provideImplementation: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -426,15 +316,8 @@ const result = yield provider.provideImplementation(params, token); | ||
registerTypeDefinitionProvider(selector, provider) { | ||
const typeDefinitionProvider = this.createTypeDefinitionProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerTypeDefinitionProvider(language, typeDefinitionProvider)); | ||
} | ||
return providers; | ||
const typeDefinitionProvider = this.createTypeDefinitionProvider(provider); | ||
return this._monaco.languages.registerTypeDefinitionProvider(selector, typeDefinitionProvider); | ||
} | ||
createTypeDefinitionProvider(selector, provider) { | ||
createTypeDefinitionProvider(provider) { | ||
return { | ||
provideTypeDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -447,15 +330,8 @@ const result = yield provider.provideTypeDefinition(params, token); | ||
registerColorProvider(selector, provider) { | ||
const documentColorProvider = this.createDocumentColorProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerColorProvider(language, documentColorProvider)); | ||
} | ||
return providers; | ||
const documentColorProvider = this.createDocumentColorProvider(provider); | ||
return this._monaco.languages.registerColorProvider(selector, documentColorProvider); | ||
} | ||
createDocumentColorProvider(selector, provider) { | ||
createDocumentColorProvider(provider) { | ||
return { | ||
provideDocumentColors: (model, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -466,5 +342,2 @@ const result = yield provider.provideDocumentColors({ textDocument }, token); | ||
provideColorPresentations: (model, info, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -482,15 +355,8 @@ const range = this.m2p.asRange(info.range); | ||
registerFoldingRangeProvider(selector, provider) { | ||
const foldingRangeProvider = this.createFoldingRangeProvider(selector, provider); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerFoldingRangeProvider(language, foldingRangeProvider)); | ||
} | ||
return providers; | ||
const foldingRangeProvider = this.createFoldingRangeProvider(provider); | ||
return this._monaco.languages.registerFoldingRangeProvider(selector, foldingRangeProvider); | ||
} | ||
createFoldingRangeProvider(selector, provider) { | ||
createFoldingRangeProvider(provider) { | ||
return { | ||
provideFoldingRanges: (model, context, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -505,10 +371,6 @@ const result = yield provider.provideFoldingRanges({ | ||
registerDocumentSemanticTokensProvider(selector, provider, legend) { | ||
const semanticTokensProvider = this.createSemanticTokensProvider(selector, provider, legend); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentSemanticTokensProvider(language, semanticTokensProvider)); | ||
} | ||
return providers; | ||
const semanticTokensProvider = this.createSemanticTokensProvider(provider, legend); | ||
return this._monaco.languages.registerDocumentSemanticTokensProvider(selector, semanticTokensProvider); | ||
} | ||
createSemanticTokensProvider(selector, provider, legend) { | ||
createSemanticTokensProvider(provider, legend) { | ||
return { | ||
@@ -520,5 +382,2 @@ getLegend() { | ||
provideDocumentSemanticTokens: (model, lastResultId, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -535,10 +394,6 @@ const result = yield provider.provideDocumentSemanticTokens({ | ||
registerDocumentRangeSemanticTokensProvider(selector, provider, legend) { | ||
const rangeSemanticTokensProvider = this.createRangeSemanticTokensProvider(selector, provider, legend); | ||
const providers = new disposable_1.DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentRangeSemanticTokensProvider(language, rangeSemanticTokensProvider)); | ||
} | ||
return providers; | ||
const rangeSemanticTokensProvider = this.createRangeSemanticTokensProvider(provider, legend); | ||
return this._monaco.languages.registerDocumentRangeSemanticTokensProvider(selector, rangeSemanticTokensProvider); | ||
} | ||
createRangeSemanticTokensProvider(selector, provider, legend) { | ||
createRangeSemanticTokensProvider(provider, legend) { | ||
return { | ||
@@ -549,5 +404,2 @@ getLegend() { | ||
provideDocumentRangeSemanticTokens: (model, range, token) => __awaiter(this, void 0, void 0, function* () { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -580,28 +432,4 @@ const result = yield provider.provideDocumentRangeSemanticTokens({ | ||
} | ||
matchLanguage(selector) { | ||
const languages = new Set(); | ||
if (Array.isArray(selector)) { | ||
for (const filter of selector) { | ||
languages.add(this.matchLanguageByFilter(filter)); | ||
} | ||
} | ||
else { | ||
languages.add(this.matchLanguageByFilter(selector)); | ||
} | ||
if (languages.has('*')) { | ||
return new Set(['*']); | ||
} | ||
return languages; | ||
} | ||
matchLanguageByFilter(selector) { | ||
if (services_1.DocumentFilter.is(selector)) { | ||
if (!selector.language) { | ||
return '*'; | ||
} | ||
return selector.language; | ||
} | ||
return selector; | ||
} | ||
} | ||
exports.MonacoLanguages = MonacoLanguages; | ||
//# sourceMappingURL=monaco-languages.js.map |
{ | ||
"name": "@codingame/monaco-languageclient", | ||
"version": "0.17.3", | ||
"version": "0.17.4", | ||
"description": "Monaco Language client implementation", | ||
@@ -5,0 +5,0 @@ "author": "TypeFox GmbH (http://www.typefox.io)", |
@@ -19,3 +19,3 @@ /* -------------------------------------------------------------------------------------------- | ||
import { ProtocolToMonacoConverter, MonacoToProtocolConverter } from './monaco-converter'; | ||
import { DisposableCollection, Disposable } from './disposable'; | ||
import { Disposable } from './disposable'; | ||
@@ -67,17 +67,10 @@ export interface MonacoModelIdentifier { | ||
registerCompletionItemProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): Disposable { | ||
const completionProvider = this.createCompletionProvider(selector, provider, ...triggerCharacters); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCompletionItemProvider(language, completionProvider)) | ||
}; | ||
return providers; | ||
const completionProvider = this.createCompletionProvider(provider, ...triggerCharacters); | ||
return this._monaco.languages.registerCompletionItemProvider(selector as any, completionProvider); | ||
} | ||
protected createCompletionProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): monaco.languages.CompletionItemProvider { | ||
protected createCompletionProvider(provider: CompletionItemProvider, ...triggerCharacters: string[]): monaco.languages.CompletionItemProvider { | ||
return { | ||
triggerCharacters, | ||
provideCompletionItems: async (model, position, context, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const wordUntil = model.getWordUntilPosition(position); | ||
@@ -102,16 +95,9 @@ const defaultRange = new this._monaco.Range(position.lineNumber, wordUntil.startColumn, position.lineNumber, wordUntil.endColumn); | ||
registerHoverProvider(selector: DocumentSelector, provider: HoverProvider): Disposable { | ||
const hoverProvider = this.createHoverProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerHoverProvider(language, hoverProvider)); | ||
} | ||
return providers; | ||
const hoverProvider = this.createHoverProvider(provider); | ||
return this._monaco.languages.registerHoverProvider(selector as any, hoverProvider); | ||
} | ||
protected createHoverProvider(selector: DocumentSelector, provider: HoverProvider): monaco.languages.HoverProvider { | ||
protected createHoverProvider(provider: HoverProvider): monaco.languages.HoverProvider { | ||
return { | ||
provideHover: async (model, position, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -125,11 +111,7 @@ const hover = await provider.provideHover(params, token); | ||
registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): Disposable { | ||
const signatureHelpProvider = this.createSignatureHelpProvider(selector, provider, ...triggerCharacters); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerSignatureHelpProvider(language, signatureHelpProvider)); | ||
} | ||
return providers; | ||
const signatureHelpProvider = this.createSignatureHelpProvider(provider, ...triggerCharacters); | ||
return this._monaco.languages.registerSignatureHelpProvider(selector as any, signatureHelpProvider); | ||
} | ||
protected createSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): monaco.languages.SignatureHelpProvider { | ||
protected createSignatureHelpProvider(provider: SignatureHelpProvider, ...triggerCharacters: string[]): monaco.languages.SignatureHelpProvider { | ||
const signatureHelpTriggerCharacters = [...(provider.triggerCharacters || triggerCharacters || [])]; | ||
@@ -140,5 +122,2 @@ return { | ||
provideSignatureHelp: async (model, position, token, context) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -152,16 +131,9 @@ const signatureHelp = await provider.provideSignatureHelp(params, token, this.m2p.asSignatureHelpContext(context)) | ||
registerDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): Disposable { | ||
const definitionProvider = this.createDefinitionProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDefinitionProvider(language, definitionProvider)); | ||
} | ||
return providers; | ||
const definitionProvider = this.createDefinitionProvider(provider); | ||
return this._monaco.languages.registerDefinitionProvider(selector as any, definitionProvider); | ||
} | ||
protected createDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): monaco.languages.DefinitionProvider { | ||
protected createDefinitionProvider(provider: DefinitionProvider): monaco.languages.DefinitionProvider { | ||
return { | ||
provideDefinition: async (model, position, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -175,16 +147,9 @@ const result = await provider.provideDefinition(params, token); | ||
registerReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): Disposable { | ||
const referenceProvider = this.createReferenceProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerReferenceProvider(language, referenceProvider)); | ||
} | ||
return providers; | ||
const referenceProvider = this.createReferenceProvider(provider); | ||
return this._monaco.languages.registerReferenceProvider(selector as any, referenceProvider); | ||
} | ||
protected createReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): monaco.languages.ReferenceProvider { | ||
protected createReferenceProvider(provider: ReferenceProvider): monaco.languages.ReferenceProvider { | ||
return { | ||
provideReferences: async (model, position, context, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asReferenceParams(model, position, context); | ||
@@ -198,16 +163,9 @@ const result = await provider.provideReferences(params, token); | ||
registerDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): Disposable { | ||
const documentHighlightProvider = this.createDocumentHighlightProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentHighlightProvider(language, documentHighlightProvider)); | ||
} | ||
return providers; | ||
const documentHighlightProvider = this.createDocumentHighlightProvider(provider); | ||
return this._monaco.languages.registerDocumentHighlightProvider(selector as any, documentHighlightProvider); | ||
} | ||
protected createDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): monaco.languages.DocumentHighlightProvider { | ||
protected createDocumentHighlightProvider(provider: DocumentHighlightProvider): monaco.languages.DocumentHighlightProvider { | ||
return { | ||
provideDocumentHighlights: async (model, position, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -221,16 +179,9 @@ const result = await provider.provideDocumentHighlights(params, token); | ||
registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider): Disposable { | ||
const documentSymbolProvider = this.createDocumentSymbolProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentSymbolProvider(language, documentSymbolProvider)); | ||
} | ||
return providers; | ||
const documentSymbolProvider = this.createDocumentSymbolProvider(provider); | ||
return this._monaco.languages.registerDocumentSymbolProvider(selector as any, documentSymbolProvider); | ||
} | ||
protected createDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider): monaco.languages.DocumentSymbolProvider { | ||
protected createDocumentSymbolProvider(provider: DocumentSymbolProvider): monaco.languages.DocumentSymbolProvider { | ||
return { | ||
provideDocumentSymbols: async (model, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentSymbolParams(model); | ||
@@ -244,16 +195,9 @@ const result = await provider.provideDocumentSymbols(params, token); | ||
registerCodeActionsProvider(selector: DocumentSelector, provider: CodeActionProvider): Disposable { | ||
const codeActionProvider = this.createCodeActionProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCodeActionProvider(language, codeActionProvider)); | ||
} | ||
return providers; | ||
const codeActionProvider = this.createCodeActionProvider(provider); | ||
return this._monaco.languages.registerCodeActionProvider(selector as any, codeActionProvider); | ||
} | ||
protected createCodeActionProvider(selector: DocumentSelector, provider: CodeActionProvider): monaco.languages.CodeActionProvider { | ||
protected createCodeActionProvider(provider: CodeActionProvider): monaco.languages.CodeActionProvider { | ||
return { | ||
provideCodeActions: async (model, range, context, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeActionParams(model, range, context); | ||
@@ -276,16 +220,9 @@ let result = await provider.provideCodeActions(params, token); | ||
registerCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): Disposable { | ||
const codeLensProvider = this.createCodeLensProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerCodeLensProvider(language, codeLensProvider)); | ||
} | ||
return providers; | ||
const codeLensProvider = this.createCodeLensProvider(provider); | ||
return this._monaco.languages.registerCodeLensProvider(selector as any, codeLensProvider); | ||
} | ||
protected createCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): monaco.languages.CodeLensProvider { | ||
protected createCodeLensProvider(provider: CodeLensProvider): monaco.languages.CodeLensProvider { | ||
return { | ||
provideCodeLenses: async (model, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asCodeLensParams(model); | ||
@@ -296,5 +233,2 @@ const result = await provider.provideCodeLenses(params, token); | ||
resolveCodeLens: provider.resolveCodeLens ? async (model, codeLens, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return codeLens; | ||
} | ||
const protocolCodeLens = this.m2p.asCodeLens(codeLens); | ||
@@ -312,16 +246,9 @@ const result = await provider.resolveCodeLens!(protocolCodeLens, token); | ||
registerDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): Disposable { | ||
const documentFormattingEditProvider = this.createDocumentFormattingEditProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentFormattingEditProvider(language, documentFormattingEditProvider)); | ||
} | ||
return providers; | ||
const documentFormattingEditProvider = this.createDocumentFormattingEditProvider(provider); | ||
return this._monaco.languages.registerDocumentFormattingEditProvider(selector as any, documentFormattingEditProvider); | ||
} | ||
protected createDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): monaco.languages.DocumentFormattingEditProvider { | ||
protected createDocumentFormattingEditProvider(provider: DocumentFormattingEditProvider): monaco.languages.DocumentFormattingEditProvider { | ||
return { | ||
provideDocumentFormattingEdits: async (model, options, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentFormattingParams(model, options); | ||
@@ -335,16 +262,9 @@ const result = await provider.provideDocumentFormattingEdits(params, token); | ||
registerDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): Disposable { | ||
const documentRangeFormattingEditProvider = this.createDocumentRangeFormattingEditProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentRangeFormattingEditProvider(language, documentRangeFormattingEditProvider)); | ||
} | ||
return providers; | ||
const documentRangeFormattingEditProvider = this.createDocumentRangeFormattingEditProvider(provider); | ||
return this._monaco.languages.registerDocumentRangeFormattingEditProvider(selector as any, documentRangeFormattingEditProvider); | ||
} | ||
createDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): monaco.languages.DocumentRangeFormattingEditProvider { | ||
createDocumentRangeFormattingEditProvider(provider: DocumentRangeFormattingEditProvider): monaco.languages.DocumentRangeFormattingEditProvider { | ||
return { | ||
provideDocumentRangeFormattingEdits: async (model, range, options, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentRangeFormattingParams(model, range, options); | ||
@@ -358,11 +278,7 @@ const result = await provider.provideDocumentRangeFormattingEdits(params, token); | ||
registerOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): Disposable { | ||
const onTypeFormattingEditProvider = this.createOnTypeFormattingEditProvider(selector, provider, firstTriggerCharacter, ...moreTriggerCharacter); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerOnTypeFormattingEditProvider(language, onTypeFormattingEditProvider)); | ||
} | ||
return providers; | ||
const onTypeFormattingEditProvider = this.createOnTypeFormattingEditProvider(provider, firstTriggerCharacter, ...moreTriggerCharacter); | ||
return this._monaco.languages.registerOnTypeFormattingEditProvider(selector as any, onTypeFormattingEditProvider); | ||
} | ||
protected createOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): monaco.languages.OnTypeFormattingEditProvider { | ||
protected createOnTypeFormattingEditProvider(provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): monaco.languages.OnTypeFormattingEditProvider { | ||
const autoFormatTriggerCharacters = [firstTriggerCharacter].concat(moreTriggerCharacter) | ||
@@ -372,5 +288,2 @@ return { | ||
provideOnTypeFormattingEdits: async (model, position, ch, options, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentOnTypeFormattingParams(model, position, ch, options); | ||
@@ -384,16 +297,9 @@ const result = await provider.provideOnTypeFormattingEdits(params, token); | ||
registerRenameProvider(selector: DocumentSelector, provider: RenameProvider): Disposable { | ||
const renameProvider = this.createRenameProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerRenameProvider(language, renameProvider)); | ||
} | ||
return providers; | ||
const renameProvider = this.createRenameProvider(provider); | ||
return this._monaco.languages.registerRenameProvider(selector as any, renameProvider); | ||
} | ||
protected createRenameProvider(selector: DocumentSelector, provider: RenameProvider): monaco.languages.RenameProvider { | ||
protected createRenameProvider(provider: RenameProvider): monaco.languages.RenameProvider { | ||
return { | ||
provideRenameEdits: async (model, position, newName, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asRenameParams(model, position, newName); | ||
@@ -407,16 +313,9 @@ const result = await provider.provideRenameEdits(params, token); | ||
registerDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): Disposable { | ||
const linkProvider = this.createDocumentLinkProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerLinkProvider(language, linkProvider)); | ||
} | ||
return providers; | ||
const linkProvider = this.createDocumentLinkProvider(provider); | ||
return this._monaco.languages.registerLinkProvider(selector as any, linkProvider); | ||
} | ||
protected createDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): monaco.languages.LinkProvider { | ||
protected createDocumentLinkProvider(provider: DocumentLinkProvider): monaco.languages.LinkProvider { | ||
return { | ||
provideLinks: async (model, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asDocumentLinkParams(model); | ||
@@ -443,16 +342,9 @@ const result = await provider.provideDocumentLinks(params, token); | ||
registerImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): Disposable { | ||
const implementationProvider = this.createImplementationProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerImplementationProvider(language, implementationProvider)); | ||
} | ||
return providers; | ||
const implementationProvider = this.createImplementationProvider(provider); | ||
return this._monaco.languages.registerImplementationProvider(selector as any, implementationProvider); | ||
} | ||
protected createImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): monaco.languages.ImplementationProvider { | ||
protected createImplementationProvider(provider: ImplementationProvider): monaco.languages.ImplementationProvider { | ||
return { | ||
provideImplementation: async (model, position, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -466,16 +358,9 @@ const result = await provider.provideImplementation(params, token); | ||
registerTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): Disposable { | ||
const typeDefinitionProvider = this.createTypeDefinitionProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerTypeDefinitionProvider(language, typeDefinitionProvider)); | ||
} | ||
return providers; | ||
const typeDefinitionProvider = this.createTypeDefinitionProvider(provider); | ||
return this._monaco.languages.registerTypeDefinitionProvider(selector as any, typeDefinitionProvider); | ||
} | ||
protected createTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): monaco.languages.TypeDefinitionProvider { | ||
protected createTypeDefinitionProvider(provider: TypeDefinitionProvider): monaco.languages.TypeDefinitionProvider { | ||
return { | ||
provideTypeDefinition: async (model, position, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const params = this.m2p.asTextDocumentPositionParams(model, position); | ||
@@ -489,16 +374,9 @@ const result = await provider.provideTypeDefinition(params, token); | ||
registerColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): Disposable { | ||
const documentColorProvider = this.createDocumentColorProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerColorProvider(language, documentColorProvider)); | ||
} | ||
return providers; | ||
const documentColorProvider = this.createDocumentColorProvider(provider); | ||
return this._monaco.languages.registerColorProvider(selector as any, documentColorProvider); | ||
} | ||
protected createDocumentColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): monaco.languages.DocumentColorProvider { | ||
protected createDocumentColorProvider(provider: DocumentColorProvider): monaco.languages.DocumentColorProvider { | ||
return { | ||
provideDocumentColors: async (model, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -509,5 +387,2 @@ const result = await provider.provideDocumentColors({ textDocument }, token); | ||
provideColorPresentations: async (model, info, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -526,16 +401,9 @@ const range = this.m2p.asRange(info.range); | ||
registerFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): Disposable { | ||
const foldingRangeProvider = this.createFoldingRangeProvider(selector, provider); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerFoldingRangeProvider(language, foldingRangeProvider)); | ||
} | ||
return providers; | ||
const foldingRangeProvider = this.createFoldingRangeProvider(provider); | ||
return this._monaco.languages.registerFoldingRangeProvider(selector as any, foldingRangeProvider); | ||
} | ||
protected createFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): monaco.languages.FoldingRangeProvider { | ||
protected createFoldingRangeProvider(provider: FoldingRangeProvider): monaco.languages.FoldingRangeProvider { | ||
return { | ||
provideFoldingRanges: async (model, context, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -551,11 +419,7 @@ const result = await provider.provideFoldingRanges({ | ||
registerDocumentSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): Disposable { | ||
const semanticTokensProvider = this.createSemanticTokensProvider(selector, provider, legend); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentSemanticTokensProvider(language, semanticTokensProvider)); | ||
} | ||
return providers; | ||
const semanticTokensProvider = this.createSemanticTokensProvider(provider, legend); | ||
return this._monaco.languages.registerDocumentSemanticTokensProvider(selector as any, semanticTokensProvider); | ||
} | ||
protected createSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentSemanticTokensProvider { | ||
protected createSemanticTokensProvider(provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentSemanticTokensProvider { | ||
return { | ||
@@ -567,5 +431,2 @@ getLegend() { | ||
provideDocumentSemanticTokens: async (model, lastResultId, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -583,11 +444,7 @@ const result = await provider.provideDocumentSemanticTokens({ | ||
registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable { | ||
const rangeSemanticTokensProvider = this.createRangeSemanticTokensProvider(selector, provider, legend); | ||
const providers = new DisposableCollection(); | ||
for (const language of this.matchLanguage(selector)) { | ||
providers.push(this._monaco.languages.registerDocumentRangeSemanticTokensProvider(language, rangeSemanticTokensProvider)); | ||
} | ||
return providers; | ||
const rangeSemanticTokensProvider = this.createRangeSemanticTokensProvider(provider, legend); | ||
return this._monaco.languages.registerDocumentRangeSemanticTokensProvider(selector as any, rangeSemanticTokensProvider); | ||
} | ||
protected createRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentRangeSemanticTokensProvider { | ||
protected createRangeSemanticTokensProvider(provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): monaco.languages.DocumentRangeSemanticTokensProvider { | ||
return { | ||
@@ -598,5 +455,2 @@ getLegend() { | ||
provideDocumentRangeSemanticTokens: async (model, range, token) => { | ||
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) { | ||
return undefined; | ||
} | ||
const textDocument = this.m2p.asTextDocumentIdentifier(model); | ||
@@ -631,27 +485,2 @@ const result = await provider.provideDocumentRangeSemanticTokens({ | ||
protected matchLanguage(selector: string | DocumentFilter | DocumentSelector): Set<string> { | ||
const languages = new Set<string>(); | ||
if (Array.isArray(selector)) { | ||
for (const filter of selector) { | ||
languages.add(this.matchLanguageByFilter(filter)); | ||
} | ||
} else { | ||
languages.add(this.matchLanguageByFilter(selector)); | ||
} | ||
if (languages.has('*')) { | ||
return new Set(['*']) | ||
} | ||
return languages; | ||
} | ||
protected matchLanguageByFilter(selector: string | DocumentFilter): string { | ||
if (DocumentFilter.is(selector)) { | ||
if (!selector.language) { | ||
return '*'; | ||
} | ||
return selector.language; | ||
} | ||
return selector; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142
837936
10788