vscode-languageclient
Advanced tools
Comparing version 2.4.1 to 2.4.2
import * as cp from 'child_process'; | ||
import ChildProcess = cp.ChildProcess; | ||
import { TextDocument, Disposable, FileSystemWatcher, CancellationToken } from 'vscode'; | ||
import { TextDocument, Disposable, OutputChannel, FileSystemWatcher, CancellationToken } from 'vscode'; | ||
import { Message, RequestHandler, NotificationHandler, RequestType, NotificationType, Trace, Event } from 'vscode-jsonrpc'; | ||
@@ -103,2 +103,3 @@ import { Range, Position, Location, TextEdit, WorkspaceChange, TextEditChange, TextDocumentIdentifier } from 'vscode-languageserver-types'; | ||
diagnosticCollectionName?: string; | ||
outputChannelName?: string; | ||
initializationOptions?: any; | ||
@@ -108,5 +109,6 @@ errorHandler?: ErrorHandler; | ||
export declare class LanguageClient { | ||
private _id; | ||
private _name; | ||
private _serverOptions; | ||
private _languageOptions; | ||
private _clientOptions; | ||
private _forceDebug; | ||
@@ -130,3 +132,3 @@ private _state; | ||
private _tracer; | ||
constructor(name: string, serverOptions: ServerOptions, languageOptions: LanguageClientOptions, forceDebug?: boolean); | ||
constructor(id: string, name: string, serverOptions: ServerOptions, clientOptions: LanguageClientOptions, forceDebug?: boolean); | ||
private computeSyncExpression(); | ||
@@ -139,3 +141,3 @@ sendRequest<P, R, E>(type: RequestType<P, R, E>, params: P, token?: CancellationToken): Thenable<R>; | ||
onTelemetry: Event<any>; | ||
private outputChannel; | ||
outputChannel: OutputChannel; | ||
trace: Trace; | ||
@@ -142,0 +144,0 @@ private logTrace(message); |
@@ -181,10 +181,11 @@ /* -------------------------------------------------------------------------------------------- | ||
var LanguageClient = (function () { | ||
function LanguageClient(name, serverOptions, languageOptions, forceDebug) { | ||
function LanguageClient(id, name, serverOptions, clientOptions, forceDebug) { | ||
var _this = this; | ||
if (forceDebug === void 0) { forceDebug = false; } | ||
this._id = id; | ||
this._name = name; | ||
this._serverOptions = serverOptions; | ||
this._languageOptions = languageOptions || {}; | ||
this._languageOptions.synchronize = this._languageOptions.synchronize || {}; | ||
this._languageOptions.errorHandler = this._languageOptions.errorHandler || new DefaultErrorHandler(name); | ||
this._clientOptions = clientOptions || {}; | ||
this._clientOptions.synchronize = this._clientOptions.synchronize || {}; | ||
this._clientOptions.errorHandler = this._clientOptions.errorHandler || new DefaultErrorHandler(name); | ||
this._syncExpression = this.computeSyncExpression(); | ||
@@ -217,4 +218,4 @@ this._forceDebug = forceDebug; | ||
LanguageClient.prototype.computeSyncExpression = function () { | ||
var documentSelector = this._languageOptions.documentSelector; | ||
var textDocumentFilter = this._languageOptions.synchronize.textDocumentFilter; | ||
var documentSelector = this._clientOptions.documentSelector; | ||
var textDocumentFilter = this._clientOptions.synchronize.textDocumentFilter; | ||
if (!documentSelector && !textDocumentFilter) { | ||
@@ -292,3 +293,3 @@ return new FalseSyncExpression(); | ||
if (!this._outputChannel) { | ||
this._outputChannel = vscode_1.window.createOutputChannel(this._name); | ||
this._outputChannel = vscode_1.window.createOutputChannel(this._clientOptions.outputChannelName ? this._clientOptions.outputChannelName : this._name); | ||
} | ||
@@ -337,4 +338,4 @@ return this._outputChannel; | ||
if (!this._diagnostics) { | ||
this._diagnostics = this._languageOptions.diagnosticCollectionName | ||
? vscode_1.languages.createDiagnosticCollection(this._languageOptions.diagnosticCollectionName) | ||
this._diagnostics = this._clientOptions.diagnosticCollectionName | ||
? vscode_1.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName) | ||
: vscode_1.languages.createDiagnosticCollection(); | ||
@@ -414,3 +415,3 @@ } | ||
var _this = this; | ||
var initParams = { processId: process.pid, rootPath: vscode_1.workspace.rootPath, capabilities: {}, initializationOptions: this._languageOptions.initializationOptions }; | ||
var initParams = { processId: process.pid, rootPath: vscode_1.workspace.rootPath, capabilities: {}, initializationOptions: this._clientOptions.initializationOptions }; | ||
return connection.initialize(initParams).then(function (result) { | ||
@@ -676,3 +677,3 @@ _this._state = ClientState.Running; | ||
this._childProcess = null; | ||
var action = this._languageOptions.errorHandler.closed(); | ||
var action = this._clientOptions.errorHandler.closed(); | ||
if (action === CloseAction.DoNotRestart) { | ||
@@ -691,3 +692,3 @@ this.logTrace('Connection to server got closed. Server will not be restarted.'); | ||
LanguageClient.prototype.handleConnectionError = function (error, message, count) { | ||
var action = this._languageOptions.errorHandler.error(error, message, count); | ||
var action = this._clientOptions.errorHandler.error(error, message, count); | ||
if (action === ErrorAction.Shutdown) { | ||
@@ -699,2 +700,5 @@ this.logTrace('Connection to server is erroring. Shutting down server.'); | ||
LanguageClient.prototype.checkProcessDied = function (childProcess) { | ||
if (!childProcess) { | ||
return; | ||
} | ||
setTimeout(function () { | ||
@@ -712,3 +716,3 @@ // Test if the process is still alive. Throws an exception if not | ||
var _this = this; | ||
if (!this._languageOptions.synchronize.configurationSection) { | ||
if (!this._clientOptions.synchronize.configurationSection) { | ||
return; | ||
@@ -720,3 +724,3 @@ } | ||
LanguageClient.prototype.onDidChangeConfiguration = function (connection) { | ||
var config = vscode_1.workspace.getConfiguration(this._name.toLowerCase()); | ||
var config = vscode_1.workspace.getConfiguration(this._id.toLowerCase()); | ||
if (config) { | ||
@@ -728,3 +732,3 @@ var trace = config.get('trace.server', 'off'); | ||
var keys = null; | ||
var configurationSection = this._languageOptions.synchronize.configurationSection; | ||
var configurationSection = this._clientOptions.synchronize.configurationSection; | ||
if (is.string(configurationSection)) { | ||
@@ -775,3 +779,3 @@ keys = [configurationSection]; | ||
var _this = this; | ||
var fileEvents = this._languageOptions.synchronize.fileEvents; | ||
var fileEvents = this._clientOptions.synchronize.fileEvents; | ||
if (!fileEvents) { | ||
@@ -806,3 +810,3 @@ return; | ||
LanguageClient.prototype.hookCapabilities = function (connection) { | ||
var documentSelector = this._languageOptions.documentSelector; | ||
var documentSelector = this._clientOptions.documentSelector; | ||
if (!documentSelector) { | ||
@@ -809,0 +813,0 @@ return; |
{ | ||
"name": "vscode-languageclient", | ||
"description": "VSCode Language client implementation", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"author": "Microsoft Corporation", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
141696
3305