Class extract_defineCodeAction

java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.codeaction.extract_defineCodeAction

public class extract_defineCodeAction extends Object
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
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PARTICIPANT_ID

      public static final String 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 - true if the client supports snippet syntax.
      resolveSupported - true if 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 - true if the client supports snippet syntax.
      Returns:
      the resolved code action with its edit populated.