angelozerr / tslint-language-service

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

Update when tslint.json changes #30

Open amatiasq opened 7 years ago

amatiasq commented 7 years ago

I had a rule causing me some trouble so I disabled it. I closed and open the offending file many times but vscode still warning about the disabled rule. It was fixed after I closed vscode itself.

angelozerr commented 7 years ago

To fix quickly this issue, we could use fs.watch to disable the tslint cache configuration when tslint.json changed.

It will fix the case to close VSCode, but it will not revalidate the opened TypeScript files. I don't know how to force tsserver diagnostics when we are inside a plugin.

I'm not a big expert with fs.watch, but I'm afraid with lock problem (ex: user delete, move tslint.json file, is it working?)

Perhaps an another idea is to wait for TypeScript 2.4 which will implement getExternalFiles for plugin. I think getExternalFiles could be helpfull to implement the issue https://github.com/angelozerr/tslint-language-service/issues/4

@egamma what do you think?

egamma commented 7 years ago

@amatiasq reloading the window, or TypeScript: reload project would be a faster work around.

However, vscode-tslint reacts to tslint.json config changes automatically and we should support the tslint-language-service as well.

To fix quickly this issue, we could use fs.watch to disable the tslint cache configuration when tslint.json changed.

Watching the config file is the easy part... since TypeScript doesn't touch the tslint.json file, there are no locking concerns. The challenge is how to trigger a revalidation of the open files. I see currently no easy way to do this from inside the typescript server. The best would be when the TS server provides an API recomputeDiagnostics which revalidates the open files. We should discuss this with the TS folks.

vsviridov commented 6 years ago

I use vim so I have to restart the whole editor for it to re-read rules.