java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.completion.RNCCompletionContext

public class RNCCompletionContext extends Object
Determines the completion context at a given cursor position in an RNC document by scanning all tokens before the cursor.

Use case: RNCCompletions calls getCompletionContext(CharSequence, int) to decide which set of completion items to offer — top-level declarations, pattern keywords, namespace URIs, file paths, etc.

  • Method Details

    • getCompletionContext

      public static RNCCompletionContext.CompletionContextType getCompletionContext(CharSequence text, int offset)
      Determines the completion context by scanning all tokens before the cursor.

      Implements a state machine that tracks the last meaningful token, whether we are inside a namespace or datatypes declaration, and the current brace nesting depth.

      Parameters:
      text - the full document text.
      offset - the cursor offset.
      Returns:
      the detected RNCCompletionContext.CompletionContextType.