eclipse-xtext / eclipse-xtext/xtext

ProposalProvider fails due to FollowElementComputer.computeFollowElements misbehaviour

Open
#2,563 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

In some very specific and strange circumstances (see tests below), the content assist does not work anymore.
While debugging, I found that in the method ContentAssistContextFactory.doCreateContexts( INode, INode, String, EObject, Collection), the call to FollowElementComputer.computeFollowElements 'returns' an empty list of AbstractElement, preventing any possible proposal provider context to be created.

In attachment, a complete example to reproduce the problem, with ui.tests for the identified proposal provider fail case.

Example of working and not working case:
`package my.package

class Test {

// Does not work
for (var i = 1; i < 10; i++) { 
	A intProperty:10 {	}
	B enumProperty: // <-- content assist (fails) here
	literal1 {}
}
			
// Works !!!
for (var i = 1; i < 10; i++) { 
	//A intProperty:10 {	}
	B enumProperty: // <-- content assist (works) here
	literal1 {}
}

}`
demo.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the demo.zip reproduction and its ui.tests for the failing proposal-provider case. Trace ContentAssistContextFactory.doCreateContexts(...) and the call to FollowElementComputer.computeFollowElements, comparing the cases where content assist fails and works. Done means the failing case creates proposal-provider context and content assist works without regressing the working case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.