Class unclosed_blockCodeAction
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.codeaction.unclosed_blockCodeAction
- All Implemented Interfaces:
IRNCCodeActionParticipant
Code action for the
unclosed-block error — inserts a closing
} brace.
The insertion position is determined by examining the unclosed node's children: if a top-level construct (define, start, namespace, datatypes) is incorrectly nested inside the unclosed block, the closing brace is inserted before it. Otherwise, it is appended at the end of the document.
Use case: the user writes element foo { and forgets to close
it before writing the next define. The code action inserts }
at the correct position, separating the two definitions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoCodeAction(RNCDocument rncDocument, org.eclipse.lsp4j.Diagnostic diagnostic, org.eclipse.lsp4j.TextDocumentItem document, boolean snippetSupported, List<org.eclipse.lsp4j.CodeAction> codeActions, IRNCDocumentProvider documentProvider, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) Inserts a closing}brace at the inferred position — before the next top-level construct, or at the end of the document.
-
Constructor Details
-
unclosed_blockCodeAction
public unclosed_blockCodeAction()
-
-
Method Details
-
doCodeAction
public void doCodeAction(RNCDocument rncDocument, org.eclipse.lsp4j.Diagnostic diagnostic, org.eclipse.lsp4j.TextDocumentItem document, boolean snippetSupported, List<org.eclipse.lsp4j.CodeAction> codeActions, IRNCDocumentProvider documentProvider, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) Inserts a closing}brace at the inferred position — before the next top-level construct, or at the end of the document.- Specified by:
doCodeActionin interfaceIRNCCodeActionParticipant
-