vscode-languageclient
Advanced tools
Comparing version 0.10.0-pre.25 to 0.10.0
import * as vs from 'vscode'; | ||
import { DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, Diagnostic, Position, Range, TextDocumentPosition, Hover, CompletionItem, TextEdit, SignatureHelp, SignatureInformation, ParameterInformation } from './protocol'; | ||
import { DidOpenTextDocumentParams, DidChangeTextDocumentParams, TextDocumentIdentifier, Diagnostic, Position, Range, TextDocumentPosition, Hover, CompletionItem, TextEdit, SignatureHelp, SignatureInformation, ParameterInformation } from './protocol'; | ||
export declare function asOpenTextDocumentParams(textDocument: vs.TextDocument): DidOpenTextDocumentParams; | ||
export declare function asChangeTextDocumentParams(textDocument: vs.TextDocument): DidChangeTextDocumentParams; | ||
export declare function asChangeTextDocumentParams(event: vs.TextDocumentChangeEvent): DidChangeTextDocumentParams[]; | ||
export declare function asCloseTextDocumentParams(textDocument: vs.TextDocument): DidCloseTextDocumentParams; | ||
export declare function asCloseTextDocumentParams(textDocument: vs.TextDocument): TextDocumentIdentifier; | ||
export declare function asTextDocumentPosition(textDocument: vs.TextDocument, position: vs.Position): TextDocumentPosition; | ||
export declare function asWorkerPosition(position: vs.Position): Position; | ||
export declare function asDiagnostics(diagnostics: Diagnostic[]): vs.Diagnostic[]; | ||
export declare function asRange(value: Diagnostic | Range): vs.Range; | ||
export declare function asRange(value: Range): vs.Range; | ||
export declare function asPosition(value: Position): vs.Position; | ||
export declare function asDiagnosticSeverity(value: number): vs.DiagnosticSeverity; | ||
@@ -12,0 +13,0 @@ export declare function asHover(hover: Hover): vs.Hover; |
@@ -63,3 +63,3 @@ /*--------------------------------------------------------- | ||
function asDiagnostics(diagnostics) { | ||
return diagnostics.map(function (diagnostic) { return new vs.Diagnostic(asRange(diagnostic), diagnostic.message, asDiagnosticSeverity(diagnostic.severity)); }); | ||
return diagnostics.map(function (diagnostic) { return new vs.Diagnostic(asRange(diagnostic.range), diagnostic.message, asDiagnosticSeverity(diagnostic.severity)); }); | ||
} | ||
@@ -74,19 +74,24 @@ exports.asDiagnostics = asDiagnostics; | ||
} | ||
if (value.end) { | ||
return new vs.Range(value.start.line, value.start.character, value.end.line, value.end.character); | ||
return new vs.Range(asPosition(value.start), asPosition(value.end)); | ||
} | ||
exports.asRange = asRange; | ||
function asPosition(value) { | ||
if (is.undefined(value)) { | ||
return undefined; | ||
} | ||
else { | ||
return new vs.Range(value.start.line, value.start.character, value.start.line, value.start.character); | ||
else if (is.nil(value)) { | ||
return null; | ||
} | ||
return new vs.Position(value.line, value.character); | ||
} | ||
exports.asRange = asRange; | ||
exports.asPosition = asPosition; | ||
function asDiagnosticSeverity(value) { | ||
switch (value) { | ||
case protocol_1.Severity.Error: | ||
case protocol_1.DiagnosticSeverity.Error: | ||
return vs.DiagnosticSeverity.Error; | ||
case protocol_1.Severity.Warning: | ||
case protocol_1.DiagnosticSeverity.Warning: | ||
return vs.DiagnosticSeverity.Warning; | ||
case protocol_1.Severity.Information: | ||
case protocol_1.DiagnosticSeverity.Information: | ||
return vs.DiagnosticSeverity.Information; | ||
case protocol_1.Severity.Hint: | ||
case protocol_1.DiagnosticSeverity.Hint: | ||
return vs.DiagnosticSeverity.Hint; | ||
@@ -93,0 +98,0 @@ } |
@@ -64,4 +64,5 @@ import * as cp from 'child_process'; | ||
private _syncExpression; | ||
private _documentSyncDelayer; | ||
private _fileEvents; | ||
private _delayer; | ||
private _fileEventDelayer; | ||
constructor(name: string, serverOptions: ServerOptions, languageOptions: LanguageClientOptions, forceDebug?: boolean); | ||
@@ -85,2 +86,3 @@ private computeSyncExpression(); | ||
private onDidCloseTextDoument(connection, textDocument); | ||
private forceDocumentSync(); | ||
private handleDiagnostics(params); | ||
@@ -87,0 +89,0 @@ private createConnection(); |
@@ -40,4 +40,4 @@ /*--------------------------------------------------------- | ||
initialize: function (params) { return connection.sendRequest(protocol_1.InitializeRequest.type, params); }, | ||
shutdown: function (params) { return connection.sendRequest(protocol_1.ShutdownRequest.type, params); }, | ||
exit: function (params) { return connection.sendNotification(protocol_1.ExitNotification.type, params); }, | ||
shutdown: function () { return connection.sendRequest(protocol_1.ShutdownRequest.type); }, | ||
exit: function () { return connection.sendNotification(protocol_1.ExitNotification.type); }, | ||
onLogMessage: function (handler) { return connection.onNotification(protocol_1.LogMessageNotification.type, handler); }, | ||
@@ -117,3 +117,3 @@ onShowMessage: function (handler) { return connection.onNotification(protocol_1.ShowMessageNotification.type, handler); }, | ||
this._fileEvents = []; | ||
this._delayer = new async_1.Delayer(250); | ||
this._fileEventDelayer = new async_1.Delayer(250); | ||
this._onReady = new Promise(function (resolve, reject) { | ||
@@ -149,2 +149,3 @@ _this._onReadyCallbacks = { resolve: resolve, reject: reject }; | ||
if (_this.isConnectionActive()) { | ||
_this.forceDocumentSync(); | ||
return connection.sendRequest(type, params); | ||
@@ -163,2 +164,3 @@ } | ||
if (_this.isConnectionActive()) { | ||
_this.forceDocumentSync(); | ||
connection.sendNotification(type, params); | ||
@@ -246,3 +248,3 @@ } | ||
var _this = this; | ||
var initParams = { rootFolder: vscode_1.workspace.rootPath, capabilities: {} }; | ||
var initParams = { rootPath: vscode_1.workspace.rootPath, capabilities: {} }; | ||
return connection.initialize(initParams).then(function (result) { | ||
@@ -256,2 +258,5 @@ _this._state = ClientState.Running; | ||
vscode_1.workspace.onDidCloseTextDocument(function (t) { return _this.onDidCloseTextDoument(connection, t); }, null, _this._listeners); | ||
if (_this._capabilites.textDocumentSync === protocol_1.TextDocumentSyncKind.Full) { | ||
_this._documentSyncDelayer = new async_1.Delayer(100); | ||
} | ||
} | ||
@@ -293,4 +298,4 @@ _this.hookFileEvents(connection); | ||
this.resolveConnection().then(function (connection) { | ||
connection.shutdown({}).then(function () { | ||
connection.exit({}); | ||
connection.shutdown().then(function () { | ||
connection.exit(); | ||
connection.dispose(); | ||
@@ -321,3 +326,3 @@ _this._state = ClientState.Stopped; | ||
this._fileEvents.push(event); | ||
this._delayer.trigger(function () { | ||
this._fileEventDelayer.trigger(function () { | ||
_this.onReady().then(function () { | ||
@@ -345,6 +350,8 @@ _this.resolveConnection().then(function (connection) { | ||
if (this._capabilites.textDocumentSync === protocol_1.TextDocumentSyncKind.Incremental) { | ||
converters_1.asChangeTextDocumentParams(event).forEach(function (param) { return connection.didChangeTextDocument(param); }); | ||
connection.didChangeTextDocument(converters_1.asChangeTextDocumentParams(event)); | ||
} | ||
else { | ||
connection.didChangeTextDocument(converters_1.asChangeTextDocumentParams(event.document)); | ||
this._documentSyncDelayer.trigger(function () { | ||
connection.didChangeTextDocument(converters_1.asChangeTextDocumentParams(event.document)); | ||
}, -1); | ||
} | ||
@@ -358,2 +365,7 @@ }; | ||
}; | ||
LanguageClient.prototype.forceDocumentSync = function () { | ||
if (this._documentSyncDelayer) { | ||
this._documentSyncDelayer.forceDelivery(); | ||
} | ||
}; | ||
LanguageClient.prototype.handleDiagnostics = function (params) { | ||
@@ -528,2 +540,3 @@ var uri = vscode_1.Uri.parse(params.uri); | ||
if (_this.isConnectionActive()) { | ||
_this.forceDocumentSync(); | ||
return connection.sendRequest(protocol_1.HoverRequest.type, converters_1.asTextDocumentPosition(document, position)).then(function (result) { | ||
@@ -543,2 +556,3 @@ return converters_1.asHover(result); | ||
if (_this.isConnectionActive()) { | ||
_this.forceDocumentSync(); | ||
return connection.sendRequest(protocol_1.CompletionRequest.type, converters_1.asTextDocumentPosition(document, position)).then(function (result) { | ||
@@ -555,2 +569,3 @@ return converters_1.asCompletionItems(result); | ||
if (_this.isConnectionActive()) { | ||
_this.forceDocumentSync(); | ||
return connection.sendRequest(protocol_1.CompletionResolveRequest.type, item).then(function (result) { | ||
@@ -571,2 +586,3 @@ return converters_1.asCompletionItem(result); | ||
if (_this.isConnectionActive()) { | ||
_this.forceDocumentSync(); | ||
return connection.sendRequest(protocol_1.SignatureHelpRequest.type, converters_1.asTextDocumentPosition(document, position)).then(function (result) { | ||
@@ -573,0 +589,0 @@ return converters_1.asSignatureHelp(result); |
import { RequestType, NotificationType } from 'vscode-jsonrpc'; | ||
export interface HostCapabilities { | ||
/** | ||
* Defines the capabilities provided by the client. | ||
*/ | ||
export interface ClientCapabilities { | ||
} | ||
/** | ||
* Defines how the host (editor) should sync | ||
* document changes to the language server. | ||
*/ | ||
export declare enum TextDocumentSyncKind { | ||
/** | ||
* Documents should not be synced at all. | ||
*/ | ||
None = 0, | ||
/** | ||
* Documents are synced by always sending the full content | ||
* of the document. | ||
*/ | ||
Full = 1, | ||
/** | ||
* Documents are synced by sending the full content on open. | ||
* After that only incremental updates to the document are | ||
* send. | ||
*/ | ||
Incremental = 2, | ||
} | ||
/** | ||
* Completion options | ||
*/ | ||
export interface CompletionOptions { | ||
/** | ||
* The server provides support to resolve additional | ||
* information for a completion item. | ||
*/ | ||
resolveProvider?: boolean; | ||
/** | ||
* The characters that trigger completion automatically. | ||
*/ | ||
triggerCharacters?: string[]; | ||
} | ||
/** | ||
* Signature help options | ||
*/ | ||
export interface SignatureHelpOptions { | ||
/** | ||
* The characters that trigger signature help | ||
* automatically. | ||
*/ | ||
triggerCharacters?: string[]; | ||
} | ||
/** | ||
* Defines the capabilities provided by the language | ||
* server | ||
*/ | ||
export interface ServerCapabilities { | ||
/** Defines how text documents are synced. */ | ||
textDocumentSync?: number; | ||
/** The server provides hover support. */ | ||
hoverProvider?: boolean; | ||
/** The server provides completion support. */ | ||
completionProvider?: CompletionOptions; | ||
/** The server provides signature help support. */ | ||
signatureHelpProvider?: SignatureHelpOptions; | ||
} | ||
/** | ||
* The initialize command is send from the client to the worker. | ||
* It is send once as the first command after starting up the | ||
* The initialize method is sent from the client to the server. | ||
* It is send once as the first method after starting up the | ||
* worker. | ||
@@ -30,37 +74,56 @@ */ | ||
} | ||
/** | ||
* The initialize parameters | ||
*/ | ||
export interface InitializeParams { | ||
rootFolder: string; | ||
capabilities: HostCapabilities; | ||
/** | ||
* The rootPath of the workspace. Is null | ||
* if no folder is open. | ||
*/ | ||
rootPath: string; | ||
/** | ||
* The capabilities provided by the client (editor) | ||
*/ | ||
capabilities: ClientCapabilities; | ||
} | ||
/** | ||
* The result returned from an initilize request. | ||
*/ | ||
export interface InitializeResult { | ||
/** | ||
* The capabilities the language server provides. | ||
*/ | ||
capabilities: ServerCapabilities; | ||
} | ||
/** | ||
* The error returned if the initilize request fails. | ||
*/ | ||
export interface InitializeError { | ||
/** | ||
* Indicates whether the client should retry to send the | ||
* initilize request after showing the message provided | ||
* in the {@link ResponseError} | ||
*/ | ||
retry: boolean; | ||
} | ||
/** | ||
* The shutdown command is send from the client to the worker. | ||
* A shutdown request is sent from the client to the server. | ||
* It is send once when the client descides to shutdown the | ||
* worker. The only event that is send after a shudown request | ||
* server. The only event that is sent after a shudown request | ||
* is the exit event. | ||
*/ | ||
export declare namespace ShutdownRequest { | ||
const type: RequestType<ShutdownParams, void, void>; | ||
const type: RequestType<void, void, void>; | ||
} | ||
export interface ShutdownParams { | ||
} | ||
/** | ||
* The exit event is send from the client to the worker to | ||
* ask the worker to exit its process. | ||
* The exit event is sent from the client to the server to | ||
* ask the server to exit its process. | ||
*/ | ||
export declare namespace ExitNotification { | ||
const type: NotificationType<ExitParams>; | ||
const type: NotificationType<void>; | ||
} | ||
export interface ExitParams { | ||
} | ||
/** | ||
* The configuration change event is send from the client to the worker | ||
* when the client's configuration has changed. The event contains | ||
* the changed configuration as defined by the language worker statically | ||
* in it's extension manifest. | ||
* The configuration change notification is sent from the client to the server | ||
* when the client's configuration has changed. The notification contains | ||
* the changed configuration as defined by the language client. | ||
*/ | ||
@@ -70,14 +133,27 @@ export declare namespace DidChangeConfigurationNotification { | ||
} | ||
/** | ||
* The parameters of a change configuration notification. | ||
*/ | ||
export interface DidChangeConfigurationParams { | ||
/** | ||
* The actual changed settings | ||
*/ | ||
settings: any; | ||
} | ||
/** | ||
* The message type | ||
*/ | ||
export declare enum MessageType { | ||
/** An error message. */ | ||
Error = 1, | ||
/** A warning message. */ | ||
Warning = 2, | ||
/** An information message. */ | ||
Info = 3, | ||
/** A log message. */ | ||
Log = 4, | ||
} | ||
/** | ||
* The show message event is send from a worker to a client to ask | ||
* the client to display a particular message in the user interface | ||
* The show message notification is sent from a server to a client to ask | ||
* the client to display a particular message in the user interface. | ||
*/ | ||
@@ -87,23 +163,45 @@ export declare namespace ShowMessageNotification { | ||
} | ||
/** | ||
* The parameters of a notification message. | ||
*/ | ||
export interface ShowMessageParams { | ||
/** | ||
* The message type. See {@link MessageType} | ||
*/ | ||
type: number; | ||
/** | ||
* The actual message | ||
*/ | ||
message: string; | ||
} | ||
/** | ||
* The log message notification is send from the server to the client to ask | ||
* the client to log a particular message. | ||
*/ | ||
export declare namespace LogMessageNotification { | ||
let type: NotificationType<LogMessageParams>; | ||
} | ||
/** | ||
* The log message parameters. | ||
*/ | ||
export interface LogMessageParams { | ||
/** | ||
* The message type. See {@link MessageType} | ||
*/ | ||
type: number; | ||
/** | ||
* The actual message | ||
*/ | ||
message: string; | ||
} | ||
/** | ||
* Position in a text document expressed as (zero-based) line and character offset. | ||
* Position in a text document expressed as zero-based line and character offset. | ||
*/ | ||
export interface Position { | ||
/** | ||
* Line Position in a document (zero-based) | ||
* Line position in a document (zero-based). | ||
*/ | ||
line: number; | ||
/** | ||
* Character offset on a line in a document (zero-based) | ||
* Character offset on a line in a document (zero-based). | ||
*/ | ||
@@ -113,3 +211,3 @@ character: number; | ||
/** | ||
* A range in a text document. | ||
* A range in a text document expressed as (zero-based) start and end positions. | ||
*/ | ||
@@ -126,8 +224,14 @@ export interface Range { | ||
} | ||
/** | ||
* A literal to identify a text document in the client. | ||
*/ | ||
export interface TextDocumentIdentifier { | ||
/** | ||
* A URI identifying the resource in the client. | ||
* The text document's uri. | ||
*/ | ||
uri: string; | ||
} | ||
/** | ||
* A literal to define the position in a text document. | ||
*/ | ||
export interface TextDocumentPosition extends TextDocumentIdentifier { | ||
@@ -140,4 +244,6 @@ /** | ||
/** | ||
* The document event is send from the client to the worker to signal | ||
* newly opened, changed and closed documents. | ||
* The document open notification is sent from the client to the server to signal | ||
* newly opened text documents. The document's truth is now managed by the client | ||
* and the server must not try to read the document's truth using the document's | ||
* uri. | ||
*/ | ||
@@ -147,10 +253,18 @@ export declare namespace DidOpenTextDocumentNotification { | ||
} | ||
/** | ||
* The parameters send in a open text document notification | ||
*/ | ||
export interface DidOpenTextDocumentParams extends TextDocumentIdentifier { | ||
/** | ||
* The content of the opened document. | ||
* The content of the opened text document. | ||
*/ | ||
text: string; | ||
} | ||
/** | ||
* The document change notification is sent from the client to the server to signal | ||
* changes to a text document. The notification's parameters are either a single | ||
* {@link DidChangeTextDocumentParams} or an array of {@link DidChangeTextDocumentParams}. | ||
*/ | ||
export declare namespace DidChangeTextDocumentNotification { | ||
const type: NotificationType<DidChangeTextDocumentParams>; | ||
const type: NotificationType<DidChangeTextDocumentParams | DidChangeTextDocumentParams[]>; | ||
} | ||
@@ -175,25 +289,50 @@ /** | ||
} | ||
/** | ||
* The document close notification is sent from the client to the server when | ||
* the document got closed in the client. The document's truth now exists | ||
* where the document's uri points to (e.g. if the document's uri is a file uri | ||
* the truth now exists on disk). | ||
*/ | ||
export declare namespace DidCloseTextDocumentNotification { | ||
const type: NotificationType<DidCloseTextDocumentParams>; | ||
const type: NotificationType<TextDocumentIdentifier>; | ||
} | ||
export interface DidCloseTextDocumentParams extends TextDocumentIdentifier { | ||
} | ||
/** | ||
* The watched files notification is sent from the client to the server when | ||
* the client detects changes to file watched by the lanaguage client. | ||
*/ | ||
export declare namespace DidChangeWatchedFilesNotification { | ||
const type: NotificationType<DidChangeWatchedFilesParams>; | ||
} | ||
/** | ||
* The watched files change notification's parameters. | ||
*/ | ||
export interface DidChangeWatchedFilesParams { | ||
/** | ||
* The actual file events. | ||
*/ | ||
changes: FileEvent[]; | ||
} | ||
/** | ||
* The file event type | ||
*/ | ||
export declare enum FileChangeType { | ||
/** The file got created. */ | ||
Created = 1, | ||
/** The file got changed. */ | ||
Changed = 2, | ||
/** The file got deleted. */ | ||
Deleted = 3, | ||
} | ||
/** | ||
* An event describing a file change. | ||
*/ | ||
export interface FileEvent { | ||
/** The file's uri. */ | ||
uri: string; | ||
/** teh change type. */ | ||
type: number; | ||
} | ||
/** | ||
* Diagnostics notification are send from the worker to clients to signal | ||
* results of validation runs | ||
* Diagnostics notification are sent from the server to the client to signal | ||
* results of validation runs. | ||
*/ | ||
@@ -203,2 +342,5 @@ export declare namespace PublishDiagnosticsNotification { | ||
} | ||
/** | ||
* The publish diagnostic notification's parameters. | ||
*/ | ||
export interface PublishDiagnosticsParams { | ||
@@ -214,29 +356,32 @@ /** | ||
} | ||
export declare enum Severity { | ||
/** | ||
* The diagnostic's serverity. | ||
*/ | ||
export declare enum DiagnosticSeverity { | ||
/** Reports an error. */ | ||
Error = 0, | ||
/** Reports a warning. */ | ||
Warning = 1, | ||
/** Reports an information. */ | ||
Information = 2, | ||
/** Reports a hint. */ | ||
Hint = 3, | ||
} | ||
/** | ||
* Item of diagnostic information found in a DiagnosticEvent message. | ||
* A diagnostic item found in a diagnostic notification. | ||
*/ | ||
export interface Diagnostic { | ||
/** | ||
* Starting position at which text appies. | ||
* The range at which the message applies | ||
*/ | ||
start: Position; | ||
range: Range; | ||
/** | ||
* The last position at which the text applies. Can be omitted. | ||
*/ | ||
end?: Position; | ||
/** | ||
* The diagnostic's severity. Can be omitted. If omitted it is up to the | ||
* client to interpret diagnostics as error, warning or info. | ||
* client to interpret diagnostics as error, warning, info or hint. | ||
*/ | ||
severity?: number; | ||
/** | ||
* The diagnostic code. Can be omitted. | ||
* The diagnostic's code. Can be omitted. | ||
*/ | ||
code?: string; | ||
code?: number | string; | ||
/** | ||
@@ -243,0 +388,0 @@ * The diagnostic message. |
@@ -5,11 +5,28 @@ /*--------------------------------------------------------- | ||
'use strict'; | ||
/** | ||
* Defines how the host (editor) should sync | ||
* document changes to the language server. | ||
*/ | ||
(function (TextDocumentSyncKind) { | ||
/** | ||
* Documents should not be synced at all. | ||
*/ | ||
TextDocumentSyncKind[TextDocumentSyncKind["None"] = 0] = "None"; | ||
/** | ||
* Documents are synced by always sending the full content | ||
* of the document. | ||
*/ | ||
TextDocumentSyncKind[TextDocumentSyncKind["Full"] = 1] = "Full"; | ||
/** | ||
* Documents are synced by sending the full content on open. | ||
* After that only incremental updates to the document are | ||
* send. | ||
*/ | ||
TextDocumentSyncKind[TextDocumentSyncKind["Incremental"] = 2] = "Incremental"; | ||
})(exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {})); | ||
var TextDocumentSyncKind = exports.TextDocumentSyncKind; | ||
//---- Initialize Method ---- | ||
/** | ||
* The initialize command is send from the client to the worker. | ||
* It is send once as the first command after starting up the | ||
* The initialize method is sent from the client to the server. | ||
* It is send once as the first method after starting up the | ||
* worker. | ||
@@ -19,8 +36,9 @@ */ | ||
(function (InitializeRequest) { | ||
InitializeRequest.type = { method: 'initialize' }; | ||
InitializeRequest.type = { get method() { return 'initialize'; } }; | ||
})(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {})); | ||
//---- Shutdown Method ---- | ||
/** | ||
* The shutdown command is send from the client to the worker. | ||
* A shutdown request is sent from the client to the server. | ||
* It is send once when the client descides to shutdown the | ||
* worker. The only event that is send after a shudown request | ||
* server. The only event that is sent after a shudown request | ||
* is the exit event. | ||
@@ -30,26 +48,35 @@ */ | ||
(function (ShutdownRequest) { | ||
ShutdownRequest.type = { method: 'shutdown' }; | ||
ShutdownRequest.type = { get method() { return 'shutdown'; } }; | ||
})(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {})); | ||
//---- Exit Notification ---- | ||
/** | ||
* The exit event is send from the client to the worker to | ||
* ask the worker to exit its process. | ||
* The exit event is sent from the client to the server to | ||
* ask the server to exit its process. | ||
*/ | ||
var ExitNotification; | ||
(function (ExitNotification) { | ||
ExitNotification.type = { method: 'exit' }; | ||
ExitNotification.type = { get method() { return 'exit'; } }; | ||
})(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {})); | ||
//---- Configuration notification ---- | ||
/** | ||
* The configuration change event is send from the client to the worker | ||
* when the client's configuration has changed. The event contains | ||
* the changed configuration as defined by the language worker statically | ||
* in it's extension manifest. | ||
* The configuration change notification is sent from the client to the server | ||
* when the client's configuration has changed. The notification contains | ||
* the changed configuration as defined by the language client. | ||
*/ | ||
var DidChangeConfigurationNotification; | ||
(function (DidChangeConfigurationNotification) { | ||
DidChangeConfigurationNotification.type = { method: 'workspace/didChangeConfiguration' }; | ||
DidChangeConfigurationNotification.type = { get method() { return 'workspace/didChangeConfiguration'; } }; | ||
})(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {})); | ||
//---- Message show and log notifications ---- | ||
/** | ||
* The message type | ||
*/ | ||
(function (MessageType) { | ||
/** An error message. */ | ||
MessageType[MessageType["Error"] = 1] = "Error"; | ||
/** A warning message. */ | ||
MessageType[MessageType["Warning"] = 2] = "Warning"; | ||
/** An information message. */ | ||
MessageType[MessageType["Info"] = 3] = "Info"; | ||
/** A log message. */ | ||
MessageType[MessageType["Log"] = 4] = "Log"; | ||
@@ -59,42 +86,71 @@ })(exports.MessageType || (exports.MessageType = {})); | ||
/** | ||
* The show message event is send from a worker to a client to ask | ||
* the client to display a particular message in the user interface | ||
* The show message notification is sent from a server to a client to ask | ||
* the client to display a particular message in the user interface. | ||
*/ | ||
var ShowMessageNotification; | ||
(function (ShowMessageNotification) { | ||
ShowMessageNotification.type = { method: 'window/showMessage' }; | ||
ShowMessageNotification.type = { get method() { return 'window/showMessage'; } }; | ||
})(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {})); | ||
/** | ||
* The log message notification is send from the server to the client to ask | ||
* the client to log a particular message. | ||
*/ | ||
var LogMessageNotification; | ||
(function (LogMessageNotification) { | ||
LogMessageNotification.type = { method: 'window/logMessage' }; | ||
LogMessageNotification.type = { get method() { return 'window/logMessage'; } }; | ||
})(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {})); | ||
/** | ||
* The document event is send from the client to the worker to signal | ||
* newly opened, changed and closed documents. | ||
* The document open notification is sent from the client to the server to signal | ||
* newly opened text documents. The document's truth is now managed by the client | ||
* and the server must not try to read the document's truth using the document's | ||
* uri. | ||
*/ | ||
var DidOpenTextDocumentNotification; | ||
(function (DidOpenTextDocumentNotification) { | ||
DidOpenTextDocumentNotification.type = { method: 'textDocument/didOpen' }; | ||
DidOpenTextDocumentNotification.type = { get method() { return 'textDocument/didOpen'; } }; | ||
})(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {})); | ||
/** | ||
* The document change notification is sent from the client to the server to signal | ||
* changes to a text document. The notification's parameters are either a single | ||
* {@link DidChangeTextDocumentParams} or an array of {@link DidChangeTextDocumentParams}. | ||
*/ | ||
var DidChangeTextDocumentNotification; | ||
(function (DidChangeTextDocumentNotification) { | ||
DidChangeTextDocumentNotification.type = { method: 'textDocument/didChange' }; | ||
DidChangeTextDocumentNotification.type = { get method() { return 'textDocument/didChange'; } }; | ||
})(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {})); | ||
/** | ||
* The document close notification is sent from the client to the server when | ||
* the document got closed in the client. The document's truth now exists | ||
* where the document's uri points to (e.g. if the document's uri is a file uri | ||
* the truth now exists on disk). | ||
*/ | ||
var DidCloseTextDocumentNotification; | ||
(function (DidCloseTextDocumentNotification) { | ||
DidCloseTextDocumentNotification.type = { method: 'textDocument/didClose' }; | ||
DidCloseTextDocumentNotification.type = { get method() { return 'textDocument/didClose'; } }; | ||
})(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {})); | ||
//---- File eventing ---- | ||
/** | ||
* The watched files notification is sent from the client to the server when | ||
* the client detects changes to file watched by the lanaguage client. | ||
*/ | ||
var DidChangeWatchedFilesNotification; | ||
(function (DidChangeWatchedFilesNotification) { | ||
DidChangeWatchedFilesNotification.type = { method: 'workspace/didChangeFiles' }; | ||
DidChangeWatchedFilesNotification.type = { get method() { return 'workspace/didChangeWatchedFiles'; } }; | ||
})(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {})); | ||
/** | ||
* The file event type | ||
*/ | ||
(function (FileChangeType) { | ||
/** The file got created. */ | ||
FileChangeType[FileChangeType["Created"] = 1] = "Created"; | ||
/** The file got changed. */ | ||
FileChangeType[FileChangeType["Changed"] = 2] = "Changed"; | ||
/** The file got deleted. */ | ||
FileChangeType[FileChangeType["Deleted"] = 3] = "Deleted"; | ||
})(exports.FileChangeType || (exports.FileChangeType = {})); | ||
var FileChangeType = exports.FileChangeType; | ||
//---- Diagnostic notification ---- | ||
/** | ||
* Diagnostics notification are send from the worker to clients to signal | ||
* results of validation runs | ||
* Diagnostics notification are sent from the server to the client to signal | ||
* results of validation runs. | ||
*/ | ||
@@ -105,9 +161,16 @@ var PublishDiagnosticsNotification; | ||
})(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {})); | ||
(function (Severity) { | ||
Severity[Severity["Error"] = 0] = "Error"; | ||
Severity[Severity["Warning"] = 1] = "Warning"; | ||
Severity[Severity["Information"] = 2] = "Information"; | ||
Severity[Severity["Hint"] = 3] = "Hint"; | ||
})(exports.Severity || (exports.Severity = {})); | ||
var Severity = exports.Severity; | ||
/** | ||
* The diagnostic's serverity. | ||
*/ | ||
(function (DiagnosticSeverity) { | ||
/** Reports an error. */ | ||
DiagnosticSeverity[DiagnosticSeverity["Error"] = 0] = "Error"; | ||
/** Reports a warning. */ | ||
DiagnosticSeverity[DiagnosticSeverity["Warning"] = 1] = "Warning"; | ||
/** Reports an information. */ | ||
DiagnosticSeverity[DiagnosticSeverity["Information"] = 2] = "Information"; | ||
/** Reports a hint. */ | ||
DiagnosticSeverity[DiagnosticSeverity["Hint"] = 3] = "Hint"; | ||
})(exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {})); | ||
var DiagnosticSeverity = exports.DiagnosticSeverity; | ||
//---- Completion Support -------------------------- | ||
@@ -114,0 +177,0 @@ (function (CompletionItemKind) { |
@@ -12,2 +12,3 @@ export interface ITask<T> { | ||
trigger(task: ITask<T>, delay?: number): Promise<T>; | ||
forceDelivery(): Promise<T>; | ||
isTriggered(): boolean; | ||
@@ -14,0 +15,0 @@ cancel(): void; |
@@ -17,3 +17,5 @@ /*--------------------------------------------------------- | ||
this.task = task; | ||
this.cancelTimeout(); | ||
if (delay >= 0) { | ||
this.cancelTimeout(); | ||
} | ||
if (!this.completionPromise) { | ||
@@ -30,8 +32,19 @@ this.completionPromise = new Promise(function (resolve) { | ||
} | ||
this.timeout = setTimeout(function () { | ||
_this.timeout = null; | ||
_this.onSuccess(null); | ||
}, delay); | ||
if (delay >= 0 || this.timeout === null) { | ||
this.timeout = setTimeout(function () { | ||
_this.timeout = null; | ||
_this.onSuccess(null); | ||
}, delay >= 0 ? delay : this.defaultDelay); | ||
} | ||
return this.completionPromise; | ||
}; | ||
Delayer.prototype.forceDelivery = function () { | ||
if (!this.completionPromise) { | ||
return null; | ||
} | ||
this.cancelTimeout(); | ||
var result = this.completionPromise; | ||
this.onSuccess(null); | ||
return result; | ||
}; | ||
Delayer.prototype.isTriggered = function () { | ||
@@ -38,0 +51,0 @@ return this.timeout !== null; |
{ | ||
"name": "vscode-languageclient", | ||
"description": "VSCode Language client implementation", | ||
"version": "0.10.0-pre.25", | ||
"author": "Visual Studio Code Team", | ||
"version": "0.10.0", | ||
"author": "Microsoft Corporation", | ||
"license": "MIT", | ||
"engines": { | ||
"vscode": "*" | ||
"vscode": "0.10.x" | ||
}, | ||
@@ -22,6 +22,6 @@ "repository": { | ||
"typescript": "^1.6.2", | ||
"vscode": "next" | ||
"vscode": "0.10.x" | ||
}, | ||
"dependencies": { | ||
"vscode-jsonrpc": "next" | ||
"vscode-jsonrpc": "0.10.x" | ||
}, | ||
@@ -28,0 +28,0 @@ "scripts": { |
83322
2045
+ Addedvscode-jsonrpc@0.10.1(transitive)
- Removedvscode-jsonrpc@9.0.0-next.7(transitive)
Updatedvscode-jsonrpc@0.10.x