Skip to content
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

TSLint LS changes the original diagnostics array #41

Closed
anstarovoyt opened this issue Jun 6, 2017 · 1 comment
Closed

TSLint LS changes the original diagnostics array #41

anstarovoyt opened this issue Jun 6, 2017 · 1 comment

Comments

@anstarovoyt
Copy link

anstarovoyt commented Jun 6, 2017

Hi. There is a problem with the code:
https://github.com/angelozerr/tslint-language-service/blob/master/src/index.ts#L304

It uses the original diagnostics object from the parent LS (doesn't copy it).
The parent LS caches the object so every time when I call getSemanticDiagnostics (and the file wasn't changed so the parent LS can use the cache) it adds more and more tslint errors.

There is no way to reproduce the error in VSCode because it doesn't call getSemanticDiagnosticsSync.

we can fix the problem by adding this code:

if (prior === undefined) {
   prior = [];
} else {
   prior = prior.slice();
}

I guess you can also use a cache as the parent LS does it.

@angelozerr
Copy link
Owner

Thanks @anstarovoyt for your suggestion, is there any change to have a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants