-
Notifications
You must be signed in to change notification settings - Fork 73
Auto complete fails with an exception in bridge.js #214
Comments
I get a similar error using the development update site (version com.palantir.typescript_1.4.0.v20141124-1936). |
Looks like an exception on the TypeScript side. Could you please report the Node part of the stack trace to the TS project directly? They will also likely need repro steps (like a file and what behavior produces the issue). |
Closing for now since there doesn't appear to be anything I can do in the Eclipse plugin to fix this. |
The exception occurs in bridge.js in the function getTokenPosOfNode. Who is maintaining bridge.js? Here is the definition of the function in 1.4.0.v20141124-1936:
It seems that getSourceFileOfNode returns null, since the exception text is "Cannot read property 'text' of undefined". |
The bridge.js file is a combination of the TypeScript language services and a little bit of glue (or bridge) code to expose a simple interface to Eclipse. In this particular case, the code that threw the exception appears to specifically be in the TypeScript language services, so starting with the TypeScript team is a good bet. You can link to the TypeScript bug here and I'll watch it in case they suspect the integration with Eclipse is at fault. |
Hi Derek, Assuming that a drop-in replacement makes sense, of course.. /Jeppe |
I just commented on the issue you opened - I think the easiest next step will be to pick up the latest 1.4 source again once the 1305 issue is fixed (its another random assertion). Unfortunately eclipse-typescript can't use the LKG because it doesn't include a definition file - I mentioned in the bug that it would be a great idea to start shipping a definition file there as well. |
I have found out what triggers the exception: I didn't enable Typescript builder on the Eclipse projects. It seems that the plugin attempts to perform auto-completion anyway when ctrl-space is hit, but somehow the source files are missing in the model that is build within the Typescript services (syntax nodes are missing a parent node of type SourceFile). Could the Typescript builder be on by default, to make the plugin more newbie friendly? :-) |
Hmm, Sounds like the project nature wasn't enabled. Unfortunately there is no way to enable that by default in Eclipse. This behavior sounds bad though, lemme look into how it's occurring and see if there is better behavior possible. |
Now I get the auto complete exception consistently again, even with Typescript builder enabled, so there is more to it than ensuring the builder is enabled.. |
Ah ok, I think I know what is causing this now: when a project has no builder configured then every file in that project is considered independent in terms of all the language services (each file is opened in its own language service). In terms of the implementation, in this situation the plug-in generates a unique name for the file which is just a UUID (with no extension). However, there was a recent regression that makes files without extensions fail: microsoft/TypeScript#1015. I believe we are hitting that issue and that I can fix it by just appending ".ts" to the generated file name. |
Just pushed a fix but as you noted, you'll want to enable the builder on each project which contains TypeScript sources in order to get proper auto-completion across files. I would also suggest restarting eclipse after making that change because I'm not sure how gracefully the plugin will handle being enabled/disabled on the fly (which is why you might still be able to reproduce the issue even with the builder enabled). |
Btw, I pushed the fix for the 1.4 release - do you also need it for the current mainline release? (1.3) |
Just tested enabling the builder - you only need to close and reopen the open TypeScript editor windows - not reboot the entire Eclipse workspace. |
Got the update, and it fixes the problem. Thanks! I don't need a fix for 1.3. |
Awesome, glad to hear it works! |
With a fresh installation of the plugin (1.3.0.v20141124-1716), I get an error when I hit ctrl-space. It seems to be caused by an exception in com.palantir.typescript_1.3.0.v20141124-1716/bin/bridge.js, line 32073.
Below are the error details from Eclipse error log view:
eclipse.buildId=4.4.1.M20140925-0400
java.version=1.7.0_51
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
com.palantir.typescript
Error
Fri Nov 28 10:14:14 CET 2014
The following request caused an error to be thrown:
{"endpoint":"language","method":"getCompletionsAtPosition","arguments":["9267b155-fad2-4149-bbf0-a6793d994a44","9267b155-fad2-4149-bbf0-a6793d994a44",246]}
TypeError: Cannot read property 'text' of undefined
at NodeObject.createChildren (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:32073:69)
at NodeObject.getChildren (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:32110:22)
at findRightmostToken (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28370:30)
at find (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28385:49)
at find (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28388:36)
at findPrecedingToken (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28365:16)
at Object.findTokenOnLeftOfPosition (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28343:16)
at Object.getCompletionsAtPosition (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:33522:37)
at LanguageEndpoint.getCompletionsAtPosition (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:36784:65)
at Main.processRequest (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:36949:37)
java.lang.RuntimeException: The following request caused an error to be thrown:
{"endpoint":"language","method":"getCompletionsAtPosition","arguments":["9267b155-fad2-4149-bbf0-a6793d994a44","9267b155-fad2-4149-bbf0-a6793d994a44",246]}
TypeError: Cannot read property 'text' of undefined
at NodeObject.createChildren (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:32073:69)
at NodeObject.getChildren (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:32110:22)
at findRightmostToken (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28370:30)
at find (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28385:49)
at find (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28388:36)
at findPrecedingToken (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28365:16)
at Object.findTokenOnLeftOfPosition (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:28343:16)
at Object.getCompletionsAtPosition (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:33522:37)
at LanguageEndpoint.getCompletionsAtPosition (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:36784:65)
at Main.processRequest (C:\x_space\products\eclipse\plugins\com.palantir.typescript_1.3.0.v20141124-1716\bin\bridge.js:36949:37)
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)
at com.palantir.typescript.text.FileLanguageService.getCompletionsAtPosition(FileLanguageService.java:83)
at com.palantir.typescript.text.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:85)
at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1861)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:573)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:570)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:505)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:499)
at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1687)
at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:932)
at com.palantir.typescript.text.TypeScriptSourceViewer.doOperation(TypeScriptSourceViewer.java:68)
at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)
at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:122)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:286)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:507)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:558)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:378)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:324)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:86)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1112)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1529)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4722)
at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:343)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4610)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5023)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
The text was updated successfully, but these errors were encountered: