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

vscode-languageclient

Package Overview
Dependencies
Maintainers
9
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 0.10.0-pre.22 to 0.10.0-pre.23

40

lib/main.d.ts
import * as cp from 'child_process';
import ChildProcess = cp.ChildProcess;
import { TextDocument, FileSystemWatcher } from 'vscode';
import { TextDocument, Disposable, FileSystemWatcher } from 'vscode';
import { INotificationHandler, RequestType, NotificationType } from 'vscode-jsonrpc';

@@ -33,18 +33,22 @@ import { FileEvent } from './protocol';

}
export interface ClientOptions {
server: Executable | {
run: Executable;
debug: Executable;
} | {
run: NodeModule;
debug: NodeModule;
} | NodeModule | (() => Thenable<ChildProcess | StreamInfo>);
configuration?: string | string[];
fileWatchers?: FileSystemWatcher | FileSystemWatcher[];
export declare type ServerOptions = Executable | {
run: Executable;
debug: Executable;
} | {
run: NodeModule;
debug: NodeModule;
} | NodeModule | (() => Thenable<ChildProcess | StreamInfo>);
export interface SynchronizeOptions {
configurationSection?: string | string[];
fileEvents?: FileSystemWatcher | FileSystemWatcher[];
textDocumentFilter?: (textDocument: TextDocument) => boolean;
}
export interface LanguageClientOptions {
languageSelector?: string | string[];
syncTextDocument?: (textDocument: TextDocument) => boolean;
synchronize?: SynchronizeOptions;
}
export declare class LanguageClient {
private _name;
private _options;
private _serverOptions;
private _languageOptions;
private _forceDebug;

@@ -63,3 +67,3 @@ private _state;

private _delayer;
constructor(name: string, options: ClientOptions, forceDebug?: boolean);
constructor(name: string, serverOptions: ServerOptions, languageOptions: LanguageClientOptions, forceDebug?: boolean);
private computeSyncExpression();

@@ -73,3 +77,3 @@ sendRequest<P, R, E>(type: RequestType<P, R, E>, params?: P): Thenable<R>;

private isConnectionActive();
start(): void;
start(): Disposable;
private resolveConnection();

@@ -92,9 +96,9 @@ private initialize(connection);

}
export declare class ClientStarter {
export declare class SettingMonitor {
private _client;
private _setting;
private _listeners;
constructor(_client: LanguageClient);
watchSetting(setting: string): void;
constructor(_client: LanguageClient, _setting: string);
start(): Disposable;
private onDidChangeConfiguration();
}

@@ -100,7 +100,9 @@ /*---------------------------------------------------------

var LanguageClient = (function () {
function LanguageClient(name, options, forceDebug) {
function LanguageClient(name, serverOptions, languageOptions, forceDebug) {
var _this = this;
if (forceDebug === void 0) { forceDebug = false; }
this._name = name;
this._options = options;
this._serverOptions = serverOptions;
this._languageOptions = languageOptions || {};
this._languageOptions.synchronize = this._languageOptions.synchronize || {};
this._syncExpression = this.computeSyncExpression();

@@ -121,18 +123,20 @@ this._forceDebug = forceDebug;

LanguageClient.prototype.computeSyncExpression = function () {
if (!this._options.languageSelector && !this._options.syncTextDocument) {
var languageSelector = this._languageOptions.languageSelector;
var textDocumentFilter = this._languageOptions.synchronize.textDocumentFilter;
if (!languageSelector && !textDocumentFilter) {
return new FalseSyncExpression();
}
if (this._options.syncTextDocument && !this._options.languageSelector) {
return new FunctionSyncExpression(this._options.syncTextDocument);
if (textDocumentFilter && !languageSelector) {
return new FunctionSyncExpression(textDocumentFilter);
}
if (!this._options.syncTextDocument && this._options.languageSelector) {
if (is.string(this._options.languageSelector)) {
return new LanguageIdExpression(this._options.languageSelector);
if (!textDocumentFilter && languageSelector) {
if (is.string(languageSelector)) {
return new LanguageIdExpression(languageSelector);
}
else {
return new CompositeSyncExpression(this._options.languageSelector);
return new CompositeSyncExpression(languageSelector);
}
}
if (this._options.syncTextDocument && this._options.languageSelector) {
return new CompositeSyncExpression(is.string(this._options.languageSelector) ? [this._options.languageSelector] : this._options.languageSelector, this._options.syncTextDocument);
if (textDocumentFilter && languageSelector) {
return new CompositeSyncExpression(is.string(languageSelector) ? [languageSelector] : languageSelector, textDocumentFilter);
}

@@ -226,2 +230,7 @@ };

});
return new vscode_1.Disposable(function () {
if (_this.needsStop()) {
_this.stop();
}
});
};

@@ -350,3 +359,3 @@ LanguageClient.prototype.resolveConnection = function () {

var _this = this;
var server = this._options.server;
var server = this._serverOptions;
// We got a function.

@@ -419,3 +428,3 @@ if (is.func(server)) {

var _this = this;
if (!this._options.configuration) {
if (!this._languageOptions.synchronize.configurationSection) {
return;

@@ -428,7 +437,8 @@ }

var keys = null;
if (is.string(this._options.configuration)) {
keys = [this._options.configuration];
var configurationSection = this._languageOptions.synchronize.configurationSection;
if (is.string(configurationSection)) {
keys = [configurationSection];
}
else if (is.stringArray(this._options.configuration)) {
keys = this._options.configuration;
else if (is.stringArray(configurationSection)) {
keys = configurationSection;
}

@@ -475,11 +485,12 @@ if (keys) {

var _this = this;
if (!this._options.fileWatchers) {
var fileEvents = this._languageOptions.synchronize.fileEvents;
if (!fileEvents) {
return;
}
var watchers = null;
if (is.array(this._options.fileWatchers)) {
watchers = this._options.fileWatchers;
if (is.array(fileEvents)) {
watchers = fileEvents;
}
else {
watchers = [this._options.fileWatchers];
watchers = [fileEvents];
}

@@ -506,4 +517,4 @@ if (!watchers) {

var _this = this;
if (this._capabilites.hoverProvider && this._options.languageSelector) {
this._providers.push(vscode_1.languages.registerHoverProvider(this._options.languageSelector, {
if (this._capabilites.hoverProvider && this._languageOptions.languageSelector) {
this._providers.push(vscode_1.languages.registerHoverProvider(this._languageOptions.languageSelector, {
provideHover: function (document, position, token) {

@@ -526,2 +537,24 @@ if (_this.isConnectionActive()) {

}
else if (this._capabilites.completionProvider && this._languageOptions.languageSelector) {
this._providers.push(vscode_1.languages.registerCompletionItemProvider.apply(vscode_1.languages, [this._languageOptions.languageSelector, {
provideCompletionItems: function (document, position, token) {
if (_this.isConnectionActive()) {
return connection.sendRequest(protocol_1.CompletionRequest.type, converters_1.asTextDocumentPosition(document, position));
}
else {
return Promise.resolve([]);
}
},
resolveCompletionItem: this._capabilites.completionProvider.resolveProvider
? function (item, token) {
if (_this.isConnectionActive()) {
return connection.sendRequest(protocol_1.CompletionResolveRequest.type, item);
}
else {
return Promise.resolve(item);
}
}
: undefined
}].concat(this._capabilites.completionProvider.triggerCharacters)));
}
};

@@ -531,13 +564,18 @@ return LanguageClient;

exports.LanguageClient = LanguageClient;
var ClientStarter = (function () {
function ClientStarter(_client) {
var SettingMonitor = (function () {
function SettingMonitor(_client, _setting) {
this._client = _client;
this._listeners = [];
}
ClientStarter.prototype.watchSetting = function (setting) {
this._setting = setting;
SettingMonitor.prototype.start = function () {
var _this = this;
vscode_1.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, this._listeners);
this.onDidChangeConfiguration();
return new vscode_1.Disposable(function () {
if (_this._client.needsStop()) {
_this._client.stop();
}
});
};
ClientStarter.prototype.onDidChangeConfiguration = function () {
SettingMonitor.prototype.onDidChangeConfiguration = function () {
var index = this._setting.indexOf('.');

@@ -554,4 +592,4 @@ var primary = index >= 0 ? this._setting.substr(0, index) : this._setting;

};
return ClientStarter;
return SettingMonitor;
})();
exports.ClientStarter = ClientStarter;
exports.SettingMonitor = SettingMonitor;

@@ -9,5 +9,10 @@ import { RequestType, NotificationType } from 'vscode-jsonrpc';

}
export interface CompletionOptions {
resolveProvider?: boolean;
triggerCharacters?: string[];
}
export interface ServerCapabilities {
textDocumentSync?: number;
hoverProvider?: boolean;
completionProvider?: CompletionOptions;
}

@@ -14,0 +19,0 @@ /**

{
"name": "vscode-languageclient",
"description": "VSCode Language client implementation",
"version": "0.10.0-pre.22",
"version": "0.10.0-pre.23",
"author": "Visual Studio Code Team",

@@ -6,0 +6,0 @@ "license": "MIT",

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