vscode-languageclient
Advanced tools
Comparing version 2.1.0 to 2.2.0
import * as cp from 'child_process'; | ||
import ChildProcess = cp.ChildProcess; | ||
import { TextDocument, Disposable, FileSystemWatcher, CancellationToken } from 'vscode'; | ||
import { RequestHandler, NotificationHandler, RequestType, NotificationType } from 'vscode-jsonrpc'; | ||
import { RequestHandler, NotificationHandler, RequestType, NotificationType, Trace, Event } from 'vscode-jsonrpc'; | ||
import { Position, Range, Location, TextDocumentIdentifier, TextDocumentPositionParams, TextEdit, TextEditChange, WorkspaceChange, FileEvent } from './protocol'; | ||
@@ -77,2 +77,4 @@ import * as c2p from './codeConverter'; | ||
private _fileEventDelayer; | ||
private _telemetryEmitter; | ||
private _tracer; | ||
constructor(name: string, serverOptions: ServerOptions, languageOptions: LanguageClientOptions, forceDebug?: boolean); | ||
@@ -85,2 +87,5 @@ private computeSyncExpression(); | ||
onRequest<P, R, E>(type: RequestType<P, R, E>, handler: RequestHandler<P, R, E>): void; | ||
onTelemetry: Event<any>; | ||
private outputChannel; | ||
trace: Trace; | ||
needsStart(): boolean; | ||
@@ -87,0 +92,0 @@ needsStop(): boolean; |
@@ -51,2 +51,3 @@ /* -------------------------------------------------------------------------------------------- | ||
onRequest: function (type, handler) { return connection.onRequest(type, handler); }, | ||
trace: function (value, tracer) { return connection.trace(value, tracer); }, | ||
initialize: function (params) { return connection.sendRequest(protocol_1.InitializeRequest.type, params); }, | ||
@@ -57,2 +58,3 @@ shutdown: function () { return connection.sendRequest(protocol_1.ShutdownRequest.type, undefined); }, | ||
onShowMessage: function (handler) { return connection.onNotification(protocol_1.ShowMessageNotification.type, handler); }, | ||
onTelemetry: function (handler) { return connection.onNotification(protocol_1.TelemetryEventNotification.type, handler); }, | ||
didChangeConfiguration: function (params) { return connection.sendNotification(protocol_1.DidChangeConfigurationNotification.type, params); }, | ||
@@ -141,2 +143,13 @@ didChangeWatchedFiles: function (params) { return connection.sendNotification(protocol_1.DidChangeWatchedFilesNotification.type, params); }, | ||
}); | ||
this._onReady.then(null, function () { | ||
// Do nothing for now. We shut down after the initialize. | ||
// However to make the promise reject handler happy we register | ||
// an empty callback. | ||
}); | ||
this._telemetryEmitter = new vscode_jsonrpc_1.Emitter(); | ||
this._tracer = { | ||
log: function (message) { | ||
_this.outputChannel.appendLine(message); | ||
} | ||
}; | ||
} | ||
@@ -208,2 +221,31 @@ LanguageClient.prototype.computeSyncExpression = function () { | ||
}; | ||
Object.defineProperty(LanguageClient.prototype, "onTelemetry", { | ||
get: function () { | ||
return this._telemetryEmitter.event; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(LanguageClient.prototype, "outputChannel", { | ||
get: function () { | ||
if (!this._outputChannel) { | ||
this._outputChannel = vscode_1.window.createOutputChannel(this._name); | ||
} | ||
return this._outputChannel; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(LanguageClient.prototype, "trace", { | ||
set: function (value) { | ||
var _this = this; | ||
this.onReady().then(function () { | ||
_this.resolveConnection().then(function (connection) { | ||
connection.trace(value, _this._tracer); | ||
}); | ||
}); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
LanguageClient.prototype.needsStart = function () { | ||
@@ -277,2 +319,5 @@ return this._state === ClientState.Stopping || this._state === ClientState.Stopped; | ||
}); | ||
connection.onTelemetry(function (data) { | ||
_this._telemetryEmitter.fire(data); | ||
}); | ||
connection.listen(); | ||
@@ -327,4 +372,7 @@ _this.initialize(connection); | ||
else { | ||
if (error.message) { | ||
vscode_1.window.showErrorMessage(error.message); | ||
} | ||
_this.stop(); | ||
_this._onReadyCallbacks.reject(); | ||
vscode_1.window.showErrorMessage(error.message); | ||
} | ||
@@ -471,5 +519,4 @@ }); | ||
if (node_1.transport === TransportKind.ipc) { | ||
_this._outputChannel = vscode_1.window.createOutputChannel(_this._name); | ||
cp.stdout.on('data', function (data) { | ||
_this._outputChannel.append(data.toString()); | ||
_this.outputChannel.append(data.toString()); | ||
}); | ||
@@ -515,2 +562,7 @@ resolve(createConnection(new vscode_jsonrpc_1.IPCMessageReader(_this._childProcess), new vscode_jsonrpc_1.IPCMessageWriter(_this._childProcess))); | ||
LanguageClient.prototype.onDidChangeConfiguration = function (connection) { | ||
var config = vscode_1.workspace.getConfiguration(this._name.toLowerCase()); | ||
if (config) { | ||
var trace = config.get('trace.server', 'off'); | ||
connection.trace(vscode_jsonrpc_1.Trace.fromString(trace), this._tracer); | ||
} | ||
var keys = null; | ||
@@ -543,3 +595,2 @@ var configurationSection = this._languageOptions.synchronize.configurationSection; | ||
} | ||
vscode_1.workspace.getConfiguration(); | ||
var result = Object.create(null); | ||
@@ -546,0 +597,0 @@ for (var i = 0; i < keys.length; i++) { |
@@ -726,2 +726,9 @@ import { RequestType, NotificationType } from 'vscode-jsonrpc'; | ||
/** | ||
* The telemetry event notification is send from the server to the client to ask | ||
* the client to log telemetry data. | ||
*/ | ||
export declare namespace TelemetryEventNotification { | ||
let type: NotificationType<any>; | ||
} | ||
/** | ||
* The parameters send in a open text document notification | ||
@@ -978,3 +985,3 @@ */ | ||
*/ | ||
export declare class CompletionList { | ||
export interface CompletionList { | ||
/** | ||
@@ -981,0 +988,0 @@ * This list it not complete. Further typing should result in recomputing |
@@ -473,3 +473,12 @@ /* -------------------------------------------------------------------------------------------- | ||
})(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {})); | ||
//---- Telemetry notification | ||
/** | ||
* The telemetry event notification is send from the server to the client to ask | ||
* the client to log telemetry data. | ||
*/ | ||
var TelemetryEventNotification; | ||
(function (TelemetryEventNotification) { | ||
TelemetryEventNotification.type = { get method() { return 'telemetry/event'; } }; | ||
})(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {})); | ||
/** | ||
* The document open notification is sent from the client to the server to signal | ||
@@ -587,12 +596,2 @@ * newly opened text documents. The document's truth is now managed by the client | ||
/** | ||
* Represents a collection of [completion items](#CompletionItem) to be presented | ||
* in the editor. | ||
*/ | ||
var CompletionList = (function () { | ||
function CompletionList() { | ||
} | ||
return CompletionList; | ||
}()); | ||
exports.CompletionList = CompletionList; | ||
/** | ||
* The CompletionList namespace provides functions to deal with | ||
@@ -610,3 +609,3 @@ * completion lists. | ||
function create(items, isIncomplete) { | ||
return { items: items, isIncomplete: isIncomplete }; | ||
return { items: items ? items : [], isIncomplete: !!isIncomplete }; | ||
} | ||
@@ -613,0 +612,0 @@ CompletionList.create = create; |
{ | ||
"name": "vscode-languageclient", | ||
"description": "VSCode Language client implementation", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"author": "Microsoft Corporation", | ||
@@ -24,3 +24,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"vscode-jsonrpc": "^2.0.0" | ||
"vscode-jsonrpc": "^2.1.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "scripts": { |
178153
4501
Updatedvscode-jsonrpc@^2.1.0