Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » JSDT: Dynamic Code Completion
JSDT: Dynamic Code Completion [message #989775] Fri, 07 December 2012 17:05 Go to next message
Christoph Hausmann is currently offline Christoph HausmannFriend
Messages: 3
Registered: December 2012
Junior Member
Hi everyone,

I have a question regarding the JSDT code completion. Basically, I want to have full control over the objects and methods offered in the code completion dialog. These objects and methods are not static, they are dynamically generated at runtime and should immediately appear within the code completion dialog.

Here is what I already tried:

(1) Using the 'org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer' extension point I added a custom library that contains the API, which should be available via code completion. However, this approach does not work for a "dynamic" API - if I change the library file at runtime, the changes are not reflected in the code completion.

(2) I used the 'org.eclipse.wst.jsdt.core.inferrenceSupport' extension point and implemented a custom InferenceProvider which returns an extension of the InferEngine that dynamically modifies the given CompilationUnitDeclaration and, e.g., adds an additional type. This type then afterwards appears in the code completion dialog, so it is basically working. However, there seems to be no API for adding additional variables. There is just CompilationUnitDeclaration.addType(...) and CompilationUnitDeclaration.addImport(...). And this approach also seems more like a hack to me.

(3) The last thing I tried was using the 'org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer' extension point to provide a custom CompletionProposalComputer. But so far I am a bit lost there, so if this is the correct approach, I need some more hints on how to do this.

So in conclusion my question is: what is the preferred way to dynamically influence code completion in the JSDT JavaScript editor?
Re: JSDT: Dynamic Code Completion [message #990048 is a reply to message #989775] Mon, 10 December 2012 16:26 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

1) changes to libraries aren't automatically detected unless they're also resources in the workspace (the resource delta then triggers a reindexing), which is unusual for containers. You need to call org.eclipse.wst.jsdt.core.JavaScriptCore#setJsGlobalScopeContainer() to make JSDT aware that the contents of your container have changed.

2) If you mean adding properties to those types, you call one of the add...() methods on the InferredType objects.


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: JSDT: Dynamic Code Completion [message #990053 is a reply to message #990048] Mon, 10 December 2012 16:35 Go to previous message
Christoph Hausmann is currently offline Christoph HausmannFriend
Messages: 3
Registered: December 2012
Junior Member
Okay, thank you for the advice. I'll try that.
Previous Topic:Configure Jboss WS as Web Service Runtime
Next Topic:JavaTOWS Fail to load class error
Goto Forum:
  


Current Time: Sat Apr 27 04:51:39 GMT 2024

Powered by FUDForum. Page generated in 0.02677 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top