java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.format.RNCFormatting

public class RNCFormatting extends Object
Entry point for RNC (RELAX NG Compact Syntax) document formatting.

Delegates to RNCFormatterDocument which performs scanner-based formatting by analyzing whitespace between tokens and producing TextEdits where the actual whitespace differs from the expected formatting.

Use case: invoked by the LSP formatting request (textDocument/formatting) when the user formats an .rnc file. The formatting respects the user's SharedSettings for indentation (tabs vs spaces, tab size), trailing whitespace, and final newline preferences.

Example — before formatting:

 start=element root{text}
 

After formatting:

 start = element root {
   text
 }
 
See Also:
  • Constructor Details

    • RNCFormatting

      public RNCFormatting()
  • Method Details

    • format

      public List<? extends org.eclipse.lsp4j.TextEdit> format(TextDocument textDocument, SharedSettings sharedSettings, RNCFormattingSettings rncFormattingSettings)
      Formats the given RNC document and returns a list of TextEdits that, when applied, produce a well-formatted document.

      Use case: called from RNCLanguageService.format() which is invoked by the LSP textDocument/formatting request handler in RNCTextDocumentService.

      Parameters:
      textDocument - the RNC document to format.
      sharedSettings - the user's formatting preferences (tab size, insert spaces, trim trailing whitespace, etc.).
      Returns:
      a list of text edits to apply to the document. Returns an empty list if the document is already properly formatted.