-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Auto complete fails with an exception in getTokenPosOfNode #1306
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
Comments
Hi there @jsommer, would you be able to provide us with some code that reproduces this issue? |
Hi Daniel, I don't have good tools for debugging the bridge.js file, but I got this far with the exception in getTokenPosOfNode (typescript version 1.4): node.parent being undefined looks suspicious to me. Shouldn't there be a parent at some level of type 'SourceFile'? getSourceFileOfNode seems to assume this. |
That is strange indeed. Can you please try typescriptServices.js from LKG? Post 1.3 there was a lot of code changes in |
Unfortunately I can't use the LKG typescriptServices.js since there is no accompanying definition file for it (that would be a great addition to start keeping the definition file as well - then I wouldn't have to build typescriptServices.* from source each time). I suspect other tools built on the language services would also benefit from having the definition file in the LKG. I just tried updating to the latest TypeScript code in master but I hit #1305 so I can't push a new release until that is fixed. |
Btw, since bridge.js is just typescriptServices.js with some glue code concatenated to the end, all the line numbers from stack traces via bridge.js should line up with the corresponding typescriptServices.js file checked into the eclipse-typescript repo. For example, the currently incubating develop version of the plugin uses this snapshot of typescriptServices.js: |
After investigating this further we figured out that this is #1015. I added a workaround which appends ".ts" to affected files and that seems to be working. |
@derekcicerone #1015 should be fixed now. can you give this another try. |
Works great - thanks! |
Oh wait, do you want me to test with the new compiler option? I was just going to leave in the workaround of appending ".ts" to the file names. |
up to you :) The new option just bypasses the error. you need to think about what implications this has about emitted file names as well. but again this is totally up to you. |
Cool, I'll keep it in mind in case the workaround becomes a problem. For now I think its fine as-is since its relatively isolated and all other files are guaranteed to have the proper extensions. |
I think this can be closed now. |
thanks @derekcicerone |
The Palantir eclipse-typescript Eclipse plugin fails consistently on a fresh Eclipse/plugin installation with an exception in getTokenPosOfNode(). The Palantir developers believes that this is your table.
Steps to reproduce: Hit ctrl-space in any .ts file.
Here is a link to the eclipse-typescript issue, including full stacktrace for ts 1.3 and further comments: palantir/eclipse-typescript#214
Here is the top of the stacktrace with the ts 1.4 version of the plugin:
java.lang.RuntimeException: The following request caused an error to be thrown:
{"endpoint":"language","method":"getCompletionsAtPosition","arguments":["0d703036-865e-46b2-857e-40bdde7f0065","0d703036-865e-46b2-857e-40bdde7f0065",42]}
TypeError: Cannot read property 'text' of undefined
at Object.getTokenPosOfNode (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:2584:71)
at NodeObject.getStart (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:20597:23)
at NodeObject.getWidth (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:20606:41)
at nodeHasTokens (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:18422:18)
at findRightmostChildNodeWithTokens (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:18411:21)
at findRightmostToken (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:18381:29)
at find (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:18406:37)
at Object.findPrecedingToken (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:18375:16)
at Object.getCompletionsAtPosition (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:22043:36)
at LanguageEndpoint.getCompletionsAtPosition (X:\products\eclipse-standard-32bit\plugins\com.palantir.typescript_1.4.0.v20141129-1925\bin\bridge.js:25746:65)
at com.palantir.typescript.services.Bridge.processRequest(Bridge.java:142)
at com.palantir.typescript.services.Bridge.call(Bridge.java:95)
at com.palantir.typescript.services.Bridge.call(Bridge.java:83)
at com.palantir.typescript.services.language.LanguageEndpoint.getCompletionsAtPosition(LanguageEndpoint.java:171)
The text was updated successfully, but these errors were encountered: