clausreinke / typescript-tools

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

Asking for completions inside a function with parameters will return an error #13

Closed draivin closed 10 years ago

draivin commented 10 years ago

The weird part is that it will work properly if the function has no parameters.

Test case:

update 3 D:/empty.ts
function foo(bar){
    b
}
completions false 2 6 D:/empty.ts

Result:

"updated D:/empty.ts"
"TSS command processing error: TypeError: Cannot call method 'setUnresolved' of null"
draivin commented 10 years ago

This test is only passing because on the test script there is D:/ instead of PREFIX/

clausreinke commented 10 years ago

Good catch about the D:/. Don't know how I could have missed that. However, that only means the whole test runs on an in-memory file that has no representation in the file system. So this issue is still fixed. I need to modify the test, and perhaps restrict update to known project files, to prevent such mistakes.

clausreinke commented 10 years ago

You were right: when operating on the real file, the test still fails.

clausreinke commented 10 years ago

looks like a TS issue, after all: https://typescript.codeplex.com/workitem/1592

draivin commented 10 years ago

I guess that is it then, now we wait until the issue is fixed and a new build of typescript is released?

clausreinke commented 10 years ago

Once it is fixed in TS develop branch, I can pull the fix into TSS. No need to wait for releases. As a workaround, just doing a type or definition command first (after update, before completions) seems to work. I haven't yet been able to isolate the piece of code responsible.

clausreinke commented 10 years ago

The main issue was fixed upstream a while ago. There is a secondary issue, in that completion entries that are primitive types (string, etc) have no details (null result). For these, tss returns a non-null result with no (type) entry, which is a small protocol change (plugins cannot rely on type and docComment being there).