Skip to content

Code action for unresolved references #1802

Answered by msujew
theogiraudet asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @theogiraudet, good to see you :)

We actually have something like this in the Langium grammar language server:

case DocumentValidator.LinkingError: {
const data = diagnostic.data as LinkingErrorData;
if (data && data.containerType === 'RuleCall' && data.property === 'rule') {
accept(this.addNewRule(diagnostic, data, document));
}
if (data) {
this.lookInGlobalScope(diagnostic, data, document).forEach(accept);
}
break;

In this case we simply create a new rule, but the same architecture can be used to instead create an import. For the import…

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
10 replies
@theogiraudet
Comment options

@cdietrich
Comment options

@cdietrich
Comment options

@cdietrich
Comment options

@theogiraudet
Comment options

Comment options

You must be logged in to vote
1 reply
@theogiraudet
Comment options

Answer selected by theogiraudet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants