-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading issue when bundling tslint language server plugin as a VS Code extension #25769
Comments
To further complicate matters, in this case you can't actually change the tslint code, correct? It has to remain Since the plugin is going to be run by TypeScript and not the extension, we may be able to set |
Extensions shouldn't be calling |
@RyanCavanaugh do you have a pointer how to pass the passed-in https://github.com/palantir/tslint/blob/master/src/rules/alignRule.ts#L19 |
@egamma I added a workaround to set Can you please let me know if this solves this issue or let me know if there are additional steps I can run through to test this |
@mjbvz this is good! An additional test you can make is whether this change also enables to eliminate the typescript dependency from the extension that bundles the tslint language service plugin. This is the dependency https://github.com/Microsoft/vscode-ts-tslint/blob/c33c12ed1f1c5a3d29d52c0b5c2b784353f5bc4e/package.json#L45. From what you describe this should be the case. One concern I have is that tweaking the NODE_PATH dynamically not really a recommended practice. |
Yes, setting node_path seems to allow that in my testing. @RyanCavanaugh I agree with Erich that setting |
I don't see how we could do that. When Plugins just need to do the right thing. We shouldn't try to get too tricky trying to work around their bugs. |
I think @egamma's point is that this is not always something the extension has control over. The tslint plugin can do the right thing but it still depends on tslint which does not. As for changing the behavior of Another approach would be to run the extension inside a sandbox that we hand a specialized version of |
Closing since we have addressed this issue on the vs code side. @RyanCavanaugh I'll leave it up to you to decide if any action is needed on the TypeScript side |
@kieferrm @mjbvz I've created a VS Code extension (
vscode-ts-lint
) for thetslint-language-service
using thetypescriptServerPlugins
contribution point. See the package.json included below.However, there is an issue with how the
tslint
module can load thetypescript
module it requires. To describe the issue, let me first explain the setup, when the language server plugin is installed into a workspace usingnpm install tslint typescript tslint-language-service
. This results in the following module layout inside thenode_modules
folder.Notice that the typescript module is a peer to the tslint module and the
tslint
module can require thetypescript
module. This is the same typescript module that is used by vscode's typescript server.Now, the question is what dependencies should be defined for the vscode tslint extension? To make the extension work I had to include
typescript
as a dependency otherwisetslint
cannot find thetypescript
module and thetslint-language-service
plugin does not load. Since the existing tslint rules importtypescript
they need to get at a typescript module. This is the error message when the typescript module is not bundled.However, the
tslint
module should use the sametypescript
module that is used by the vscode typescript server and not include yet another one. This results in loading two versions (!) of the typescript module into the language server.One idea would be that the TS language server tweaks the node require path, so that the typescript module used by the language server is found when a tslint rule requires
typescript
.package.json
The text was updated successfully, but these errors were encountered: