Code action for unresolved references #1802
-
Hi! I have a language with an import mechanism (such as the file-based scoping example). I want to propose import detection as a quick fix into my code action provider. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Hi, are you sure you have a cross reference for the place you don’t get a diagnostic for? Can you provide a sample grammar / playground |
Beta Was this translation helpful? Give feedback.
-
Hey @theogiraudet, good to see you :) We actually have something like this in the Langium grammar language server: langium/packages/langium/src/grammar/lsp/grammar-code-actions.ts Lines 82 to 90 in 23d4a14 In this case we simply create a new rule, but the same architecture can be used to instead create an import. For the import, you'll probably need to take a look at the index manager to figure out whether there's something that could fit the reference text. |
Beta Was this translation helpful? Give feedback.
Hey @theogiraudet, good to see you :)
We actually have something like this in the Langium grammar language server:
langium/packages/langium/src/grammar/lsp/grammar-code-actions.ts
Lines 82 to 90 in 23d4a14
In this case we simply create a new rule, but the same architecture can be used to instead create an import. For the import…