New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

monaco-languageclient

Package Overview
Dependencies
Maintainers
1
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monaco-languageclient - npm Package Compare versions

Comparing version 0.9.1-next.23 to 0.10.0

196

dist/amd/monaco-languages.js

@@ -72,8 +72,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

triggerCharacters,
provideCompletionItems: (model, position, context, token) => {
provideCompletionItems: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return {
incomplete: false,
suggestions: [],
};
return undefined;
}

@@ -83,12 +80,14 @@ const wordUntil = model.getWordUntilPosition(position);

const params = this.m2p.asCompletionParams(model, position, context);
return provider.provideCompletionItems(params, token).then(result => this.p2m.asCompletionResult(result, defaultRange));
},
resolveCompletionItem: provider.resolveCompletionItem ? (model, position, item, token) => {
const result = yield provider.provideCompletionItems(params, token);
return result && this.p2m.asCompletionResult(result, defaultRange);
}),
resolveCompletionItem: provider.resolveCompletionItem ? (model, position, item, token) => __awaiter(this, void 0, void 0, function* () {
const protocolItem = this.m2p.asCompletionItem(item);
return provider.resolveCompletionItem(protocolItem, token).then(resolvedItem => {
const resolvedItem = yield provider.resolveCompletionItem(protocolItem, token);
if (resolvedItem) {
const resolvedCompletionItem = this.p2m.asCompletionItem(resolvedItem, item.range);
Object.assign(item, resolvedCompletionItem);
return item;
});
} : undefined
}
return item;
}) : undefined
};

@@ -108,3 +107,3 @@ }

return {
provideHover: (model, position, token) => {
provideHover: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -114,4 +113,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideHover(params, token).then(hover => this.p2m.asHover(hover));
}
const hover = yield provider.provideHover(params, token);
return hover && this.p2m.asHover(hover);
})
};

@@ -129,3 +129,2 @@ }

}
// dummy
createSignatureHelpProvider(selector, provider, ...triggerCharacters) {

@@ -136,3 +135,3 @@ const signatureHelpTriggerCharacters = [...(provider.triggerCharacters || triggerCharacters || [])];

signatureHelpTriggerCharacters,
provideSignatureHelp: (model, position, token) => {
provideSignatureHelp: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -142,8 +141,9 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideSignatureHelp(params, token, {
const signatureHelp = yield provider.provideSignatureHelp(params, token, {
// TODO pass context from monaco after Monaco udpate
triggerKind: 1,
isRetrigger: false
}).then(signatureHelp => this.p2m.asSignatureHelp(signatureHelp));
}
});
return signatureHelp && this.p2m.asSignatureHelp(signatureHelp);
})
};

@@ -163,3 +163,3 @@ }

return {
provideDefinition: (model, position, token) => {
provideDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -169,4 +169,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideDefinition(params, token).then(result => this.p2m.asDefinitionResult(result));
}
const result = yield provider.provideDefinition(params, token);
return result && this.p2m.asDefinitionResult(result);
})
};

@@ -186,9 +187,10 @@ }

return {
provideReferences: (model, position, context, token) => {
provideReferences: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asReferenceParams(model, position, context);
return provider.provideReferences(params, token).then(result => this.p2m.asReferences(result));
}
const result = yield provider.provideReferences(params, token);
return result && this.p2m.asReferences(result);
})
};

@@ -208,9 +210,10 @@ }

return {
provideDocumentHighlights: (model, position, token) => {
provideDocumentHighlights: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideDocumentHighlights(params, token).then(result => this.p2m.asDocumentHighlights(result));
}
const result = yield provider.provideDocumentHighlights(params, token);
return result && this.p2m.asDocumentHighlights(result);
})
};

@@ -230,9 +233,10 @@ }

return {
provideDocumentSymbols: (model, token) => {
provideDocumentSymbols: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentSymbolParams(model);
return provider.provideDocumentSymbols(params, token).then(result => this.p2m.asDocumentSymbols(result));
}
const result = yield provider.provideDocumentSymbols(params, token);
return result && this.p2m.asDocumentSymbols(result);
})
};

@@ -254,7 +258,9 @@ }

if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
// FIXME: get rid of `!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved
return undefined;
}
const params = this.m2p.asCodeActionParams(model, range, context);
const result = yield provider.provideCodeActions(params, token);
return this.p2m.asCodeActions(result);
// FIXME: get rid of `|| undefined!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved
return result && this.p2m.asCodeActions(result) || undefined;
})

@@ -275,10 +281,11 @@ };

return {
provideCodeLenses: (model, token) => {
provideCodeLenses: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asCodeLensParams(model);
return provider.provideCodeLenses(params, token).then(result => this.p2m.asCodeLenses(result));
},
resolveCodeLens: provider.resolveCodeLens ? (model, codeLens, token) => {
const result = yield provider.provideCodeLenses(params, token);
return result && this.p2m.asCodeLenses(result);
}),
resolveCodeLens: provider.resolveCodeLens ? (model, codeLens, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -288,8 +295,9 @@ return codeLens;

const protocolCodeLens = this.m2p.asCodeLens(codeLens);
return provider.resolveCodeLens(protocolCodeLens, token).then(result => {
const result = yield provider.resolveCodeLens(protocolCodeLens, token);
if (result) {
const resolvedCodeLens = this.p2m.asCodeLens(result);
Object.assign(codeLens, resolvedCodeLens);
return codeLens;
});
} : ((m, codeLens, t) => codeLens)
}
return codeLens;
}) : ((_, codeLens) => codeLens)
};

@@ -309,9 +317,10 @@ }

return {
provideDocumentFormattingEdits: (model, options, token) => {
provideDocumentFormattingEdits: (model, options, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentFormattingParams(model, options);
return provider.provideDocumentFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result));
}
const result = yield provider.provideDocumentFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
})
};

@@ -331,9 +340,10 @@ }

return {
provideDocumentRangeFormattingEdits: (model, range, options, token) => {
provideDocumentRangeFormattingEdits: (model, range, options, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentRangeFormattingParams(model, range, options);
return provider.provideDocumentRangeFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result));
}
const result = yield provider.provideDocumentRangeFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
})
};

@@ -355,9 +365,10 @@ }

autoFormatTriggerCharacters,
provideOnTypeFormattingEdits: (model, position, ch, options, token) => {
provideOnTypeFormattingEdits: (model, position, ch, options, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentOnTypeFormattingParams(model, position, ch, options);
return provider.provideOnTypeFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result));
}
const result = yield provider.provideOnTypeFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
})
};

@@ -377,3 +388,3 @@ }

return {
provideRenameEdits: (model, position, newName, token) => {
provideRenameEdits: (model, position, newName, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -383,4 +394,5 @@ return undefined;

const params = this.m2p.asRenameParams(model, position, newName);
return provider.provideRenameEdits(params, token).then(result => this.p2m.asWorkspaceEdit(result));
}
const result = yield provider.provideRenameEdits(params, token);
return result && this.p2m.asWorkspaceEdit(result);
})
};

@@ -400,3 +412,3 @@ }

return {
provideLinks: (model, token) => {
provideLinks: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -406,5 +418,6 @@ return undefined;

const params = this.m2p.asDocumentLinkParams(model);
return provider.provideDocumentLinks(params, token).then(result => this.p2m.asDocumentLinks(result));
},
resolveLink: (link, token) => {
const result = yield provider.provideDocumentLinks(params, token);
return result && this.p2m.asDocumentLinks(result);
}),
resolveLink: (link, token) => __awaiter(this, void 0, void 0, function* () {
// resolve the link if the provider supports it

@@ -414,10 +427,10 @@ // and the link doesn't have a url set

const documentLink = this.m2p.asDocumentLink(link);
return provider.resolveDocumentLink(documentLink, token).then(result => {
const result = yield provider.resolveDocumentLink(documentLink, token);
if (result) {
const resolvedLink = this.p2m.asDocumentLink(result);
Object.assign(link, resolvedLink);
return link;
});
}
}
return link;
}
})
};

@@ -437,3 +450,3 @@ }

return {
provideImplementation: (model, position, token) => {
provideImplementation: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -443,4 +456,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideImplementation(params, token).then(result => this.p2m.asDefinitionResult(result));
}
const result = yield provider.provideImplementation(params, token);
return result && this.p2m.asDefinitionResult(result);
})
};

@@ -460,3 +474,3 @@ }

return {
provideTypeDefinition: (model, position, token) => {
provideTypeDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -466,4 +480,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideTypeDefinition(params, token).then(result => this.p2m.asDefinitionResult(result));
}
const result = yield provider.provideTypeDefinition(params, token);
return result && this.p2m.asDefinitionResult(result);
})
};

@@ -483,21 +498,23 @@ }

return {
provideDocumentColors: (model, token) => {
provideDocumentColors: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
return provider.provideDocumentColors({ textDocument }, token).then(result => this.p2m.asColorInformations(result));
},
provideColorPresentations: (model, info, token) => {
const result = yield provider.provideDocumentColors({ textDocument }, token);
return result && this.p2m.asColorInformations(result);
}),
provideColorPresentations: (model, info, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
const range = this.m2p.asRange(info.range);
return provider.provideColorPresentations({
const result = yield provider.provideColorPresentations({
textDocument,
color: info.color,
range
}, token).then(result => this.p2m.asColorPresentations(result));
}
}, token);
return result && this.p2m.asColorPresentations(result);
})
};

@@ -517,11 +534,12 @@ }

return {
provideFoldingRanges: (model, context, token) => {
provideFoldingRanges: (model, context, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
return provider.provideFoldingRanges({
const result = yield provider.provideFoldingRanges({
textDocument
}, token).then(result => this.p2m.asFoldingRanges(result));
}
}, token);
return result && this.p2m.asFoldingRanges(result);
})
};

@@ -528,0 +546,0 @@ }

@@ -15,3 +15,3 @@ import { DocumentSelector, MessageActionItem, MessageType, TextDocumentPositionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, WorkspaceClientCapabilities, DidChangeTextDocumentParams, Diagnostic, TextDocument, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, Location, DocumentHighlight, SymbolInformation, Command, CodeLens, TextEdit, WorkspaceEdit, DocumentLink, TextDocumentSaveReason, DocumentSymbolParams, WorkspaceSymbolParams, TextDocumentContentChangeEvent, CompletionParams, ColorInformation, ColorPresentation, DocumentColorParams, ColorPresentationParams, FoldingRange, FoldingRangeRequestParam, DocumentSymbol, CodeAction, Declaration, SelectionRangeParams, SelectionRange } from 'vscode-languageserver-protocol';

const get: Provider;
function install(services: Services): void;
function install(services: Services): Disposable;
}

@@ -22,8 +22,9 @@ export declare function isDocumentSelector(selector: any): selector is DocumentSelector;

}
export declare type ProviderResult<T> = T | undefined | null | PromiseLike<T | undefined | null>;
export interface CompletionItemProvider {
provideCompletionItems(params: CompletionParams, token: CancellationToken): PromiseLike<CompletionItem[] | CompletionList>;
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): PromiseLike<CompletionItem>;
provideCompletionItems(params: CompletionParams, token: CancellationToken): ProviderResult<CompletionItem[] | CompletionList>;
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
}
export interface HoverProvider {
provideHover(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Hover>;
provideHover(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Hover>;
}

@@ -44,41 +45,41 @@ export declare enum SignatureHelpTriggerKind {

readonly retriggerCharacters?: ReadonlyArray<string>;
provideSignatureHelp(params: TextDocumentPositionParams, token: CancellationToken, context: SignatureHelpContext): PromiseLike<SignatureHelp>;
provideSignatureHelp(params: TextDocumentPositionParams, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
}
export interface DefinitionProvider {
provideDefinition(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideDefinition(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface ReferenceProvider {
provideReferences(params: ReferenceParams, token: CancellationToken): PromiseLike<Location[]>;
provideReferences(params: ReferenceParams, token: CancellationToken): ProviderResult<Location[]>;
}
export interface DocumentHighlightProvider {
provideDocumentHighlights(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<DocumentHighlight[]>;
provideDocumentHighlights(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
}
export interface DocumentSymbolProvider {
provideDocumentSymbols(params: DocumentSymbolParams, token: CancellationToken): PromiseLike<SymbolInformation[] | DocumentSymbol[]>;
provideDocumentSymbols(params: DocumentSymbolParams, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}
export interface WorkspaceSymbolProvider {
provideWorkspaceSymbols(params: WorkspaceSymbolParams, token: CancellationToken): PromiseLike<SymbolInformation[]>;
provideWorkspaceSymbols(params: WorkspaceSymbolParams, token: CancellationToken): ProviderResult<SymbolInformation[]>;
}
export interface CodeActionProvider {
provideCodeActions(params: CodeActionParams, token: CancellationToken): PromiseLike<(Command | CodeAction)[]>;
provideCodeActions(params: CodeActionParams, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
}
export interface CodeLensProvider {
provideCodeLenses(params: CodeLensParams, token: CancellationToken): PromiseLike<CodeLens[]>;
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): PromiseLike<CodeLens>;
provideCodeLenses(params: CodeLensParams, token: CancellationToken): ProviderResult<CodeLens[]>;
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
}
export interface DocumentFormattingEditProvider {
provideDocumentFormattingEdits(params: DocumentFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideDocumentFormattingEdits(params: DocumentFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface DocumentRangeFormattingEditProvider {
provideDocumentRangeFormattingEdits(params: DocumentRangeFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideDocumentRangeFormattingEdits(params: DocumentRangeFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface OnTypeFormattingEditProvider {
provideOnTypeFormattingEdits(params: DocumentOnTypeFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideOnTypeFormattingEdits(params: DocumentOnTypeFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface RenameProvider {
provideRenameEdits(params: RenameParams, token: CancellationToken): PromiseLike<WorkspaceEdit>;
provideRenameEdits(params: RenameParams, token: CancellationToken): ProviderResult<WorkspaceEdit>;
}
export interface DocumentLinkProvider {
provideDocumentLinks(params: DocumentLinkParams, token: CancellationToken): PromiseLike<DocumentLink[]>;
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): PromiseLike<DocumentLink>;
provideDocumentLinks(params: DocumentLinkParams, token: CancellationToken): ProviderResult<DocumentLink[]>;
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;
}

@@ -93,19 +94,19 @@ export interface DocumentIdentifier {

export interface ImplementationProvider {
provideImplementation(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideImplementation(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface TypeDefinitionProvider {
provideTypeDefinition(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideTypeDefinition(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface DeclarationProvider {
provideDeclaration(params: TextDocumentPositionParams, token: CancellationToken): Thenable<Declaration>;
provideDeclaration(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Declaration>;
}
export interface DocumentColorProvider {
provideDocumentColors(params: DocumentColorParams, token: CancellationToken): PromiseLike<ColorInformation[]>;
provideColorPresentations(params: ColorPresentationParams, token: CancellationToken): PromiseLike<ColorPresentation[]>;
provideDocumentColors(params: DocumentColorParams, token: CancellationToken): ProviderResult<ColorInformation[]>;
provideColorPresentations(params: ColorPresentationParams, token: CancellationToken): ProviderResult<ColorPresentation[]>;
}
export interface FoldingRangeProvider {
provideFoldingRanges(params: FoldingRangeRequestParam, token: CancellationToken): PromiseLike<FoldingRange[]>;
provideFoldingRanges(params: FoldingRangeRequestParam, token: CancellationToken): ProviderResult<FoldingRange[]>;
}
export interface SelectionRangeProvider {
provideSelectionRanges(params: SelectionRangeParams, token: CancellationToken): Thenable<SelectionRange[]>;
provideSelectionRanges(params: SelectionRangeParams, token: CancellationToken): ProviderResult<SelectionRange[]>;
}

@@ -112,0 +113,0 @@ export interface Languages {

@@ -32,2 +32,3 @@ define(["require", "exports", "vscode-languageserver-protocol", "vscode-jsonrpc", "vscode-languageserver-protocol/lib/main"], function (require, exports, vscode_languageserver_protocol_1, vscode_jsonrpc_1, main_1) {

global[symbol] = services;
return vscode_jsonrpc_1.Disposable.create(() => global[symbol] = undefined);
}

@@ -34,0 +35,0 @@ Services.install = install;

@@ -566,3 +566,3 @@ /* --------------------------------------------------------------------------------------------

};
function showMessage(type, arg0, arg1) {
function showMessage(type, arg0, ...arg1) {
if (typeof arg0 !== "string") {

@@ -569,0 +569,0 @@ throw new Error('unexpected message: ' + JSON.stringify(arg0));

@@ -79,8 +79,5 @@ "use strict";

triggerCharacters,
provideCompletionItems: (model, position, context, token) => {
provideCompletionItems: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return {
incomplete: false,
suggestions: [],
};
return undefined;
}

@@ -90,12 +87,14 @@ const wordUntil = model.getWordUntilPosition(position);

const params = this.m2p.asCompletionParams(model, position, context);
return provider.provideCompletionItems(params, token).then(result => this.p2m.asCompletionResult(result, defaultRange));
},
resolveCompletionItem: provider.resolveCompletionItem ? (model, position, item, token) => {
const result = yield provider.provideCompletionItems(params, token);
return result && this.p2m.asCompletionResult(result, defaultRange);
}),
resolveCompletionItem: provider.resolveCompletionItem ? (model, position, item, token) => __awaiter(this, void 0, void 0, function* () {
const protocolItem = this.m2p.asCompletionItem(item);
return provider.resolveCompletionItem(protocolItem, token).then(resolvedItem => {
const resolvedItem = yield provider.resolveCompletionItem(protocolItem, token);
if (resolvedItem) {
const resolvedCompletionItem = this.p2m.asCompletionItem(resolvedItem, item.range);
Object.assign(item, resolvedCompletionItem);
return item;
});
} : undefined
}
return item;
}) : undefined
};

@@ -115,3 +114,3 @@ }

return {
provideHover: (model, position, token) => {
provideHover: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -121,4 +120,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideHover(params, token).then(hover => this.p2m.asHover(hover));
}
const hover = yield provider.provideHover(params, token);
return hover && this.p2m.asHover(hover);
})
};

@@ -136,3 +136,2 @@ }

}
// dummy
createSignatureHelpProvider(selector, provider, ...triggerCharacters) {

@@ -143,3 +142,3 @@ const signatureHelpTriggerCharacters = [...(provider.triggerCharacters || triggerCharacters || [])];

signatureHelpTriggerCharacters,
provideSignatureHelp: (model, position, token) => {
provideSignatureHelp: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -149,8 +148,9 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideSignatureHelp(params, token, {
const signatureHelp = yield provider.provideSignatureHelp(params, token, {
// TODO pass context from monaco after Monaco udpate
triggerKind: 1,
isRetrigger: false
}).then(signatureHelp => this.p2m.asSignatureHelp(signatureHelp));
}
});
return signatureHelp && this.p2m.asSignatureHelp(signatureHelp);
})
};

@@ -170,3 +170,3 @@ }

return {
provideDefinition: (model, position, token) => {
provideDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -176,4 +176,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideDefinition(params, token).then(result => this.p2m.asDefinitionResult(result));
}
const result = yield provider.provideDefinition(params, token);
return result && this.p2m.asDefinitionResult(result);
})
};

@@ -193,9 +194,10 @@ }

return {
provideReferences: (model, position, context, token) => {
provideReferences: (model, position, context, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asReferenceParams(model, position, context);
return provider.provideReferences(params, token).then(result => this.p2m.asReferences(result));
}
const result = yield provider.provideReferences(params, token);
return result && this.p2m.asReferences(result);
})
};

@@ -215,9 +217,10 @@ }

return {
provideDocumentHighlights: (model, position, token) => {
provideDocumentHighlights: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideDocumentHighlights(params, token).then(result => this.p2m.asDocumentHighlights(result));
}
const result = yield provider.provideDocumentHighlights(params, token);
return result && this.p2m.asDocumentHighlights(result);
})
};

@@ -237,9 +240,10 @@ }

return {
provideDocumentSymbols: (model, token) => {
provideDocumentSymbols: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentSymbolParams(model);
return provider.provideDocumentSymbols(params, token).then(result => this.p2m.asDocumentSymbols(result));
}
const result = yield provider.provideDocumentSymbols(params, token);
return result && this.p2m.asDocumentSymbols(result);
})
};

@@ -261,7 +265,9 @@ }

if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
// FIXME: get rid of `!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved
return undefined;
}
const params = this.m2p.asCodeActionParams(model, range, context);
const result = yield provider.provideCodeActions(params, token);
return this.p2m.asCodeActions(result);
// FIXME: get rid of `|| undefined!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved
return result && this.p2m.asCodeActions(result) || undefined;
})

@@ -282,10 +288,11 @@ };

return {
provideCodeLenses: (model, token) => {
provideCodeLenses: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asCodeLensParams(model);
return provider.provideCodeLenses(params, token).then(result => this.p2m.asCodeLenses(result));
},
resolveCodeLens: provider.resolveCodeLens ? (model, codeLens, token) => {
const result = yield provider.provideCodeLenses(params, token);
return result && this.p2m.asCodeLenses(result);
}),
resolveCodeLens: provider.resolveCodeLens ? (model, codeLens, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -295,8 +302,9 @@ return codeLens;

const protocolCodeLens = this.m2p.asCodeLens(codeLens);
return provider.resolveCodeLens(protocolCodeLens, token).then(result => {
const result = yield provider.resolveCodeLens(protocolCodeLens, token);
if (result) {
const resolvedCodeLens = this.p2m.asCodeLens(result);
Object.assign(codeLens, resolvedCodeLens);
return codeLens;
});
} : ((m, codeLens, t) => codeLens)
}
return codeLens;
}) : ((_, codeLens) => codeLens)
};

@@ -316,9 +324,10 @@ }

return {
provideDocumentFormattingEdits: (model, options, token) => {
provideDocumentFormattingEdits: (model, options, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentFormattingParams(model, options);
return provider.provideDocumentFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result));
}
const result = yield provider.provideDocumentFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
})
};

@@ -338,9 +347,10 @@ }

return {
provideDocumentRangeFormattingEdits: (model, range, options, token) => {
provideDocumentRangeFormattingEdits: (model, range, options, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentRangeFormattingParams(model, range, options);
return provider.provideDocumentRangeFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result));
}
const result = yield provider.provideDocumentRangeFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
})
};

@@ -362,9 +372,10 @@ }

autoFormatTriggerCharacters,
provideOnTypeFormattingEdits: (model, position, ch, options, token) => {
provideOnTypeFormattingEdits: (model, position, ch, options, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentOnTypeFormattingParams(model, position, ch, options);
return provider.provideOnTypeFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result));
}
const result = yield provider.provideOnTypeFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
})
};

@@ -384,3 +395,3 @@ }

return {
provideRenameEdits: (model, position, newName, token) => {
provideRenameEdits: (model, position, newName, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -390,4 +401,5 @@ return undefined;

const params = this.m2p.asRenameParams(model, position, newName);
return provider.provideRenameEdits(params, token).then(result => this.p2m.asWorkspaceEdit(result));
}
const result = yield provider.provideRenameEdits(params, token);
return result && this.p2m.asWorkspaceEdit(result);
})
};

@@ -407,3 +419,3 @@ }

return {
provideLinks: (model, token) => {
provideLinks: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -413,5 +425,6 @@ return undefined;

const params = this.m2p.asDocumentLinkParams(model);
return provider.provideDocumentLinks(params, token).then(result => this.p2m.asDocumentLinks(result));
},
resolveLink: (link, token) => {
const result = yield provider.provideDocumentLinks(params, token);
return result && this.p2m.asDocumentLinks(result);
}),
resolveLink: (link, token) => __awaiter(this, void 0, void 0, function* () {
// resolve the link if the provider supports it

@@ -421,10 +434,10 @@ // and the link doesn't have a url set

const documentLink = this.m2p.asDocumentLink(link);
return provider.resolveDocumentLink(documentLink, token).then(result => {
const result = yield provider.resolveDocumentLink(documentLink, token);
if (result) {
const resolvedLink = this.p2m.asDocumentLink(result);
Object.assign(link, resolvedLink);
return link;
});
}
}
return link;
}
})
};

@@ -444,3 +457,3 @@ }

return {
provideImplementation: (model, position, token) => {
provideImplementation: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -450,4 +463,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideImplementation(params, token).then(result => this.p2m.asDefinitionResult(result));
}
const result = yield provider.provideImplementation(params, token);
return result && this.p2m.asDefinitionResult(result);
})
};

@@ -467,3 +481,3 @@ }

return {
provideTypeDefinition: (model, position, token) => {
provideTypeDefinition: (model, position, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -473,4 +487,5 @@ return undefined;

const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideTypeDefinition(params, token).then(result => this.p2m.asDefinitionResult(result));
}
const result = yield provider.provideTypeDefinition(params, token);
return result && this.p2m.asDefinitionResult(result);
})
};

@@ -490,21 +505,23 @@ }

return {
provideDocumentColors: (model, token) => {
provideDocumentColors: (model, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
return provider.provideDocumentColors({ textDocument }, token).then(result => this.p2m.asColorInformations(result));
},
provideColorPresentations: (model, info, token) => {
const result = yield provider.provideDocumentColors({ textDocument }, token);
return result && this.p2m.asColorInformations(result);
}),
provideColorPresentations: (model, info, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
const range = this.m2p.asRange(info.range);
return provider.provideColorPresentations({
const result = yield provider.provideColorPresentations({
textDocument,
color: info.color,
range
}, token).then(result => this.p2m.asColorPresentations(result));
}
}, token);
return result && this.p2m.asColorPresentations(result);
})
};

@@ -524,11 +541,12 @@ }

return {
provideFoldingRanges: (model, context, token) => {
provideFoldingRanges: (model, context, token) => __awaiter(this, void 0, void 0, function* () {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
return provider.provideFoldingRanges({
const result = yield provider.provideFoldingRanges({
textDocument
}, token).then(result => this.p2m.asFoldingRanges(result));
}
}, token);
return result && this.p2m.asFoldingRanges(result);
})
};

@@ -535,0 +553,0 @@ }

@@ -15,3 +15,3 @@ import { DocumentSelector, MessageActionItem, MessageType, TextDocumentPositionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, WorkspaceClientCapabilities, DidChangeTextDocumentParams, Diagnostic, TextDocument, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, Location, DocumentHighlight, SymbolInformation, Command, CodeLens, TextEdit, WorkspaceEdit, DocumentLink, TextDocumentSaveReason, DocumentSymbolParams, WorkspaceSymbolParams, TextDocumentContentChangeEvent, CompletionParams, ColorInformation, ColorPresentation, DocumentColorParams, ColorPresentationParams, FoldingRange, FoldingRangeRequestParam, DocumentSymbol, CodeAction, Declaration, SelectionRangeParams, SelectionRange } from 'vscode-languageserver-protocol';

const get: Provider;
function install(services: Services): void;
function install(services: Services): Disposable;
}

@@ -22,8 +22,9 @@ export declare function isDocumentSelector(selector: any): selector is DocumentSelector;

}
export declare type ProviderResult<T> = T | undefined | null | PromiseLike<T | undefined | null>;
export interface CompletionItemProvider {
provideCompletionItems(params: CompletionParams, token: CancellationToken): PromiseLike<CompletionItem[] | CompletionList>;
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): PromiseLike<CompletionItem>;
provideCompletionItems(params: CompletionParams, token: CancellationToken): ProviderResult<CompletionItem[] | CompletionList>;
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
}
export interface HoverProvider {
provideHover(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Hover>;
provideHover(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Hover>;
}

@@ -44,41 +45,41 @@ export declare enum SignatureHelpTriggerKind {

readonly retriggerCharacters?: ReadonlyArray<string>;
provideSignatureHelp(params: TextDocumentPositionParams, token: CancellationToken, context: SignatureHelpContext): PromiseLike<SignatureHelp>;
provideSignatureHelp(params: TextDocumentPositionParams, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
}
export interface DefinitionProvider {
provideDefinition(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideDefinition(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface ReferenceProvider {
provideReferences(params: ReferenceParams, token: CancellationToken): PromiseLike<Location[]>;
provideReferences(params: ReferenceParams, token: CancellationToken): ProviderResult<Location[]>;
}
export interface DocumentHighlightProvider {
provideDocumentHighlights(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<DocumentHighlight[]>;
provideDocumentHighlights(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
}
export interface DocumentSymbolProvider {
provideDocumentSymbols(params: DocumentSymbolParams, token: CancellationToken): PromiseLike<SymbolInformation[] | DocumentSymbol[]>;
provideDocumentSymbols(params: DocumentSymbolParams, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}
export interface WorkspaceSymbolProvider {
provideWorkspaceSymbols(params: WorkspaceSymbolParams, token: CancellationToken): PromiseLike<SymbolInformation[]>;
provideWorkspaceSymbols(params: WorkspaceSymbolParams, token: CancellationToken): ProviderResult<SymbolInformation[]>;
}
export interface CodeActionProvider {
provideCodeActions(params: CodeActionParams, token: CancellationToken): PromiseLike<(Command | CodeAction)[]>;
provideCodeActions(params: CodeActionParams, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
}
export interface CodeLensProvider {
provideCodeLenses(params: CodeLensParams, token: CancellationToken): PromiseLike<CodeLens[]>;
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): PromiseLike<CodeLens>;
provideCodeLenses(params: CodeLensParams, token: CancellationToken): ProviderResult<CodeLens[]>;
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
}
export interface DocumentFormattingEditProvider {
provideDocumentFormattingEdits(params: DocumentFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideDocumentFormattingEdits(params: DocumentFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface DocumentRangeFormattingEditProvider {
provideDocumentRangeFormattingEdits(params: DocumentRangeFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideDocumentRangeFormattingEdits(params: DocumentRangeFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface OnTypeFormattingEditProvider {
provideOnTypeFormattingEdits(params: DocumentOnTypeFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideOnTypeFormattingEdits(params: DocumentOnTypeFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface RenameProvider {
provideRenameEdits(params: RenameParams, token: CancellationToken): PromiseLike<WorkspaceEdit>;
provideRenameEdits(params: RenameParams, token: CancellationToken): ProviderResult<WorkspaceEdit>;
}
export interface DocumentLinkProvider {
provideDocumentLinks(params: DocumentLinkParams, token: CancellationToken): PromiseLike<DocumentLink[]>;
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): PromiseLike<DocumentLink>;
provideDocumentLinks(params: DocumentLinkParams, token: CancellationToken): ProviderResult<DocumentLink[]>;
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;
}

@@ -93,19 +94,19 @@ export interface DocumentIdentifier {

export interface ImplementationProvider {
provideImplementation(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideImplementation(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface TypeDefinitionProvider {
provideTypeDefinition(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideTypeDefinition(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface DeclarationProvider {
provideDeclaration(params: TextDocumentPositionParams, token: CancellationToken): Thenable<Declaration>;
provideDeclaration(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Declaration>;
}
export interface DocumentColorProvider {
provideDocumentColors(params: DocumentColorParams, token: CancellationToken): PromiseLike<ColorInformation[]>;
provideColorPresentations(params: ColorPresentationParams, token: CancellationToken): PromiseLike<ColorPresentation[]>;
provideDocumentColors(params: DocumentColorParams, token: CancellationToken): ProviderResult<ColorInformation[]>;
provideColorPresentations(params: ColorPresentationParams, token: CancellationToken): ProviderResult<ColorPresentation[]>;
}
export interface FoldingRangeProvider {
provideFoldingRanges(params: FoldingRangeRequestParam, token: CancellationToken): PromiseLike<FoldingRange[]>;
provideFoldingRanges(params: FoldingRangeRequestParam, token: CancellationToken): ProviderResult<FoldingRange[]>;
}
export interface SelectionRangeProvider {
provideSelectionRanges(params: SelectionRangeParams, token: CancellationToken): Thenable<SelectionRange[]>;
provideSelectionRanges(params: SelectionRangeParams, token: CancellationToken): ProviderResult<SelectionRange[]>;
}

@@ -112,0 +113,0 @@ export interface Languages {

@@ -33,2 +33,3 @@ /* --------------------------------------------------------------------------------------------

global[symbol] = services;
return vscode_jsonrpc_1.Disposable.create(() => global[symbol] = undefined);
}

@@ -35,0 +36,0 @@ Services.install = install;

@@ -569,3 +569,3 @@ "use strict";

};
function showMessage(type, arg0, arg1) {
function showMessage(type, arg0, ...arg1) {
if (typeof arg0 !== "string") {

@@ -572,0 +572,0 @@ throw new Error('unexpected message: ' + JSON.stringify(arg0));

{
"name": "monaco-languageclient",
"version": "0.9.1-next.23+a59da88",
"version": "0.10.0",
"description": "Monaco Language client implementation",

@@ -39,3 +39,3 @@ "author": "TypeFox GmbH (http://www.typefox.io)",

],
"gitHead": "a59da88ee55a1408b0bf3a95d28d214ccacea211"
"gitHead": "b466d226917681688dddbdbee46678243eea2c71"
}

@@ -85,8 +85,5 @@ /* --------------------------------------------------------------------------------------------

triggerCharacters,
provideCompletionItems: (model, position, context, token) => {
provideCompletionItems: async (model, position, context, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return {
incomplete: false,
suggestions: [],
}
return undefined;
}

@@ -96,11 +93,13 @@ const wordUntil = model.getWordUntilPosition(position);

const params = this.m2p.asCompletionParams(model, position, context);
return provider.provideCompletionItems(params, token).then(result => this.p2m.asCompletionResult(result, defaultRange));
const result = await provider.provideCompletionItems(params, token);
return result && this.p2m.asCompletionResult(result, defaultRange);
},
resolveCompletionItem: provider.resolveCompletionItem ? (model, position, item, token) => {
resolveCompletionItem: provider.resolveCompletionItem ? async (model, position, item, token) => {
const protocolItem = this.m2p.asCompletionItem(item);
return provider.resolveCompletionItem!(protocolItem, token).then(resolvedItem => {
const resolvedItem = await provider.resolveCompletionItem!(protocolItem, token);
if (resolvedItem) {
const resolvedCompletionItem = this.p2m.asCompletionItem(resolvedItem, item.range);
Object.assign(item, resolvedCompletionItem);
return item;
});
}
return item;
} : undefined

@@ -123,8 +122,9 @@ };

return {
provideHover: (model, position, token) => {
provideHover: async (model, position, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return undefined!;
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideHover(params, token).then(hover => this.p2m.asHover(hover));
const hover = await provider.provideHover(params, token);
return hover && this.p2m.asHover(hover);
}

@@ -144,3 +144,3 @@ }

}
// dummy
protected createSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): monaco.languages.SignatureHelpProvider {

@@ -151,12 +151,13 @@ const signatureHelpTriggerCharacters = [...(provider.triggerCharacters || triggerCharacters || [])];

signatureHelpTriggerCharacters,
provideSignatureHelp: (model, position, token) => {
provideSignatureHelp: async (model, position, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return undefined!;
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideSignatureHelp(params, token, {
const signatureHelp = await provider.provideSignatureHelp(params, token, {
// TODO pass context from monaco after Monaco udpate
triggerKind: 1,
isRetrigger: false
}).then(signatureHelp => this.p2m.asSignatureHelp(signatureHelp));
});
return signatureHelp && this.p2m.asSignatureHelp(signatureHelp);
}

@@ -179,8 +180,9 @@ }

return {
provideDefinition: (model, position, token) => {
provideDefinition: async (model, position, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return undefined!;
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideDefinition(params, token).then(result => this.p2m.asDefinitionResult(result));
const result = await provider.provideDefinition(params, token);
return result && this.p2m.asDefinitionResult(result);
}

@@ -203,8 +205,9 @@ }

return {
provideReferences: (model, position, context, token) => {
provideReferences: async (model, position, context, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asReferenceParams(model, position, context);
return provider.provideReferences(params, token).then(result => this.p2m.asReferences(result));
const result = await provider.provideReferences(params, token);
return result && this.p2m.asReferences(result);
}

@@ -227,8 +230,9 @@ }

return {
provideDocumentHighlights: (model, position, token) => {
provideDocumentHighlights: async (model, position, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideDocumentHighlights(params, token).then(result => this.p2m.asDocumentHighlights(result));
const result = await provider.provideDocumentHighlights(params, token);
return result && this.p2m.asDocumentHighlights(result);
}

@@ -251,8 +255,9 @@ }

return {
provideDocumentSymbols: (model, token) => {
provideDocumentSymbols: async (model, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentSymbolParams(model);
return provider.provideDocumentSymbols(params, token).then(result => this.p2m.asDocumentSymbols(result))
const result = await provider.provideDocumentSymbols(params, token);
return result && this.p2m.asDocumentSymbols(result);
}

@@ -277,7 +282,9 @@ }

if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
// FIXME: get rid of `!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved
return undefined!;
}
const params = this.m2p.asCodeActionParams(model, range, context);
const result = await provider.provideCodeActions(params, token);
return this.p2m.asCodeActions(result);
// FIXME: get rid of `|| undefined!` when https://github.com/microsoft/monaco-editor/issues/1560 is resolved
return result && this.p2m.asCodeActions(result) || undefined!;
}

@@ -300,10 +307,11 @@ }

return {
provideCodeLenses: (model, token) => {
provideCodeLenses: async (model, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asCodeLensParams(model);
return provider.provideCodeLenses(params, token).then(result => this.p2m.asCodeLenses(result))
const result = await provider.provideCodeLenses(params, token);
return result && this.p2m.asCodeLenses(result);
},
resolveCodeLens: provider.resolveCodeLens ? (model, codeLens, token) => {
resolveCodeLens: provider.resolveCodeLens ? async (model, codeLens, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {

@@ -313,8 +321,9 @@ return codeLens;

const protocolCodeLens = this.m2p.asCodeLens(codeLens);
return provider.resolveCodeLens!(protocolCodeLens, token).then(result => {
const result = await provider.resolveCodeLens!(protocolCodeLens, token);
if (result) {
const resolvedCodeLens = this.p2m.asCodeLens(result);
Object.assign(codeLens, resolvedCodeLens);
return codeLens;
});
} : ((m, codeLens, t) => codeLens)
}
return codeLens;
} : ((_, codeLens) => codeLens)
}

@@ -336,8 +345,9 @@ }

return {
provideDocumentFormattingEdits: (model, options, token) => {
provideDocumentFormattingEdits: async (model, options, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentFormattingParams(model, options);
return provider.provideDocumentFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result))
const result = await provider.provideDocumentFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
}

@@ -360,8 +370,9 @@ }

return {
provideDocumentRangeFormattingEdits: (model, range, options, token) => {
provideDocumentRangeFormattingEdits: async (model, range, options, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentRangeFormattingParams(model, range, options);
return provider.provideDocumentRangeFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result))
const result = await provider.provideDocumentRangeFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
}

@@ -386,8 +397,9 @@ }

autoFormatTriggerCharacters,
provideOnTypeFormattingEdits: (model, position, ch, options, token) => {
provideOnTypeFormattingEdits: async (model, position, ch, options, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const params = this.m2p.asDocumentOnTypeFormattingParams(model, position, ch, options);
return provider.provideOnTypeFormattingEdits(params, token).then(result => this.p2m.asTextEdits(result))
const result = await provider.provideOnTypeFormattingEdits(params, token);
return result && this.p2m.asTextEdits(result);
}

@@ -410,8 +422,9 @@ }

return {
provideRenameEdits: (model, position, newName, token) => {
provideRenameEdits: async (model, position, newName, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return undefined!;
return undefined;
}
const params = this.m2p.asRenameParams(model, position, newName);
return provider.provideRenameEdits(params, token).then(result => this.p2m.asWorkspaceEdit(result))
const result = await provider.provideRenameEdits(params, token);
return result && this.p2m.asWorkspaceEdit(result);
}

@@ -434,11 +447,11 @@ }

return {
provideLinks: (model, token) => {
provideLinks: async (model, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return undefined!;
return undefined;
}
const params = this.m2p.asDocumentLinkParams(model);
return provider.provideDocumentLinks(params, token).then(result => this.p2m.asDocumentLinks(result));
const result = await provider.provideDocumentLinks(params, token);
return result && this.p2m.asDocumentLinks(result);
},
resolveLink: (link: monaco.languages.ILink, token) => {
resolveLink: async (link: monaco.languages.ILink, token) => {
// resolve the link if the provider supports it

@@ -448,7 +461,7 @@ // and the link doesn't have a url set

const documentLink = this.m2p.asDocumentLink(link);
return provider.resolveDocumentLink(documentLink, token).then(result => {
const result = await provider.resolveDocumentLink(documentLink, token);
if (result) {
const resolvedLink = this.p2m.asDocumentLink(result);
Object.assign(link, resolvedLink);
return link;
});
}
}

@@ -473,8 +486,9 @@ return link;

return {
provideImplementation: (model, position, token) => {
provideImplementation: async (model, position, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return undefined!;
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideImplementation(params, token).then(result => this.p2m.asDefinitionResult(result));
const result = await provider.provideImplementation(params, token);
return result && this.p2m.asDefinitionResult(result);
}

@@ -497,8 +511,9 @@ }

return {
provideTypeDefinition: (model, position, token) => {
provideTypeDefinition: async (model, position, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return undefined!;
return undefined;
}
const params = this.m2p.asTextDocumentPositionParams(model, position);
return provider.provideTypeDefinition(params, token).then(result => this.p2m.asDefinitionResult(result));
const result = await provider.provideTypeDefinition(params, token);
return result && this.p2m.asDefinitionResult(result);
}

@@ -521,20 +536,22 @@ }

return {
provideDocumentColors: (model, token) => {
provideDocumentColors: async (model, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
return provider.provideDocumentColors({ textDocument }, token).then(result => this.p2m.asColorInformations(result));
const result = await provider.provideDocumentColors({ textDocument }, token);
return result && this.p2m.asColorInformations(result);
},
provideColorPresentations: (model, info, token) => {
provideColorPresentations: async (model, info, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
const range = this.m2p.asRange(info.range);
return provider.provideColorPresentations({
const result = await provider.provideColorPresentations({
textDocument,
color: info.color,
range
}, token).then(result => this.p2m.asColorPresentations(result))
}, token);
return result && this.p2m.asColorPresentations(result);
}

@@ -557,10 +574,11 @@ }

return {
provideFoldingRanges: (model, context, token) => {
provideFoldingRanges: async (model, context, token) => {
if (!this.matchModel(selector, MonacoModelIdentifier.fromModel(model))) {
return [];
return undefined;
}
const textDocument = this.m2p.asTextDocumentIdentifier(model);
return provider.provideFoldingRanges({
const result = await provider.provideFoldingRanges({
textDocument
}, token).then(result => this.p2m.asFoldingRanges(result));
}, token);
return result && this.p2m.asFoldingRanges(result);
}

@@ -567,0 +585,0 @@ }

@@ -49,3 +49,3 @@ /* --------------------------------------------------------------------------------------------

}
export function install(services: Services): void {
export function install(services: Services): Disposable {
if (global[symbol]) {

@@ -55,2 +55,4 @@ console.error(new Error('Language Client services has been overridden'));

global[symbol] = services;
return Disposable.create(() => global[symbol] = undefined)
}

@@ -70,9 +72,11 @@ }

export type ProviderResult<T> = T | undefined | null | PromiseLike<T | undefined | null>;
export interface CompletionItemProvider {
provideCompletionItems(params: CompletionParams, token: CancellationToken): PromiseLike<CompletionItem[] | CompletionList>;
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): PromiseLike<CompletionItem>;
provideCompletionItems(params: CompletionParams, token: CancellationToken): ProviderResult<CompletionItem[] | CompletionList>;
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
}
export interface HoverProvider {
provideHover(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Hover>;
provideHover(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Hover>;
}

@@ -96,53 +100,53 @@

readonly retriggerCharacters?: ReadonlyArray<string>;
provideSignatureHelp(params: TextDocumentPositionParams, token: CancellationToken, context: SignatureHelpContext): PromiseLike<SignatureHelp>;
provideSignatureHelp(params: TextDocumentPositionParams, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
}
export interface DefinitionProvider {
provideDefinition(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideDefinition(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface ReferenceProvider {
provideReferences(params: ReferenceParams, token: CancellationToken): PromiseLike<Location[]>;
provideReferences(params: ReferenceParams, token: CancellationToken): ProviderResult<Location[]>;
}
export interface DocumentHighlightProvider {
provideDocumentHighlights(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<DocumentHighlight[]>;
provideDocumentHighlights(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
}
export interface DocumentSymbolProvider {
provideDocumentSymbols(params: DocumentSymbolParams, token: CancellationToken): PromiseLike<SymbolInformation[] | DocumentSymbol[]>;
provideDocumentSymbols(params: DocumentSymbolParams, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
}
export interface WorkspaceSymbolProvider {
provideWorkspaceSymbols(params: WorkspaceSymbolParams, token: CancellationToken): PromiseLike<SymbolInformation[]>;
provideWorkspaceSymbols(params: WorkspaceSymbolParams, token: CancellationToken): ProviderResult<SymbolInformation[]>;
}
export interface CodeActionProvider {
provideCodeActions(params: CodeActionParams, token: CancellationToken): PromiseLike<(Command | CodeAction)[]>;
provideCodeActions(params: CodeActionParams, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
}
export interface CodeLensProvider {
provideCodeLenses(params: CodeLensParams, token: CancellationToken): PromiseLike<CodeLens[]>;
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): PromiseLike<CodeLens>;
provideCodeLenses(params: CodeLensParams, token: CancellationToken): ProviderResult<CodeLens[]>;
resolveCodeLens?(codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
}
export interface DocumentFormattingEditProvider {
provideDocumentFormattingEdits(params: DocumentFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideDocumentFormattingEdits(params: DocumentFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface DocumentRangeFormattingEditProvider {
provideDocumentRangeFormattingEdits(params: DocumentRangeFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideDocumentRangeFormattingEdits(params: DocumentRangeFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface OnTypeFormattingEditProvider {
provideOnTypeFormattingEdits(params: DocumentOnTypeFormattingParams, token: CancellationToken): PromiseLike<TextEdit[]>;
provideOnTypeFormattingEdits(params: DocumentOnTypeFormattingParams, token: CancellationToken): ProviderResult<TextEdit[]>;
}
export interface RenameProvider {
provideRenameEdits(params: RenameParams, token: CancellationToken): PromiseLike<WorkspaceEdit>;
provideRenameEdits(params: RenameParams, token: CancellationToken): ProviderResult<WorkspaceEdit>;
}
export interface DocumentLinkProvider {
provideDocumentLinks(params: DocumentLinkParams, token: CancellationToken): PromiseLike<DocumentLink[]>;
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): PromiseLike<DocumentLink>;
provideDocumentLinks(params: DocumentLinkParams, token: CancellationToken): ProviderResult<DocumentLink[]>;
resolveDocumentLink?(link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;
}

@@ -161,24 +165,24 @@

export interface ImplementationProvider {
provideImplementation(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideImplementation(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface TypeDefinitionProvider {
provideTypeDefinition(params: TextDocumentPositionParams, token: CancellationToken): PromiseLike<Definition>;
provideTypeDefinition(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Definition>;
}
export interface DeclarationProvider {
provideDeclaration(params: TextDocumentPositionParams, token: CancellationToken): Thenable<Declaration>;
provideDeclaration(params: TextDocumentPositionParams, token: CancellationToken): ProviderResult<Declaration>;
}
export interface DocumentColorProvider {
provideDocumentColors(params: DocumentColorParams, token: CancellationToken): PromiseLike<ColorInformation[]>;
provideColorPresentations(params: ColorPresentationParams, token: CancellationToken): PromiseLike<ColorPresentation[]>;
provideDocumentColors(params: DocumentColorParams, token: CancellationToken): ProviderResult<ColorInformation[]>;
provideColorPresentations(params: ColorPresentationParams, token: CancellationToken): ProviderResult<ColorPresentation[]>;
}
export interface FoldingRangeProvider {
provideFoldingRanges(params: FoldingRangeRequestParam, token: CancellationToken): PromiseLike<FoldingRange[]>;
provideFoldingRanges(params: FoldingRangeRequestParam, token: CancellationToken): ProviderResult<FoldingRange[]>;
}
export interface SelectionRangeProvider {
provideSelectionRanges(params: SelectionRangeParams, token: CancellationToken): Thenable<SelectionRange[]>;
provideSelectionRanges(params: SelectionRangeParams, token: CancellationToken): ProviderResult<SelectionRange[]>;
}

@@ -185,0 +189,0 @@

@@ -556,3 +556,3 @@ /* --------------------------------------------------------------------------------------------

};
function showMessage(type: MessageType, arg0: any, arg1: any): Thenable<any> {
function showMessage(type: MessageType, arg0: any, ...arg1: any[]): Thenable<any> {
if (typeof arg0 !== "string") {

@@ -559,0 +559,0 @@ throw new Error('unexpected message: ' + JSON.stringify(arg0));

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc