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

vscode-languageclient

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

9

lib/main.d.ts

@@ -64,2 +64,4 @@ import * as cp from 'child_process';

private _state;
private _onReady;
private _onReadyCallbacks;
private _connection;

@@ -75,9 +77,10 @@ private _childProcess;

needsStop(): boolean;
onReady(): Promise<void>;
private isConnectionActive();
start(): void;
stop(): void;
sendSettings(settings: any): void;
sendFileEvent(event: FileEvent): void;
private resolveConnection();
private initialize(connection);
stop(): void;
notifyConfigurationChanged(settings: any): void;
notifyFileEvent(event: FileEvent): void;
private onDidOpenTextDoument(connection, textDocument);

@@ -84,0 +87,0 @@ private onDidChangeTextDocument(connection, event);

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

function LanguageClient(name, customization, forceDebug) {
var _this = this;
if (forceDebug === void 0) { forceDebug = false; }

@@ -72,2 +73,5 @@ this._name = name;

this._delayer = new async_1.Delayer(250);
this._onReady = new Promise(function (resolve, reject) {
_this._onReadyCallbacks = { resolve: resolve, reject: reject };
});
}

@@ -80,4 +84,7 @@ LanguageClient.prototype.needsStart = function () {

};
LanguageClient.prototype.onReady = function () {
return this._onReady;
};
LanguageClient.prototype.isConnectionActive = function () {
return this._state === ClientState.Starting || this._state === ClientState.Running;
return this._state === ClientState.Running;
};

@@ -88,18 +95,39 @@ LanguageClient.prototype.start = function () {

this.resolveConnection().then(function (connection) {
_this.initialize(connection);
}, function (error) {
_this._onReadyCallbacks.reject();
vscode_1.window.showErrorMessage("Couldn't start client " + _this._name);
});
};
LanguageClient.prototype.resolveConnection = function () {
if (!this._connection) {
this._connection = this.createConnection();
}
return this._connection;
};
LanguageClient.prototype.initialize = function (connection) {
var _this = this;
var initParams = { rootFolder: vscode_1.workspace.getPath(), capabilities: {} };
return connection.initialize(initParams).then(function (result) {
_this._state = ClientState.Running;
_this._capabilites = result.capabilities;
connection.onDiagnostics(function (params) { return _this.handleDiagnostics(params); });
_this.initialize(connection).then(function () {
vscode_1.workspace.onDidOpenTextDocument(function (t) { return _this.onDidOpenTextDoument(connection, t); }, null, _this._listeners);
vscode_1.workspace.onDidChangeTextDocument(function (t) { return _this.onDidChangeTextDocument(connection, t); }, null, _this._listeners);
vscode_1.workspace.onDidCloseTextDocument(function (t) { return _this.onDidCloseTextDoument(connection, t); }, null, _this._listeners);
_this.hookFileEvents(connection);
_this.hookConfigurationChanged(connection);
vscode_1.workspace.getTextDocuments().forEach(function (t) { return _this.onDidOpenTextDoument(connection, t); });
}, function (error) {
vscode_1.window.showErrorMessage(error.message).then(function () {
// REtry initialize
});
});
vscode_1.workspace.onDidOpenTextDocument(function (t) { return _this.onDidOpenTextDoument(connection, t); }, null, _this._listeners);
vscode_1.workspace.onDidChangeTextDocument(function (t) { return _this.onDidChangeTextDocument(connection, t); }, null, _this._listeners);
vscode_1.workspace.onDidCloseTextDocument(function (t) { return _this.onDidCloseTextDoument(connection, t); }, null, _this._listeners);
_this.hookFileEvents(connection);
_this.hookConfigurationChanged(connection);
_this._onReadyCallbacks.resolve();
vscode_1.workspace.getTextDocuments().forEach(function (t) { return _this.onDidOpenTextDoument(connection, t); });
return result;
}, function (error) {
vscode_1.window.showErrorMessage("Couldn't start client " + _this._name);
if (error.data.retry) {
vscode_1.window.showErrorMessage(error.message, { title: 'Retry', command: function () {
_this.initialize(connection);
} });
}
else {
_this._onReadyCallbacks.reject();
vscode_1.window.showErrorMessage(error.message);
}
});

@@ -131,23 +159,19 @@ };

};
LanguageClient.prototype.sendSettings = function (settings) {
LanguageClient.prototype.notifyConfigurationChanged = function (settings) {
var _this = this;
if (!this.isConnectionActive()) {
return;
}
this.resolveConnection().then(function (connection) {
if (_this.isConnectionActive()) {
connection.didChangeConfiguration({ settings: settings });
}
}, function (error) {
console.error("Syncing settings failed with error " + JSON.stringify(error, null, 4));
this.onReady().then(function () {
_this.resolveConnection().then(function (connection) {
if (_this.isConnectionActive()) {
connection.didChangeConfiguration({ settings: settings });
}
}, function (error) {
console.error("Syncing settings failed with error " + JSON.stringify(error, null, 4));
});
});
};
LanguageClient.prototype.sendFileEvent = function (event) {
LanguageClient.prototype.notifyFileEvent = function (event) {
var _this = this;
if (!this.isConnectionActive()) {
return;
}
this._fileEvents.push(event);
this._delayer.trigger(function () {
if (_this.isConnectionActive()) {
_this.onReady().then(function () {
_this.resolveConnection().then(function (connection) {

@@ -159,19 +183,5 @@ if (_this.isConnectionActive()) {

});
}
});
});
};
LanguageClient.prototype.resolveConnection = function () {
if (!this._connection) {
this._connection = this.createConnection();
}
return this._connection;
};
LanguageClient.prototype.initialize = function (connection) {
var _this = this;
var initParams = { rootFolder: vscode_1.workspace.getPath(), capabilities: {} };
return connection.initialize(initParams).then(function (result) {
_this._capabilites = result.capabilities;
return result;
});
};
LanguageClient.prototype.onDidOpenTextDoument = function (connection, textDocument) {

@@ -354,11 +364,11 @@ if (!this._customization.syncTextDocument(textDocument)) {

watchers.forEach(function (watcher) {
watcher.onDidCreate(function (resource) { return _this.sendFileEvent({
watcher.onDidCreate(function (resource) { return _this.notifyFileEvent({
uri: resource.toString(),
type: protocol_1.FileChangeType.Created
}); }, null, _this._listeners);
watcher.onDidChange(function (resource) { return _this.sendFileEvent({
watcher.onDidChange(function (resource) { return _this.notifyFileEvent({
uri: resource.toString(),
type: protocol_1.FileChangeType.Changed
}); }, null, _this._listeners);
watcher.onDidDelete(function (resource) { return _this.sendFileEvent({
watcher.onDidDelete(function (resource) { return _this.notifyFileEvent({
uri: resource.toString(),

@@ -365,0 +375,0 @@ type: protocol_1.FileChangeType.Deleted

{
"name": "vscode-languageclient",
"description": "VSCode Language client implementation",
"version": "0.10.0-pre.8",
"version": "0.10.0-pre.9",
"author": "Microsoft Corporation",

@@ -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