Class undefined_patternCodeAction

java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.codeaction.undefined_patternCodeAction
All Implemented Interfaces:
IRNCCodeActionParticipant

public class undefined_patternCodeAction extends Object implements IRNCCodeActionParticipant
Code action for the undefined-pattern error — offers "Did you mean" suggestions and "Create define" quick fixes.

Generates up to three types of code actions:

  1. "Did you mean" — suggests similar define names (using Levenshtein distance) and built-in keywords (text, empty, etc.) when the undefined name is a likely typo.
  2. "Create define as element" — generates a new element definition at the end of the document.
  3. "Create define as attribute" — generates a new attribute definition.
  4. "Create define" — generates a free-form definition with a placeholder for the pattern body.

Use case: the user writes start = roo (typo for root). The code action offers "Did you mean 'root'?" as the first quick fix.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
    Generates "Did you mean" suggestions for similar defines and built-in keywords, plus "Create define" code actions to define the missing pattern.

    Methods inherited from class java.lang.Object

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

    • undefined_patternCodeAction

      public undefined_patternCodeAction()
  • 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)
      Generates "Did you mean" suggestions for similar defines and built-in keywords, plus "Create define" code actions to define the missing pattern.
      Specified by:
      doCodeAction in interface IRNCCodeActionParticipant