-
Notifications
You must be signed in to change notification settings - Fork 73
Add missing project method for plugins #462
Conversation
in fact, many other methods have to be set there, since Project implements LanguageServiceHost.
Codecov Report
@@ Coverage Diff @@
## master #462 +/- ##
==========================================
- Coverage 83.1% 83.06% -0.05%
==========================================
Files 15 15
Lines 2042 2043 +1
Branches 416 483 +67
==========================================
Hits 1697 1697
- Misses 343 344 +1
Partials 2 2
Continue to review full report at Codecov.
|
src/plugins.ts
Outdated
@@ -40,6 +40,7 @@ export interface PluginCreateInfo { | |||
* The portion of tsserver's Project API exposed to plugins | |||
*/ | |||
export interface Project { | |||
getCurrentDirectory: () => string |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
src/project-manager.ts
Outdated
project: { projectService: { logger: this.logger } }, // TODO: may need more support | ||
project: { | ||
// TODO: may need more support | ||
getCurrentDirectory: this.getHost().getCurrentDirectory.bind(this), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
🎉 This PR is included in version 2.9.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'm using tslint-language-service, and this plugin doesn't work with javascript-typescript-langserver because there is some missing properties/methods in your PluginCreateInfo. So I just added the
getCurrentDirectory
.