Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscode-languageclient

Package Overview
Dependencies
Maintainers
7
Versions
302
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-languageclient - npm Package Compare versions

Comparing version 9.0.2-next.1 to 10.0.0-next.1

1

lib/common/codeAction.d.ts

@@ -19,2 +19,3 @@ import { Disposable, TextDocument, ProviderResult, Range as VRange, Command as VCommand, CodeAction as VCodeAction, CodeActionContext as VCodeActionContext, CodeActionProvider } from 'vscode';

protected registerLanguageProvider(options: CodeActionRegistrationOptions): [Disposable, CodeActionProvider];
private getMetadata;
}

20

lib/common/codeAction.js

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

cap.resolveSupport = {
properties: ['edit']
properties: ['edit', 'command']
};

@@ -35,5 +35,7 @@ cap.codeActionLiteralSupport = {

vscode_languageserver_protocol_1.CodeActionKind.RefactorInline,
vscode_languageserver_protocol_1.CodeActionKind.RefactorMove,
vscode_languageserver_protocol_1.CodeActionKind.RefactorRewrite,
vscode_languageserver_protocol_1.CodeActionKind.Source,
vscode_languageserver_protocol_1.CodeActionKind.SourceOrganizeImports
vscode_languageserver_protocol_1.CodeActionKind.SourceOrganizeImports,
vscode_languageserver_protocol_1.CodeActionKind.Notebook
]

@@ -43,2 +45,3 @@ }

cap.honorsChangeAnnotations = true;
cap.documentationSupport = true;
}

@@ -97,7 +100,14 @@ initialize(capabilities, documentSelector) {

};
return [vscode_1.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(selector), provider, (options.codeActionKinds
? { providedCodeActionKinds: this._client.protocol2CodeConverter.asCodeActionKinds(options.codeActionKinds) }
: undefined)), provider];
return [vscode_1.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(selector), provider, this.getMetadata(options)), provider];
}
getMetadata(options) {
if (options.codeActionKinds === undefined && options.documentation === undefined) {
return undefined;
}
return {
providedCodeActionKinds: this._client.protocol2CodeConverter.asCodeActionKinds(options.codeActionKinds),
documentation: this._client.protocol2CodeConverter.asCodeActionDocumentations(options.documentation)
};
}
}
exports.CodeActionFeature = CodeActionFeature;

@@ -74,2 +74,3 @@ import * as code from 'vscode';

asInlineCompletionParams(document: code.TextDocument, position: code.Position, context: code.InlineCompletionContext): proto.InlineCompletionParams;
asInlineCompletionContext(context: code.InlineCompletionContext): proto.InlineCompletionContext;
}

@@ -76,0 +77,0 @@ export interface URIConverter {

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

function asSaveTextDocumentParams(textDocument, includeContent = false) {
let result = {
const result = {
textDocument: asTextDocumentIdentifier(textDocument)

@@ -305,5 +305,5 @@ };

}
let result = [];
for (let tag of tags) {
let converted = asDiagnosticTag(tag);
const result = [];
for (const tag of tags) {
const converted = asDiagnosticTag(tag);
if (converted !== undefined) {

@@ -412,3 +412,3 @@ result.push(converted);

const result = [];
for (let tag of tags) {
for (const tag of tags) {
const converted = asCompletionItemTag(tag);

@@ -439,7 +439,7 @@ if (converted !== undefined) {

}
let result = { label: label };
const result = { label: label };
if (labelDetails !== undefined) {
result.labelDetails = labelDetails;
}
let protocolItem = item instanceof protocolCompletionItem_1.default ? item : undefined;
const protocolItem = item instanceof protocolCompletionItem_1.default ? item : undefined;
if (item.detail) {

@@ -570,3 +570,3 @@ result.detail = item.detail;

async function asCodeAction(item, token) {
let result = proto.CodeAction.create(item.title);
const result = proto.CodeAction.create(item.title);
if (item instanceof protocolCodeAction_1.default && item.data !== undefined) {

@@ -596,3 +596,3 @@ result.data = item.data;

function asCodeActionSync(item) {
let result = proto.CodeAction.create(item.title);
const result = proto.CodeAction.create(item.title);
if (item instanceof protocolCodeAction_1.default && item.data !== undefined) {

@@ -658,13 +658,35 @@ result.data = item.data;

function asInlineValueContext(context) {
if (context === undefined || context === null) {
return context;
}
return proto.InlineValueContext.create(context.frameId, asRange(context.stoppedLocation));
}
function asInlineCompletionParams(document, position, context) {
return { context: proto.InlineCompletionContext.create(context.triggerKind, context.selectedCompletionInfo),
textDocument: asTextDocumentIdentifier(document), position: asPosition(position) };
return {
textDocument: asTextDocumentIdentifier(document), position: asPosition(position),
context: asInlineCompletionContext(context)
};
}
function asInlineCompletionContext(context) {
return {
triggerKind: asInlineCompletionTriggerKind(context.triggerKind),
selectedCompletionInfo: asSelectedCompletionInfo(context.selectedCompletionInfo)
};
}
function asInlineCompletionTriggerKind(kind) {
switch (kind) {
case code.InlineCompletionTriggerKind.Invoke:
return proto.InlineCompletionTriggerKind.Invoked;
case code.InlineCompletionTriggerKind.Automatic:
return proto.InlineCompletionTriggerKind.Automatic;
}
}
function asSelectedCompletionInfo(info) {
if (info === undefined || info === null) {
return undefined;
}
return { range: asRange(info.range), text: info.text };
}
function asCommand(item) {
let result = proto.Command.create(item.title, item.command);
const result = proto.Command.create(item.title, item.command);
if (item.tooltip) {
result.tooltip = item.tooltip;
}
if (item.arguments) {

@@ -676,3 +698,3 @@ result.arguments = item.arguments;

function asCodeLens(item) {
let result = proto.CodeLens.create(asRange(item.range));
const result = proto.CodeLens.create(asRange(item.range));
if (item.command) {

@@ -712,3 +734,3 @@ result.command = asCommand(item.command);

function asDocumentLink(item) {
let result = proto.DocumentLink.create(asRange(item.range));
const result = proto.DocumentLink.create(asRange(item.range));
if (item.target) {

@@ -720,3 +742,3 @@ result.target = asUri(item.target);

}
let protocolItem = item instanceof protocolDocumentLink_1.default ? item : undefined;
const protocolItem = item instanceof protocolDocumentLink_1.default ? item : undefined;
if (protocolItem && protocolItem.data) {

@@ -883,5 +905,6 @@ result.data = protocolItem.data;

asWorkspaceSymbol,
asInlineCompletionParams
asInlineCompletionParams,
asInlineCompletionContext
};
}
exports.createConverter = createConverter;

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

initialize(capabilities, documentSelector) {
let [id, options] = this.getRegistration(documentSelector, capabilities.colorProvider);
const [id, options] = this.getRegistration(documentSelector, capabilities.colorProvider);
if (!id || !options) {

@@ -22,0 +22,0 @@ return;

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

fillClientCapabilities(capabilities) {
let completion = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'completion');
const completion = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'completion');
completion.dynamicRegistration = true;

@@ -48,0 +48,0 @@ completion.contextSupport = true;

@@ -28,8 +28,8 @@ "use strict";

initialize() {
let client = this._client;
const client = this._client;
client.onRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, (params, token) => {
let configuration = (params) => {
let result = [];
for (let item of params.items) {
let resource = item.scopeUri !== void 0 && item.scopeUri !== null ? this._client.protocol2CodeConverter.asUri(item.scopeUri) : undefined;
const configuration = (params) => {
const result = [];
for (const item of params.items) {
const resource = item.scopeUri !== void 0 && item.scopeUri !== null ? this._client.protocol2CodeConverter.asUri(item.scopeUri) : undefined;
result.push(this.getConfiguration(resource, item.section !== null ? item.section : undefined));

@@ -39,3 +39,3 @@ }

};
let middleware = client.middleware.workspace;
const middleware = client.middleware.workspace;
return middleware && middleware.configuration

@@ -49,3 +49,3 @@ ? middleware.configuration(params, token, configuration)

if (section) {
let index = section.lastIndexOf('.');
const index = section.lastIndexOf('.');
if (index === -1) {

@@ -55,3 +55,3 @@ result = toJSONObject(vscode_1.workspace.getConfiguration(undefined, resource).get(section));

else {
let config = vscode_1.workspace.getConfiguration(section.substr(0, index), resource);
const config = vscode_1.workspace.getConfiguration(section.substr(0, index), resource);
if (config) {

@@ -63,5 +63,5 @@ result = toJSONObject(config.get(section.substr(index + 1)));

else {
let config = vscode_1.workspace.getConfiguration(undefined, resource);
const config = vscode_1.workspace.getConfiguration(undefined, resource);
result = {};
for (let key of Object.keys(config)) {
for (const key of Object.keys(config)) {
if (config.has(key)) {

@@ -116,3 +116,3 @@ result[key] = toJSONObject(config.get(key));

this.isCleared = false;
let section = this._client.clientOptions.synchronize?.configurationSection;
const section = this._client.clientOptions.synchronize?.configurationSection;
if (section !== undefined) {

@@ -128,3 +128,3 @@ this.register({

register(data) {
let disposable = vscode_1.workspace.onDidChangeConfiguration((event) => {
const disposable = vscode_1.workspace.onDidChangeConfiguration((event) => {
this.onDidChangeConfiguration(data.registerOptions.section, event);

@@ -138,3 +138,3 @@ });

unregister(id) {
let disposable = this._listeners.get(id);
const disposable = this._listeners.get(id);
if (disposable) {

@@ -164,3 +164,3 @@ this._listeners.delete(id);

if (sections !== undefined && event !== undefined) {
let affected = sections.some((section) => event.affectsConfiguration(section));
const affected = sections.some((section) => event.affectsConfiguration(section));
if (!affected) {

@@ -178,3 +178,3 @@ return;

};
let middleware = this._client.middleware.workspace?.didChangeConfiguration;
const middleware = this._client.middleware.workspace?.didChangeConfiguration;
(middleware ? middleware(sections, didChangeConfiguration) : didChangeConfiguration(sections)).catch((error) => {

@@ -197,9 +197,9 @@ this._client.error(`Sending notification ${vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type.method} failed`, error);

}
let resource = this._client.clientOptions.workspaceFolder
const resource = this._client.clientOptions.workspaceFolder
? this._client.clientOptions.workspaceFolder.uri
: undefined;
let result = Object.create(null);
const result = Object.create(null);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
let index = key.indexOf('.');
const key = keys[i];
const index = key.indexOf('.');
let config = null;

@@ -213,3 +213,3 @@ if (index >= 0) {

if (config) {
let path = keys[i].split('.');
const path = keys[i].split('.');
ensurePath(result, path)[path[path.length - 1]] = toJSONObject(config);

@@ -216,0 +216,0 @@ }

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

fillClientCapabilities(capabilities) {
let definitionSupport = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'definition');
const definitionSupport = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'definition');
definitionSupport.dynamicRegistration = true;

@@ -20,0 +20,0 @@ definitionSupport.linkSupport = true;

@@ -65,3 +65,4 @@ import { Disposable, CancellationToken, ProviderResult, Diagnostic as VDiagnostic, TextDocument, Event as VEvent, EventEmitter, Uri } from 'vscode';

onType = "onType",
onSave = "onSave"
onSave = "onSave",
onFocus = "onFocus"
}

@@ -78,4 +79,9 @@ export type DiagnosticPullOptions = {

/**
* Whether to pull for diagnostics on editor focus.
*/
onFocus?: boolean;
/**
* An optional filter method that is consulted when triggering a
* diagnostic pull during document change or document save.
* diagnostic pull during document change, document save or editor
* focus.
*

@@ -82,0 +88,0 @@ * The document gets filtered if the method returns `true`.

@@ -31,2 +31,3 @@ "use strict";

DiagnosticPullMode["onSave"] = "onSave";
DiagnosticPullMode["onFocus"] = "onFocus";
})(DiagnosticPullMode || (exports.DiagnosticPullMode = DiagnosticPullMode = {}));

@@ -590,3 +591,3 @@ var RequestStateKind;

constructor(client, tabs, options) {
const diagnosticPullOptions = client.clientOptions.diagnosticPullOptions ?? { onChange: true, onSave: false };
const diagnosticPullOptions = client.clientOptions.diagnosticPullOptions ?? { onChange: true, onSave: false, onFocus: false };
const documentSelector = client.protocol2CodeConverter.asDocumentSelector(options.documentSelector);

@@ -644,2 +645,5 @@ const disposables = [];

};
const considerDocument = (textDocument, mode) => {
return (diagnosticPullOptions.filter === undefined || !diagnosticPullOptions.filter(textDocument, mode)) && this.diagnosticRequestor.knows(PullState.document, textDocument);
};
this.activeTextDocument = vscode_1.window.activeTextEditor?.document;

@@ -654,2 +658,5 @@ vscode_1.window.onDidChangeActiveTextEditor((editor) => {

this.backgroundScheduler.remove(this.activeTextDocument);
if (diagnosticPullOptions.onFocus === true && matches(this.activeTextDocument) && considerDocument(this.activeTextDocument, DiagnosticPullMode.onFocus)) {
this.diagnosticRequestor.pull(this.activeTextDocument, () => { this.backgroundScheduler.trigger(); });
}
}

@@ -725,3 +732,3 @@ });

const textDocument = event.textDocument;
if ((diagnosticPullOptions.filter === undefined || !diagnosticPullOptions.filter(textDocument, DiagnosticPullMode.onType)) && this.diagnosticRequestor.knows(PullState.document, textDocument)) {
if (considerDocument(textDocument, DiagnosticPullMode.onType)) {
this.diagnosticRequestor.pull(textDocument, () => { this.backgroundScheduler.trigger(); });

@@ -735,3 +742,3 @@ }

const textDocument = event.textDocument;
if ((diagnosticPullOptions.filter === undefined || !diagnosticPullOptions.filter(textDocument, DiagnosticPullMode.onSave)) && this.diagnosticRequestor.knows(PullState.document, textDocument)) {
if (considerDocument(textDocument, DiagnosticPullMode.onSave)) {
this.diagnosticRequestor.pull(event.textDocument, () => { this.backgroundScheduler.trigger(); });

@@ -784,3 +791,7 @@ }

fillClientCapabilities(capabilities) {
let capability = ensure(ensure(capabilities, 'textDocument'), 'diagnostic');
const capability = ensure(ensure(capabilities, 'textDocument'), 'diagnostic');
capability.relatedInformation = true;
capability.tagSupport = { valueSet: [vscode_languageserver_protocol_1.DiagnosticTag.Unnecessary, vscode_languageserver_protocol_1.DiagnosticTag.Deprecated] };
capability.codeDescriptionSupport = true;
capability.dataSupport = true;
capability.dynamicRegistration = true;

@@ -800,3 +811,3 @@ // We first need to decide how a UI will look with related documents.

});
let [id, options] = this.getRegistration(documentSelector, capabilities.diagnosticProvider);
const [id, options] = this.getRegistration(documentSelector, capabilities.diagnosticProvider);
if (!id || !options) {

@@ -803,0 +814,0 @@ return;

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

const client = this._client;
let resolveDocumentLink = (link, token) => {
const resolveDocumentLink = (link, token) => {
return client.sendRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, client.code2ProtocolConverter.asDocumentLink(link), token).then((result) => {

@@ -54,0 +54,0 @@ if (token.isCancellationRequested) {

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

fillClientCapabilities(capabilities) {
let symbolCapabilities = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'documentSymbol');
const symbolCapabilities = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'documentSymbol');
symbolCapabilities.dynamicRegistration = true;

@@ -51,0 +51,0 @@ symbolCapabilities.symbolKind = {

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

const executeCommand = (command, args) => {
let params = {
const params = {
command,

@@ -61,4 +61,5 @@ arguments: args

unregister(id) {
let disposables = this._commands.get(id);
const disposables = this._commands.get(id);
if (disposables) {
this._commands.delete(id);
disposables.forEach(disposable => disposable.dispose());

@@ -65,0 +66,0 @@ }

@@ -195,8 +195,9 @@ "use strict";

}
let registration = this.registerLanguageProvider(data.registerOptions, data.id);
const registration = this.registerLanguageProvider(data.registerOptions, data.id);
this._registrations.set(data.id, { disposable: registration[0], data, provider: registration[1] });
}
unregister(id) {
let registration = this._registrations.get(id);
const registration = this._registrations.get(id);
if (registration !== undefined) {
this._registrations.delete(id);
registration.disposable.dispose();

@@ -239,3 +240,3 @@ }

for (const registration of this._registrations.values()) {
let selector = registration.data.registerOptions.documentSelector;
const selector = registration.data.registerOptions.documentSelector;
if (selector !== null && vscode_1.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(selector), textDocument) > 0) {

@@ -274,4 +275,5 @@ return registration.provider;

unregister(id) {
let registration = this._registrations.get(id);
const registration = this._registrations.get(id);
if (registration !== undefined) {
this._registrations.delete(id);
registration.disposable.dispose();

@@ -278,0 +280,0 @@ }

@@ -52,4 +52,4 @@ "use strict";

registerRaw(id, fileSystemWatchers) {
let disposables = [];
for (let fileSystemWatcher of fileSystemWatchers) {
const disposables = [];
for (const fileSystemWatcher of fileSystemWatchers) {
this.hookListeners(fileSystemWatcher, true, true, true, disposables);

@@ -80,5 +80,6 @@ }

unregister(id) {
let disposables = this._watchers.get(id);
const disposables = this._watchers.get(id);
if (disposables) {
for (let disposable of disposables) {
this._watchers.delete(id);
for (const disposable of disposables) {
disposable.dispose();

@@ -90,3 +91,3 @@ }

this._watchers.forEach((disposables) => {
for (let disposable of disposables) {
for (const disposable of disposables) {
disposable.dispose();

@@ -93,0 +94,0 @@ }

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

fillClientCapabilities(capabilities) {
let capability = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'foldingRange');
const capability = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'foldingRange');
capability.dynamicRegistration = true;

@@ -31,3 +31,3 @@ capability.rangeLimit = 5000;

});
let [id, options] = this.getRegistration(documentSelector, capabilities.foldingRangeProvider);
const [id, options] = this.getRegistration(documentSelector, capabilities.foldingRangeProvider);
if (!id || !options) {

@@ -34,0 +34,0 @@ return;

import { Disposable, TextDocument, ProviderResult, Range as VRange, Position as VPosition, TextEdit as VTextEdit, FormattingOptions as VFormattingOptions, DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, OnTypeFormattingEditProvider } from 'vscode';
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, DocumentHighlightRegistrationOptions, DocumentFormattingOptions, TextDocumentRegistrationOptions, DocumentRangeFormattingRegistrationOptions, DocumentRangeFormattingOptions, DocumentOnTypeFormattingOptions, DocumentOnTypeFormattingRegistrationOptions } from 'vscode-languageserver-protocol';
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, DocumentFormattingOptions, TextDocumentRegistrationOptions, DocumentRangeFormattingRegistrationOptions, DocumentRangeFormattingOptions, DocumentOnTypeFormattingOptions, DocumentOnTypeFormattingRegistrationOptions, DocumentFormattingRegistrationOptions } from 'vscode-languageserver-protocol';
import { TextDocumentLanguageFeature, FeatureClient } from './features';

@@ -22,3 +22,3 @@ export interface ProvideDocumentFormattingEditsSignature {

}
export declare class DocumentFormattingFeature extends TextDocumentLanguageFeature<boolean | DocumentFormattingOptions, DocumentHighlightRegistrationOptions, DocumentFormattingEditProvider, FormattingMiddleware> {
export declare class DocumentFormattingFeature extends TextDocumentLanguageFeature<boolean | DocumentFormattingOptions, DocumentFormattingRegistrationOptions, DocumentFormattingEditProvider, FormattingMiddleware> {
constructor(client: FeatureClient<FormattingMiddleware>);

@@ -25,0 +25,0 @@ fillClientCapabilities(capabilities: ClientCapabilities): void;

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

const provideOnTypeFormattingEdits = (document, position, ch, options, token) => {
let params = {
const params = {
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document),

@@ -160,0 +160,0 @@ position: client.code2ProtocolConverter.asPosition(position),

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

fillClientCapabilities(capabilities) {
let implementationSupport = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'implementation');
const implementationSupport = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'implementation');
implementationSupport.dynamicRegistration = true;

@@ -22,3 +22,3 @@ implementationSupport.linkSupport = true;

initialize(capabilities, documentSelector) {
let [id, options] = this.getRegistration(documentSelector, capabilities.implementationProvider);
const [id, options] = this.getRegistration(documentSelector, capabilities.implementationProvider);
if (!id || !options) {

@@ -25,0 +25,0 @@ return;

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

fillClientCapabilities(capabilities) {
let inlineCompletion = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'inlineCompletion');
const inlineCompletion = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'inlineCompletion');
inlineCompletion.dynamicRegistration = true;

@@ -20,0 +20,0 @@ }

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

initialize(capabilities, documentSelector) {
let [id, options] = this.getRegistration(documentSelector, capabilities.linkedEditingRangeProvider);
const [id, options] = this.getRegistration(documentSelector, capabilities.linkedEditingRangeProvider);
if (!id || !options) {

@@ -23,0 +23,0 @@ return;

@@ -368,3 +368,13 @@ "use strict";

handles(textDocument) {
return vscode.languages.match(this.selector, textDocument) > 0;
if (vscode.languages.match(this.selector, textDocument) > 0) {
return true;
}
// Work around for https://github.com/microsoft/vscode/issues/202163
const key = textDocument.uri.toString();
for (const syncInfo of this.notebookSyncInfo.values()) {
if (syncInfo.uris.has(key)) {
return true;
}
}
return false;
}

@@ -809,3 +819,6 @@ didOpenNotebookCellTextDocument(notebookDocument, cell) {

const provider = this.registrations.get(id);
provider && provider.dispose();
if (provider !== undefined) {
this.registrations.delete(id);
provider.dispose();
}
}

@@ -812,0 +825,0 @@ clear() {

@@ -84,2 +84,5 @@ import * as code from 'vscode';

asCodeActionKinds(item: ls.CodeActionKind[] | null | undefined): code.CodeActionKind[] | undefined;
asCodeActionDocumentations(items: null | undefined): undefined;
asCodeActionDocumentations(items: ls.CodeActionKindDocumentation[]): code.CodeActionProviderMetadata['documentation'];
asCodeActionDocumentations(items: ls.CodeActionKindDocumentation[] | null | undefined): code.CodeActionProviderMetadata['documentation'] | undefined;
asCodeActionResult(items: (ls.Command | ls.CodeAction)[], token?: code.CancellationToken): Promise<(code.Command | code.CodeAction)[]>;

@@ -86,0 +89,0 @@ asCodeLens(item: ls.CodeLens): code.CodeLens;

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

function is(value) {
let candidate = value;
const candidate = value;
return candidate && Is.string(candidate.language) && Is.string(candidate.value);

@@ -71,3 +71,3 @@ }

function asDiagnostic(diagnostic) {
let result = new protocolDiagnostic_1.ProtocolDiagnostic(asRange(diagnostic.range), diagnostic.message, asDiagnosticSeverity(diagnostic.severity), diagnostic.data);
const result = new protocolDiagnostic_1.ProtocolDiagnostic(asRange(diagnostic.range), diagnostic.message, asDiagnosticSeverity(diagnostic.severity), diagnostic.data);
if (diagnostic.code !== undefined) {

@@ -119,5 +119,5 @@ if (typeof diagnostic.code === 'string' || typeof diagnostic.code === 'number') {

}
let result = [];
for (let tag of tags) {
let converted = asDiagnosticTag(tag);
const result = [];
for (const tag of tags) {
const converted = asDiagnosticTag(tag);
if (converted !== undefined) {

@@ -171,9 +171,9 @@ result.push(converted);

else if (CodeBlock.is(value)) {
let result = asMarkdownString();
const result = asMarkdownString();
return result.appendCodeblock(value.value, value.language);
}
else if (Array.isArray(value)) {
let result = [];
for (let element of value) {
let item = asMarkdownString();
const result = [];
for (const element of value) {
const item = asMarkdownString();
if (CodeBlock.is(element)) {

@@ -309,3 +309,3 @@ item.appendCodeblock(element.value, element.language);

if (Is.number(item.kind)) {
let [itemKind, original] = asCompletionItemKind(item.kind);
const [itemKind, original] = asCompletionItemKind(item.kind);
result.kind = itemKind;

@@ -427,3 +427,3 @@ if (original) {

}
let result = new code.SignatureHelp();
const result = new code.SignatureHelp();
if (Is.number(item.activeSignature)) {

@@ -439,2 +439,5 @@ result.activeSignature = item.activeSignature;

}
else if (item.activeParameter === null) {
result.activeParameter = -1;
}
else {

@@ -453,3 +456,3 @@ // activeParameter was optional in the past

async function asSignatureInformation(item, token) {
let result = new code.SignatureInformation(item.label);
const result = new code.SignatureInformation(item.label);
if (item.documentation !== undefined) {

@@ -462,3 +465,3 @@ result.documentation = asDocumentation(item.documentation);

if (item.activeParameter !== undefined) {
result.activeParameter = item.activeParameter;
result.activeParameter = item.activeParameter ?? -1;
}

@@ -473,3 +476,3 @@ {

function asParameterInformation(item) {
let result = new code.ParameterInformation(item.label);
const result = new code.ParameterInformation(item.label);
if (item.documentation) {

@@ -499,3 +502,3 @@ result.documentation = asDocumentation(item.documentation);

}
let result = {
const result = {
targetUri: _uriConverter(item.targetUri),

@@ -548,3 +551,3 @@ targetRange: asRange(item.targetRange),

function asDocumentHighlight(item) {
let result = new code.DocumentHighlight(asRange(item.range));
const result = new code.DocumentHighlight(asRange(item.range));
if (Is.number(item.kind)) {

@@ -616,7 +619,7 @@ result.kind = asDocumentHighlightKind(item.kind);

function asDocumentSymbol(value) {
let result = new code.DocumentSymbol(value.name, value.detail || '', asSymbolKind(value.kind), asRange(value.range), asRange(value.selectionRange));
const result = new code.DocumentSymbol(value.name, value.detail || '', asSymbolKind(value.kind), asRange(value.range), asRange(value.selectionRange));
fillTags(result, value);
if (value.children !== undefined && value.children.length > 0) {
let children = [];
for (let child of value.children) {
const children = [];
for (const child of value.children) {
children.push(asDocumentSymbol(child));

@@ -642,3 +645,6 @@ }

function asCommand(item) {
let result = { title: item.title, command: item.command };
const result = { title: item.title, command: item.command };
if (item.tooltip) {
result.tooltip = item.tooltip;
}
if (item.arguments) {

@@ -672,5 +678,5 @@ result.arguments = item.arguments;

}
let parts = item.split('.');
const parts = item.split('.');
result = code.CodeActionKind.Empty;
for (let part of parts) {
for (const part of parts) {
result = result.append(part);

@@ -686,2 +692,8 @@ }

}
function asCodeActionDocumentations(items) {
if (items === undefined || items === null) {
return undefined;
}
return items.map(doc => ({ kind: asCodeActionKind(doc.kind), command: asCommand(doc.command) }));
}
async function asCodeAction(item, token) {

@@ -691,3 +703,3 @@ if (item === undefined || item === null) {

}
let result = new protocolCodeAction_1.default(item.title, item.data);
const result = new protocolCodeAction_1.default(item.title, item.data);
if (item.kind !== undefined) {

@@ -727,3 +739,3 @@ result.kind = asCodeActionKind(item.kind);

}
let result = new protocolCodeLens_1.default(asRange(item.range));
const result = new protocolCodeLens_1.default(asRange(item.range));
if (item.command) {

@@ -778,10 +790,15 @@ result.command = asCommand(item.command);

const uri = _uriConverter(change.textDocument.uri);
const edits = [];
for (const edit of change.edits) {
if (ls.AnnotatedTextEdit.is(edit)) {
result.replace(uri, asRange(edit.range), edit.newText, asMetadata(edit.annotationId));
edits.push([new code.TextEdit(asRange(edit.range), edit.newText), asMetadata(edit.annotationId)]);
}
else if (ls.SnippetTextEdit.is(edit)) {
edits.push([new code.SnippetTextEdit(asRange(edit.range), new code.SnippetString(edit.snippet.value)), asMetadata(edit.annotationId)]);
}
else {
result.replace(uri, asRange(edit.range), edit.newText);
edits.push([new code.TextEdit(asRange(edit.range), edit.newText), undefined]);
}
}
result.set(uri, edits);
}

@@ -808,6 +825,6 @@ else {

function asDocumentLink(item) {
let range = asRange(item.range);
let target = item.target ? asUri(item.target) : undefined;
const range = asRange(item.range);
const target = item.target ? asUri(item.target) : undefined;
// target must be optional in DocumentLink
let link = new protocolDocumentLink_1.default(range, target);
const link = new protocolDocumentLink_1.default(range, target);
if (item.tooltip !== undefined) {

@@ -840,3 +857,3 @@ link.tooltip = item.tooltip;

function asColorPresentation(cp) {
let presentation = new code.ColorPresentation(cp.label);
const presentation = new code.ColorPresentation(cp.label);
presentation.additionalTextEdits = asTextEditsSync(cp.additionalTextEdits);

@@ -1020,3 +1037,3 @@ if (cp.textEdit) {

}
let result = new protocolTypeHierarchyItem_1.default(asSymbolKind(item.kind), item.name, item.detail || '', asUri(item.uri), asRange(item.range), asRange(item.selectionRange), item.data);
const result = new protocolTypeHierarchyItem_1.default(asSymbolKind(item.kind), item.name, item.detail || '', asUri(item.uri), asRange(item.range), asRange(item.selectionRange), item.data);
if (item.tags !== undefined) {

@@ -1118,2 +1135,3 @@ result.tags = asSymbolTags(item.tags);

asCodeActionKinds,
asCodeActionDocumentations,
asCodeActionResult,

@@ -1120,0 +1138,0 @@ asCodeLens,

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

fillClientCapabilities(capabilities) {
let rename = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'rename');
const rename = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'rename');
rename.dynamicRegistration = true;

@@ -41,3 +41,3 @@ rename.prepareSupport = true;

const provideRenameEdits = (document, position, newName, token) => {
let params = {
const params = {
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document),

@@ -65,3 +65,3 @@ position: client.code2ProtocolConverter.asPosition(position),

const prepareRename = (document, position, token) => {
let params = {
const params = {
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document),

@@ -68,0 +68,0 @@ position: client.code2ProtocolConverter.asPosition(position),

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

fillClientCapabilities(capabilities) {
let config = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'signatureHelp');
const config = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'signatureHelp');
config.dynamicRegistration = true;

@@ -23,2 +23,3 @@ config.signatureInformation = { documentationFormat: [vscode_languageserver_protocol_1.MarkupKind.Markdown, vscode_languageserver_protocol_1.MarkupKind.PlainText] };

config.signatureInformation.activeParameterSupport = true;
config.signatureInformation.noActiveParameterSupport = true;
config.contextSupport = true;

@@ -25,0 +26,0 @@ }

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

initialize(capabilities, documentSelector) {
let textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
const textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.openClose) {

@@ -102,4 +102,4 @@ this.register({ id: UUID.generateUuid(), registerOptions: { documentSelector: documentSelector } });

if (vscode_1.languages.match(selector, textDocument) > 0 && !this._selectorFilter(selectors, textDocument) && !this._client.hasDedicatedTextSynchronizationFeature(textDocument)) {
let middleware = this._client.middleware;
let didClose = (textDocument) => {
const middleware = this._client.middleware;
const didClose = (textDocument) => {
return this._client.sendNotification(this._type, this._createParams(textDocument));

@@ -141,3 +141,3 @@ };

initialize(capabilities, documentSelector) {
let textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
const textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.change !== undefined && textDocumentSyncOptions.change !== vscode_languageserver_protocol_1.TextDocumentSyncKind.None) {

@@ -294,7 +294,7 @@ this.register({

fillClientCapabilities(capabilities) {
let value = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'synchronization');
const value = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'synchronization');
value.willSave = true;
}
initialize(capabilities, documentSelector) {
let textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
const textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.willSave) {

@@ -324,7 +324,7 @@ this.register({

fillClientCapabilities(capabilities) {
let value = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'synchronization');
const value = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'synchronization');
value.willSaveWaitUntil = true;
}
initialize(capabilities, documentSelector) {
let textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
const textDocumentSyncOptions = capabilities.resolvedTextDocumentSync;
if (documentSelector && textDocumentSyncOptions && textDocumentSyncOptions.willSaveWaitUntil) {

@@ -348,6 +348,6 @@ this.register({

if (features_1.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(), event.document) && !this._client.hasDedicatedTextSynchronizationFeature(event.document)) {
let middleware = this._client.middleware;
let willSaveWaitUntil = (event) => {
const middleware = this._client.middleware;
const willSaveWaitUntil = (event) => {
return this._client.sendRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(event)).then(async (edits) => {
let vEdits = await this._client.protocol2CodeConverter.asTextEdits(edits);
const vEdits = await this._client.protocol2CodeConverter.asTextEdits(edits);
return vEdits === undefined ? [] : vEdits;

@@ -354,0 +354,0 @@ });

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

(0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'typeDefinition').dynamicRegistration = true;
let typeDefinitionSupport = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'typeDefinition');
const typeDefinitionSupport = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'textDocument'), 'typeDefinition');
typeDefinitionSupport.dynamicRegistration = true;

@@ -23,3 +23,3 @@ typeDefinitionSupport.linkSupport = true;

initialize(capabilities, documentSelector) {
let [id, options] = this.getRegistration(documentSelector, capabilities.typeDefinitionProvider);
const [id, options] = this.getRegistration(documentSelector, capabilities.typeDefinitionProvider);
if (!id || !options) {

@@ -26,0 +26,0 @@ return;

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

this.onSuccess = undefined;
var result = this.task();
const result = this.task();
this.task = undefined;

@@ -47,3 +47,3 @@ return result;

this.cancelTimeout();
let result = this.task();
const result = this.task();
this.completionPromise = undefined;

@@ -50,0 +50,0 @@ this.onSuccess = undefined;

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

doSendEvent(addedFolders, removedFolders) {
let params = {
const params = {
event: {

@@ -111,9 +111,9 @@ added: addedFolders.map(folder => this.asProtocol(folder)),

register(data) {
let id = data.id;
let client = this._client;
let disposable = vscode_1.workspace.onDidChangeWorkspaceFolders((event) => {
let didChangeWorkspaceFolders = (event) => {
const id = data.id;
const client = this._client;
const disposable = vscode_1.workspace.onDidChangeWorkspaceFolders((event) => {
const didChangeWorkspaceFolders = (event) => {
return this.doSendEvent(event.added, event.removed);
};
let middleware = client.middleware.workspace;
const middleware = client.middleware.workspace;
const promise = middleware && middleware.didChangeWorkspaceFolders

@@ -130,3 +130,3 @@ ? middleware.didChangeWorkspaceFolders(event, didChangeWorkspaceFolders)

unregister(id) {
let disposable = this._listeners.get(id);
const disposable = this._listeners.get(id);
if (disposable === void 0) {

@@ -139,3 +139,3 @@ return;

clear() {
for (let disposable of this._listeners.values()) {
for (const disposable of this._listeners.values()) {
disposable.dispose();

@@ -142,0 +142,0 @@ }

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

fillClientCapabilities(capabilities) {
let symbolCapabilities = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'workspace'), 'symbol');
const symbolCapabilities = (0, features_1.ensure)((0, features_1.ensure)(capabilities, 'workspace'), 'symbol');
symbolCapabilities.dynamicRegistration = true;

@@ -21,0 +21,0 @@ symbolCapabilities.symbolKind = {

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

__exportStar(require("../common/api"), exports);
const REQUIRED_VSCODE_VERSION = '^1.82.0'; // do not change format, updated by `updateVSCode` script
const REQUIRED_VSCODE_VERSION = '^1.86.0'; // do not change format, updated by `updateVSCode` script
var TransportKind;

@@ -69,3 +69,3 @@ (function (TransportKind) {

function is(value) {
let candidate = value;
const candidate = value;
return candidate && candidate.writer !== undefined && candidate.reader !== undefined;

@@ -78,3 +78,3 @@ }

function is(value) {
let candidate = value;
const candidate = value;
return candidate && candidate.process !== undefined && typeof candidate.detached === 'boolean';

@@ -210,3 +210,3 @@ }

function startedInDebugMode() {
let args = process.execArgv;
const args = process.execArgv;
if (args) {

@@ -253,3 +253,3 @@ return args.some((arg) => {

let json;
let runDebug = server;
const runDebug = server;
if (runDebug.run || runDebug.debug) {

@@ -270,4 +270,4 @@ if (this._forceDebug || startedInDebugMode()) {

if (NodeModule.is(json) && json.module) {
let node = json;
let transport = node.transport || TransportKind.stdio;
const node = json;
const transport = node.transport || TransportKind.stdio;
if (node.runtime) {

@@ -476,3 +476,6 @@ const args = [];

this._serverProcess.on('exit', (code, signal) => {
if (code !== null) {
if (code === 0) {
this.info('Server process exited successfully', undefined, false);
}
else if (code !== null) {
this.error(`Server process exited with code ${code}.`, undefined, false);

@@ -507,7 +510,7 @@ }

_mainGetRootPath() {
let folders = vscode_1.workspace.workspaceFolders;
const folders = vscode_1.workspace.workspaceFolders;
if (!folders || folders.length === 0) {
return undefined;
}
let folder = folders[0];
const folder = folders[0];
if (folder.uri.scheme === 'file') {

@@ -553,6 +556,6 @@ return folder.uri.fsPath;

onDidChangeConfiguration() {
let index = this._setting.indexOf('.');
let primary = index >= 0 ? this._setting.substr(0, index) : this._setting;
let rest = index >= 0 ? this._setting.substr(index + 1) : undefined;
let enabled = rest ? vscode_1.workspace.getConfiguration(primary).get(rest, false) : vscode_1.workspace.getConfiguration(primary);
const index = this._setting.indexOf('.');
const primary = index >= 0 ? this._setting.substr(0, index) : this._setting;
const rest = index >= 0 ? this._setting.substr(index + 1) : undefined;
const enabled = rest ? vscode_1.workspace.getConfiguration(primary).get(rest, false) : vscode_1.workspace.getConfiguration(primary);
if (enabled && this._client.needsStart()) {

@@ -559,0 +562,0 @@ this._client.start().catch((error) => this._client.error('Start failed after configuration change', error, 'force'));

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

// which might be already closed.
let options = {
const options = {
stdio: ['pipe', 'pipe', 'ignore']

@@ -35,4 +35,4 @@ };

try {
var cmd = (0, path_1.join)(__dirname, 'terminateProcess.sh');
var result = cp.spawnSync(cmd, [process.pid.toString()]);
const cmd = (0, path_1.join)(__dirname, 'terminateProcess.sh');
const result = cp.spawnSync(cmd, [process.pid.toString()]);
return result.error ? false : true;

@@ -39,0 +39,0 @@ }

{
"name": "vscode-languageclient",
"description": "VSCode Language client implementation",
"version": "9.0.2-next.1",
"version": "10.0.0-next.1",
"author": "Microsoft Corporation",
"license": "MIT",
"engines": {
"vscode": "^1.82.0"
"vscode": "^1.86.0"
},

@@ -26,4 +26,4 @@ "repository": {

"@types/minimatch": "^5.1.2",
"@types/semver": "^7.5.4",
"@types/vscode": "1.82.0",
"@types/semver": "^7.5.8",
"@types/vscode": "1.86.0",
"shx": "^0.3.4"

@@ -33,4 +33,4 @@ },

"minimatch": "^9.0.3",
"semver": "^7.5.4",
"vscode-languageserver-protocol": "3.17.6-next.1"
"semver": "^7.6.0",
"vscode-languageserver-protocol": "3.17.6-next.2"
},

@@ -37,0 +37,0 @@ "scripts": {

@@ -5,3 +5,3 @@ # VSCode Language Server - Client Module

[![NPM Downloads](https://img.shields.io/npm/dm/vscode-languageclient.svg)](https://npmjs.org/package/vscode-languageclient)
[![Build Status](https://travis-ci.org/Microsoft/vscode-languageserver-node.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-languageserver-node)
[![Build Status](https://dev.azure.com/ms/vscode-languageserver-node/_apis/build/status/microsoft.vscode-languageserver-node?branchName=main)](https://dev.azure.com/ms/vscode-languageserver-node/_build/latest?definitionId=439&branchName=main)

@@ -8,0 +8,0 @@ This npm module allows VSCode extensions to easily integrate language servers adhering to the [language server protocol](https://github.com/Microsoft/vscode-languageserver-protocol)

Sorry, the diff of this file is too big to display

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