Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » CompletionContext#getTokenStart() returns -1
CompletionContext#getTokenStart() returns -1 [message #255205] Wed, 23 July 2008 19:01 Go to next message
Eclipse UserFriend
Originally posted by: first.last.oracle.com

We have an implementation of IJavaCompletionProposalComputer in Dali that we use to help
users enter valid strings in JPA annotations. In certain situations the CompletionContext
we get from the JavaContentAssistInvocationContext passed in to our implementation of
computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor) seems a bit
malformed.

Given the follow code snippet:

@OneToMany(mappedBy="parent")
private Set<Foo> children;

If I place the cursor immediately after the " and before the ) and invoke content assist
(Ctrl-Space), our Computer gets a CompletionContext that returns the following values:

getToken() -> null
getTokenStart() -> -1
getTokenEnd() -> -1

It's not clear from the JavaDoc that I should be expecting -1 for the token start and/or
token end in this situation. Am I mistaken? If so, when should I expect these values?

Thanks.
Brian
Re: CompletionContext#getTokenStart() returns -1 [message #255412 is a reply to message #255205] Mon, 04 August 2008 09:53 Go to previous message
Eclipse UserFriend
Brian Vosburgh wrote:
> We have an implementation of IJavaCompletionProposalComputer in Dali
> that we use to help
> users enter valid strings in JPA annotations. In certain situations
> the CompletionContext
> we get from the JavaContentAssistInvocationContext passed in to our
> implementation of
> computeCompletionProposals(ContentAssistInvocationContext,
> IProgressMonitor) seems a bit
> malformed.
>
> Given the follow code snippet:
>
> @OneToMany(mappedBy="parent")
> private Set<Foo> children;
>
> If I place the cursor immediately after the " and before the ) and
> invoke content assist
> (Ctrl-Space), our Computer gets a CompletionContext that returns the
> following values:
>
> getToken() -> null
> getTokenStart() -> -1
> getTokenEnd() -> -1
>
> It's not clear from the JavaDoc that I should be expecting -1 for the
> token start and/or
> token end in this situation. Am I mistaken? If so, when should I
> expect these values?
I suggest to file a bug report against JDT Core.

Dani
>
> Thanks.
> Brian
Previous Topic:JDT and files without "java" extension that contain valid java code
Next Topic:Reset synchronize view auto sync
Goto Forum:
  


Current Time: Sat Jun 07 21:17:47 EDT 2025

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

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

Back to the top