typescript-language-server
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -25,2 +25,3 @@ import { LspClient } from './lsp-client'; | ||
constructor(isLogEnabled?: boolean | undefined); | ||
private toStrings(...arg); | ||
error(...arg: any[]): void; | ||
@@ -27,0 +28,0 @@ warn(...arg: any[]): void; |
@@ -19,3 +19,3 @@ "use strict"; | ||
if (typeof p === 'object') { | ||
return JSON.stringify(p); | ||
return JSON.stringify(p, null, 2); | ||
} | ||
@@ -26,3 +26,3 @@ else { | ||
}).join(' '); | ||
this.client.showMessage({ | ||
this.client.logMessage({ | ||
type: severity, | ||
@@ -51,14 +51,17 @@ message: message | ||
} | ||
toStrings(...arg) { | ||
return (arg.map(a => JSON.stringify(a, null, 2))); | ||
} | ||
error(...arg) { | ||
console.error(...arg); | ||
console.error(...this.toStrings(arg)); | ||
} | ||
warn(...arg) { | ||
console.warn(...arg); | ||
console.warn(...this.toStrings(arg)); | ||
} | ||
info(...arg) { | ||
console.info(...arg); | ||
console.info(...this.toStrings(arg)); | ||
} | ||
log(...arg) { | ||
if (this.isLogEnabled) { | ||
console.log(...arg); | ||
console.log(...this.toStrings(arg)); | ||
} | ||
@@ -65,0 +68,0 @@ } |
@@ -5,3 +5,5 @@ import * as lsp from 'vscode-languageserver'; | ||
showMessage(args: lsp.ShowMessageParams): void; | ||
logMessage(args: lsp.LogMessageParams): void; | ||
applyWorkspaceEdit(args: lsp.ApplyWorkspaceEditParams): Promise<lsp.ApplyWorkspaceEditResponse>; | ||
telemetry(args: any): void; | ||
} | ||
@@ -13,3 +15,5 @@ export declare class LspClientImpl implements LspClient { | ||
showMessage(args: lsp.ShowMessageParams): void; | ||
logMessage(args: lsp.LogMessageParams): void; | ||
telemetry(args: any): void; | ||
applyWorkspaceEdit(args: lsp.ApplyWorkspaceEditParams): Promise<lsp.ApplyWorkspaceEditResponse>; | ||
} |
@@ -28,2 +28,8 @@ "use strict"; | ||
} | ||
logMessage(args) { | ||
this.connection.sendNotification(lsp.LogMessageNotification.type, args); | ||
} | ||
telemetry(args) { | ||
this.connection.sendNotification(lsp.TelemetryEventNotification.type, args); | ||
} | ||
applyWorkspaceEdit(args) { | ||
@@ -30,0 +36,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -15,3 +15,3 @@ "use strict"; | ||
if (uri.scheme !== 'file') { | ||
return stringUri; | ||
throw new Error(`The Typescript Language Server only supports file-scheme URIs. Received "${stringUri}"`); | ||
} | ||
@@ -22,5 +22,2 @@ return uri.fsPath; | ||
function pathToUri(p) { | ||
if (p.indexOf(':') !== -1) { | ||
return p; | ||
} | ||
return 'file://' + (utils_1.isWindows() ? '/' + p.replace(/\//g, '/') : p); | ||
@@ -27,0 +24,0 @@ } |
@@ -55,4 +55,5 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const logger = new logger_1.ConsoleLogger(false); | ||
const server = new lsp_server_1.LspServer({ | ||
logger: new logger_1.ConsoleLogger(), | ||
logger, | ||
tsserverPath: 'tsserver', | ||
@@ -65,2 +66,8 @@ tsserverLogFile: path.resolve(__dirname, '../tsserver.log'), | ||
}, | ||
logMessage(args) { | ||
logger.log('logMessage', JSON.stringify(args)); | ||
}, | ||
telemetry(args) { | ||
logger.log('telemetry', JSON.stringify(args)); | ||
}, | ||
applyWorkspaceEdit(args) { | ||
@@ -67,0 +74,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -71,2 +71,3 @@ /** | ||
SementicDiag = "semanticDiag", | ||
Telemetry = "telemetry", | ||
} |
{ | ||
"name": "typescript-language-server", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "Language Server Protocol (LSP) implementation for TypeScript using tsserver", | ||
@@ -32,4 +32,5 @@ "repository": { | ||
"source-map-support": "^0.4.18", | ||
"ts-node": "^5.0.0", | ||
"tslint": "^5.8.0", | ||
"typescript": "2.7.1" | ||
"typescript": "^2.7.2" | ||
}, | ||
@@ -36,0 +37,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
155018
11
57
2092