github.com/tiagovtristao/plz@v13.4.0+incompatible/tools/build_langserver/lsp/text_document.go (about)

     1  package lsp
     2  
     3  // TextDocumentIdentifier contains the URL of the text document
     4  type TextDocumentIdentifier struct {
     5  	/**
     6  	 * The text document's URI.
     7  	 */
     8  	URI DocumentURI
     9  }
    10  
    11  // VersionedTextDocumentIdentifier allow clients to check the text document version before an edit is applied
    12  type VersionedTextDocumentIdentifier struct {
    13  	/**
    14  	 * Extending TextDocumentIdentifier
    15  	 */
    16  	*TextDocumentIdentifier
    17  
    18  	/**
    19  	 * The version number of this document. If a versioned text document identifier
    20  	 * is sent from the server to the client and the file is not open in the editor
    21  	 * (the server has not received an open notification before) the server can send
    22  	 * `null` to indicate that the version is known and the content on disk is the
    23  	 * truth (as speced with document content ownership).
    24  	 *
    25  	 * The version number of a document will increase after each change, including
    26  	 * undo/redo. The number doesn't need to be consecutive.
    27  	 */
    28  
    29  	Version int `json:"version"`
    30  }
    31  
    32  // TextEdit represents complex text manipulations are described with an array of TextEdit’s,
    33  // representing a single change to the document.
    34  type TextEdit struct {
    35  	/**
    36  	 * The range of the text document to be manipulated. To insert
    37  	 * text into a document create a range where start === end.
    38  	 */
    39  	Range Range `json:"range"`
    40  
    41  	/**
    42  	 * The string to be inserted. For delete operations use an
    43  	 * empty string.
    44  	 */
    45  	NewText string `json:"newText"`
    46  }
    47  
    48  // TextDocumentEdit describes all changes on a version Si and after they are applied move the document to version Si+1
    49  type TextDocumentEdit struct {
    50  	/**
    51  	 * The text document to change.
    52  	 */
    53  	TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`
    54  
    55  	Edits []TextEdit
    56  }
    57  
    58  // TextDocumentItem is an item to transfer a text document from the client to the server
    59  type TextDocumentItem struct {
    60  	/**
    61  	 * The text document's URI.
    62  	 */
    63  	URI DocumentURI `json:"uri"`
    64  
    65  	/**
    66  	 * The text document's language identifier.
    67  	 */
    68  	LanguageID string `json:"languageId"`
    69  
    70  	/**
    71  	 * The version number of this document (it will strictly increase after each
    72  	 * change, including undo/redo).
    73  	 */
    74  	Version int `json:"version"`
    75  
    76  	/**
    77  	 * The content of the opened text document.
    78  	 */
    79  	Text string `json:"text"`
    80  }
    81  
    82  // TextDocumentClientCapabilities define capabilities the editor / tool provides on text documents.
    83  // TODO: work out if this is being dynamically filled in
    84  type TextDocumentClientCapabilities struct {
    85  	Completion Completion `json:"completion, omitempty"`
    86  }
    87  
    88  // Completion is Capabilities specific to the `textDocument/completion`, referenced in TextDocumentClientCapabilities
    89  type Completion struct {
    90  	/**
    91  	 * Whether completion supports dynamic registration.
    92  	 */
    93  	DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
    94  
    95  	/**
    96  	 * The client supports the following `CompletionItem` specific
    97  	 * capabilities.
    98  	 */
    99  	CompletionItem struct {
   100  		SnippetSupport bool `json:"snippetSupport,omitempty"`
   101  	} `json:"completionItem,omitempty"`
   102  
   103  	/**
   104  	 * The completion item kind values the client supports. When this
   105  	 * property exists the client also guarantees that it will
   106  	 * handle values outside its set gracefully and falls back
   107  	 * to a default value when unknown.
   108  	 *
   109  	 * If this property is not present the client only supports
   110  	 * the completion items kinds from `Text` to `Reference` as defined in
   111  	 * the initial version of the protocol.
   112  	 */
   113  	CompletionItemKind struct {
   114  		ValueSet []CompletionItemKind `json:"valueSet,omitempty"`
   115  	} `json:"completionItem,omitempty"`
   116  }