From fc3002d956f07b1bc0505ad1f0ec5a56ca0ab5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Fri, 18 May 2018 14:33:33 +0200 Subject: [PATCH 1/4] fix(plugins): add missing project method in fact, many other methods have to be set there, since Project implements LanguageServiceHost. --- src/plugins.ts | 1 + src/project-manager.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins.ts b/src/plugins.ts index bed3e977e..912b25847 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -40,6 +40,7 @@ export interface PluginCreateInfo { * The portion of tsserver's Project API exposed to plugins */ export interface Project { + getCurrentDirectory: () => string, projectService: { logger: Logger } diff --git a/src/project-manager.ts b/src/project-manager.ts index c47e06446..1c0336a39 100644 --- a/src/project-manager.ts +++ b/src/project-manager.ts @@ -385,7 +385,10 @@ export class ProjectConfiguration { const info: PluginCreateInfo = { config: configEntry, - project: { projectService: { logger: this.logger } }, // TODO: may need more support + project: { // TODO: may need more support + getCurrentDirectory: this.getHost().getCurrentDirectory, + projectService: { logger: this.logger }, + }, languageService: this.getService(), languageServiceHost: this.getHost(), serverHost: {}, // TODO: may need an adapter From cf29e800c77c545a3329be3262f25b7b84e7bc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Fri, 18 May 2018 15:41:41 +0200 Subject: [PATCH 2/4] refactor(lint): apply lint --- src/plugins.ts | 2 +- src/project-manager.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins.ts b/src/plugins.ts index 912b25847..e46453a83 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -40,7 +40,7 @@ export interface PluginCreateInfo { * The portion of tsserver's Project API exposed to plugins */ export interface Project { - getCurrentDirectory: () => string, + getCurrentDirectory: () => string projectService: { logger: Logger } diff --git a/src/project-manager.ts b/src/project-manager.ts index 1c0336a39..0897d0eaf 100644 --- a/src/project-manager.ts +++ b/src/project-manager.ts @@ -385,10 +385,11 @@ export class ProjectConfiguration { const info: PluginCreateInfo = { config: configEntry, - project: { // TODO: may need more support - getCurrentDirectory: this.getHost().getCurrentDirectory, + project: { + // TODO: may need more support + getCurrentDirectory: this.getHost().getCurrentDirectory.bind(this), projectService: { logger: this.logger }, - }, + }, languageService: this.getService(), languageServiceHost: this.getHost(), serverHost: {}, // TODO: may need an adapter From 6076a42d6af9752cdb3dc2e9987723df6556fb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Sat, 19 May 2018 00:09:22 +0200 Subject: [PATCH 3/4] refactor(plugins): change some minor code notation --- src/plugins.ts | 2 +- src/project-manager.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins.ts b/src/plugins.ts index e46453a83..309b8ae23 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -40,7 +40,7 @@ export interface PluginCreateInfo { * The portion of tsserver's Project API exposed to plugins */ export interface Project { - getCurrentDirectory: () => string + getCurrentDirectory(): string projectService: { logger: Logger } diff --git a/src/project-manager.ts b/src/project-manager.ts index 0897d0eaf..4d6a104b0 100644 --- a/src/project-manager.ts +++ b/src/project-manager.ts @@ -387,7 +387,7 @@ export class ProjectConfiguration { config: configEntry, project: { // TODO: may need more support - getCurrentDirectory: this.getHost().getCurrentDirectory.bind(this), + getCurrentDirectory: () => this.getHost().getCurrentDirectory(), projectService: { logger: this.logger }, }, languageService: this.getService(), From e1c1437f84de7c4a18b62868bede5e113cba0fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Sat, 19 May 2018 00:28:19 +0200 Subject: [PATCH 4/4] refactor(plugins): fix lint --- src/plugins.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins.ts b/src/plugins.ts index 309b8ae23..8436e9948 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -40,10 +40,8 @@ export interface PluginCreateInfo { * The portion of tsserver's Project API exposed to plugins */ export interface Project { + projectService: { logger: Logger } getCurrentDirectory(): string - projectService: { - logger: Logger - } } /**