eclipse-xtext / eclipse-xtext/xtext

Regression in content assist follow elements calculation

Open
#2,472 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

After updating to Xtext 2.25 (from 2.21) we see unwanted } proposals given the grammar

Specification:
	{Specification}
	'specification' name=ID '{'
	((a+=A) |
	(b+=B) |
	(c+=C) |
	(d+=D) |
	(e+=E) |
	(s+=S) |
	(f+=F) |
	(g+=G))*
	'}';

A:
	"A" name=ID;

B:
	"B" name=ID;

C:
	"C" name=ID;

D:
	"D" name=ID;

E:
	"E" name=ID;

Fqn:
	ID ('.' ID)*;

F:
	'pi' xxxxxx=ID name=ID '{'
	'}';

G:
	'something' 'pi' i=Fqn '{'
	'}';

S:
	'something' xxx=Fqn s=ID '{'
	'}';

and model

specification xxxx {
	something aaaa bbbb {
    }
}

invoking content assist at aaaa gives the unwanted } proposal.
debugging 2.21 vs 2.25 i can see a difference in
Dfa.error which leads to failedPredicateAtEOF be set to true respecively not set to true

Bildschirmfoto 2021-07-07 um 07 56 51
Bildschirmfoto 2021-07-05 um 19 00 07

which then leads to different paths in

org.eclipse.xtext.ide.editor.contentassist.antlr.internal.new StreamAdapter() {...}.announceEof(int)

cause seems to be this change:
https://github.com/eclipse/xtext-core/pull/1469

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 supplied grammar and model, then compare Xtext 2.21 and 2.25 around Dfa.error and failedPredicateAtEOF. Trace the content-assist path through StreamAdapter.announceEof(int) and review PR 1469. Done means invoking content assist at aaaa no longer proposes an unwanted closing brace.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
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.