Control auto completion suggestions #384
Replies: 2 comments 2 replies
-
Interested in an example to subclass DefaultCompletionProvider |
Beta Was this translation helpful? Give feedback.
-
@paulfrench @debovema Sorry for coming back to this so late, seems like I forgot about this. Anyway, regarding the actual question here: First off, there is a bug which prevents Langium from correctly presenting completion results for cross references which are missing their terminal (i.e. modify On another note: To override the completion provider you just need to override the class CustomCompletionProvider extends DefaultCompletionProvider {
... // Your custom overrides here
}
// In your module.ts
export const CustomModule: Module<CustomServices, PartialLangiumServices & CustomAddedServices> = {
lsp: {
completion: {
CompletionProvider: (services) => new CustomCompletionProvider(services)
}
}
}; |
Beta Was this translation helpful? Give feedback.
-
I'm only showing the relevant parts of the grammar file...
What I would like to do is for the query find part, where after specifying the Entity, only show a list of properties to choose from by the specified [Entity] ? I know the [Property] reference I have put in the Query rule will not work since it is not in the context of the specified [Entity] (unlike for the Entity rule where the keys suggested are the properties of the Entity)
So, is it possible out of the box or is this more complex where you need to provide your own CompletionProvider? If so I've looked at the DefaultCompletionProvider and it looks fairly complex so any pointers would be really good.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions