Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal missing from the content assist #1677

Open
ydaveluy opened this issue Sep 13, 2024 · 4 comments · May be fixed by #1689
Open

Proposal missing from the content assist #1677

ydaveluy opened this issue Sep 13, 2024 · 4 comments · May be fixed by #1689
Labels
bug Something isn't working completion Completion related issue

Comments

@ydaveluy
Copy link
Contributor

Hey !

I probably found a minor issue in the content assist in case of multiple keyword alternatives. It seems that if the previous token is of a keyword kind, this keyword is not proposed by the content assist.

Langium version: 3.1
Package name: Langium

Steps To Reproduce

  1. Open this playground
  2. Ctrl+space on line 4

The current behavior

The content assist propose to create a new 'student' but not an other 'teacher'. After a 'student', the content assist propose to create a 'teacher' but not an other 'student'.

The expected behavior

The content assist should propose a 'student' and a 'teacher' in all cases.

@ydaveluy ydaveluy added the bug Something isn't working label Sep 13, 2024
@msujew
Copy link
Member

msujew commented Sep 13, 2024

Hm, interesting. It's also pretty interest that this can be pretty easily fixed by using a small refactoring of the grammar. See here.

@msujew msujew added the completion Completion related issue label Sep 13, 2024
@ydaveluy
Copy link
Contributor Author

Yes, in your refactoring, 'student' and 'teacher' are on different AstNodes, and it works properly.

In my case, I think the issue comes from DefaultCompletionProvider.findFeaturesAt, which does not return the previous feature, but I don't fully understand how this function works.

@msujew
Copy link
Member

msujew commented Sep 14, 2024

Yeah, I'm not saying that this isn't a bug - but there are at least in theory ways to circumvent this. I've added this to #1678.

@ydaveluy
Copy link
Contributor Author

Thanks for the workaround.

I continued investigating this issue and I noticed that we enter in this branch for the missing feature:

It means that the previous feature is added in the visited Set somewhere before processing the Group.

@ydaveluy ydaveluy linked a pull request Sep 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completion Completion related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants