clausreinke / typescript-tools

(repo no longer active) Tools related to the TypeScript language
Apache License 2.0
266 stars 29 forks source link

Errors not reporting properly if file contains an unclosed string #11

Closed draivin closed 10 years ago

draivin commented 10 years ago

Using https://github.com/jlujan/TypeScriptServiceExample as a base, apparently it should provide the errors Could not find symbol 'foo' and Missing close quote character. Using the compiler as a base it provides the error error TS1002: Missing close quote character

test case:

update 1 D:/tests.ts
foo = 'bar
showErrors

result:

"loaded D:/test.ts, TSS listening.."
"updated D:/tests.ts"
"TSS command processing error: Error: error TS5028: Argument out of range: position."

Looking into this I also noticed that there are errors that cause the script to fail compilation, and there are errors that are shown at compilation time but do not prevent it, would there be any way to differentiate those two through the typescript services?

clausreinke commented 10 years ago

For some reason, the error indexes beyond the end of file. For now, I've clamped the end position to end of file, which makes this example work without changing the positions in other tests.

As for different error sets: do you have a concrete example in mind? And is there a correlation to the error message text (in particular, the word before the error code)?

draivin commented 10 years ago

There does not seem to be a difference in error message texts, about the example foo = 'bar throws the error Missing close quote character and does not compile, but foo = 'bar' throws the error Could not find symbol 'foo' and still compiles.

By the way, thanks for all the quick fixes.

clausreinke commented 10 years ago

There does not seem to be a difference in error message texts

hmm, from reading the source, it looks as if semantic diagnostics do not stop the code emitter, whereas syntactic ones do. Perhaps I can add that distinction to the output.

By the way, thanks for all the quick fixes.

You're welcome. Just want to get rid of those bugs!-)

draivin commented 10 years ago

Would be great if you could expose that information somehow, sorry for all the trouble!