angelozerr / tslint-language-service

TypeScript 2.2.1 plugin for tslint
MIT License
188 stars 22 forks source link

info.project.getCurrentDirectory is not a function #67

Open sebastiencs opened 6 years ago

sebastiencs commented 6 years ago

Hi,

I'm using javascript-typescript-langserver with emacs. When I try to use tslint-language-service, I have this error:

Plugin activation failed: TypeError: info.project.getCurrentDirectory is not a function

My node_modules folder contains tslint, tslint-language-service and typescript

What could be wrong ?

angelozerr commented 6 years ago

I'm using javascript-typescript-langserver with emacs.

I didin't know javascript-typescript-langserver supports now plugin. I think it's an issue with the implementation of plugin support in javascript-typescript-langserver

sebastiencs commented 6 years ago

There was the issue that javascript-typescript-langserver didn't search the plugin in the right path (not in my node_modules project folder), so I forked it and now it takes the right path: my_project/node_modules/tslint-language-service.

What does this plugin require to make it work ?

angelozerr commented 6 years ago

To be honnest with you, I don't know. You should see tsserver source for that.

soywod commented 6 years ago

I have the same error on Vim8, any news about this ?

[EDIT] The problem seems to come from a bad reference, I'm gonna try a PR.

chemzqm commented 6 years ago

javascript-typescript-langserver could be extended to do this as well.

I can make this issue resolved from javascript-typescript-langserver, but it still doesn't work, looks like there still some work for javascript-typescript-langserver to be done.

soywod commented 6 years ago

After some research, javascript-typescript-langserver seems to be late on their type definition. They are based on this commit of TypeScript to define Project (export abstract class Project). But now, on TypeScript master, Project is different (export abstract class Project implements LanguageServiceHost, ModuleResolutionHost), and this method getCurrentDirectory is part of LanguageServiceHost. So I think you are right @chemzqm , javascript-typescript-langserver should update their type.

I think my PR #68 is still a useful temporary fix, the time for javascript-typescript-langserver to improve their implementation, what do you think ?

angelozerr commented 6 years ago

I would like to avoid doing some hack, so I hope javascript-typescript-langserver will fix this problem. Hope you will understand.

soywod commented 6 years ago

I understand, and it makes sense. I've sent a PR to javascript-typescript-langserver to make this plugin work.