Class extract_defineCodeAction
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.codeaction.extract_defineCodeAction
Refactoring code action that extracts an
element or attribute
pattern into a named define.
Before:
start = element addressBook {
element card { text }
}
After extracting element card { text }:
start = element addressBook {
card
}
card = element card { text }
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoCodeAction(RNCDocument rncDocument, org.eclipse.lsp4j.Range range, boolean snippetSupported, boolean resolveSupported, List<org.eclipse.lsp4j.CodeAction> codeActions) Generates an "Extract define" code action if the cursor is on an extractable element or attribute node.org.eclipse.lsp4j.CodeActionresolveCodeAction(RNCDocument rncDocument, org.eclipse.lsp4j.CodeAction unresolved, boolean snippetSupported) Resolves a deferred "Extract define" code action by computing the workspace edit (replace inline pattern with name, append define at end).
-
Field Details
-
PARTICIPANT_ID
-
-
Constructor Details
-
extract_defineCodeAction
public extract_defineCodeAction()
-
-
Method Details
-
doCodeAction
public void doCodeAction(RNCDocument rncDocument, org.eclipse.lsp4j.Range range, boolean snippetSupported, boolean resolveSupported, List<org.eclipse.lsp4j.CodeAction> codeActions) Generates an "Extract define" code action if the cursor is on an extractable element or attribute node.- Parameters:
rncDocument- the parsed RNC document.range- the selected range in the document.snippetSupported-trueif the client supports snippet syntax.resolveSupported-trueif the client supports lazy resolve.codeActions- the list to add the created code action to.
-
resolveCodeAction
public org.eclipse.lsp4j.CodeAction resolveCodeAction(RNCDocument rncDocument, org.eclipse.lsp4j.CodeAction unresolved, boolean snippetSupported) Resolves a deferred "Extract define" code action by computing the workspace edit (replace inline pattern with name, append define at end).- Parameters:
rncDocument- the parsed RNC document.unresolved- the code action to resolve.snippetSupported-trueif the client supports snippet syntax.- Returns:
- the resolved code action with its edit populated.
-