From c16e21dd0609fe7d08ac94dfea9f92ff31c75ef4 Mon Sep 17 00:00:00 2001 From: Jasper Poppe <jgpoppe@gmail.com> Date: Tue, 12 Feb 2019 18:37:31 +0100 Subject: [PATCH 1/2] fixed typo: getDignosticsKind -> getDiagnosticsKind --- src/server/typescriptServiceClient.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/typescriptServiceClient.ts b/src/server/typescriptServiceClient.ts index 96ed13d..f257b31 100644 --- a/src/server/typescriptServiceClient.ts +++ b/src/server/typescriptServiceClient.ts @@ -692,7 +692,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient const diagnosticEvent = event as Proto.DiagnosticEvent if (diagnosticEvent.body && diagnosticEvent.body.diagnostics) { this._onDiagnosticsReceived.fire({ - kind: getDignosticsKind(event), + kind: getDiagnosticsKind(event), resource: this.asUrl(diagnosticEvent.body.file), diagnostics: diagnosticEvent.body.diagnostics }) @@ -821,7 +821,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient } } -function getDignosticsKind(event: Proto.Event): DiagnosticKind { +function getDiagnosticsKind(event: Proto.Event): DiagnosticKind { switch (event.event) { case 'syntaxDiag': return DiagnosticKind.Syntax From be81ec4e6bb27e2c1914f3c75d7e209c442f555c Mon Sep 17 00:00:00 2001 From: Jasper Poppe <jgpoppe@gmail.com> Date: Wed, 13 Feb 2019 09:56:41 +0100 Subject: [PATCH 2/2] bug fix: workspace.cwd -> workspace.root in getProjectRootPath() I think workspace.cwd should become workspace.root, this fixes the tsserver behaviour in my projects (where I use paths, etc in my tsconfig.json), without this the getProjectRootPath method returns the 'source file' path . Please correct me if I am wrong, I am still new to the code base and this took me hours to figure out ;) --- src/server/typescriptServiceClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/typescriptServiceClient.ts b/src/server/typescriptServiceClient.ts index f257b31..7d7faf0 100644 --- a/src/server/typescriptServiceClient.ts +++ b/src/server/typescriptServiceClient.ts @@ -815,7 +815,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient public getProjectRootPath(uri: string): string { let u = Uri.parse(uri) if (u.scheme != 'file') return workspace.cwd - if (u.fsPath.startsWith(workspace.root) && workspace.root != os.homedir()) return workspace.cwd + if (u.fsPath.startsWith(workspace.root) && workspace.root != os.homedir()) return workspace.root let res = findUp.sync(['tsconfig.json', 'jsconfig.json'], { cwd: path.dirname(u.fsPath) }) return res ? path.dirname(res) : workspace.cwd }