Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Add missing project method for plugins #462

Merged
merged 4 commits into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface PluginCreateInfo {
* The portion of tsserver's Project API exposed to plugins
*/
export interface Project {
getCurrentDirectory: () => string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit, could this just be a method rather than an arrow function?

getCurrentDirectory(): string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you right, I update this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

projectService: {
logger: Logger
}
Expand Down
6 changes: 5 additions & 1 deletion src/project-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ 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.bind(this),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bind() is not type safe, prefer wrapping in a function manually

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

projectService: { logger: this.logger },
},
languageService: this.getService(),
languageServiceHost: this.getHost(),
serverHost: {}, // TODO: may need an adapter
Expand Down