diff --git a/generator/lsp.json b/generator/lsp.json index 3139ecd..fd30606 100644 --- a/generator/lsp.json +++ b/generator/lsp.json @@ -1068,8 +1068,8 @@ "method": "workspace/textDocumentContent", "typeName": "TextDocumentContentRequest", "result": { - "kind": "base", - "name": "string" + "kind": "reference", + "name": "TextDocumentContentResult" }, "messageDirection": "clientToServer", "params": { @@ -4420,6 +4420,22 @@ "since": "3.18.0", "proposed": true }, + { + "name": "TextDocumentContentResult", + "properties": [ + { + "name": "text", + "type": { + "kind": "base", + "name": "string" + }, + "documentation": "The text content of the text document. Please note, that the content of\nany subsequent open notifications for the text document might differ\nfrom the returned content due to whitespace and line ending\nnormalizations done on the client" + } + ], + "documentation": "Result of the `workspace/textDocumentContent` request.\n\n@since 3.18.0\n@proposed", + "since": "3.18.0", + "proposed": true + }, { "name": "TextDocumentContentRegistrationOptions", "properties": [], @@ -6876,7 +6892,7 @@ "kind": "base", "name": "uinteger" }, - "documentation": "Line position in a document (zero-based).\n\nIf a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.\nIf a line number is negative, it defaults to 0." + "documentation": "Line position in a document (zero-based)." }, { "name": "character", @@ -6884,7 +6900,7 @@ "kind": "base", "name": "uinteger" }, - "documentation": "Character offset on a line in a document (zero-based).\n\nThe meaning of this offset is determined by the negotiated\n`PositionEncodingKind`.\n\nIf the character value is greater than the line length it defaults back to the\nline length." + "documentation": "Character offset on a line in a document (zero-based).\n\nThe meaning of this offset is determined by the negotiated\n`PositionEncodingKind`." } ], "documentation": "Position in a text document expressed as zero-based line and character\noffset. Prior to 3.17 the offsets were always based on a UTF-16 string\nrepresentation. So a string of the form `a𐐀b` the character offset of the\ncharacter `a` is 0, the character offset of `𐐀` is 1 and the character\noffset of b is 3 since `𐐀` is represented using two code units in UTF-16.\nSince 3.17 clients and servers can agree on a different string encoding\nrepresentation (e.g. UTF-8). The client announces it's supported encoding\nvia the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).\nThe value is an array of position encodings the client supports, with\ndecreasing preference (e.g. the encoding at index `0` is the most preferred\none). To stay backwards compatible the only mandatory encoding is UTF-16\nrepresented via the string `utf-16`. The server can pick one of the\nencodings offered by the client and signals that encoding back to the\nclient via the initialize result's property\n[`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value\n`utf-16` is missing from the client's capability `general.positionEncodings`\nservers can safely assume that the client supports UTF-16. If the server\nomits the position encoding in its initialize result the encoding defaults\nto the string value `utf-16`. Implementation considerations: since the\nconversion from one encoding into another requires the content of the\nfile / line the conversion is best done where the file is read which is\nusually on the server side.\n\nPositions are line end character agnostic. So you can not specify a position\nthat denotes `\\r|\\n` or `\\n|` where `|` represents the character offset.\n\n@since 3.17.0 - support for negotiated position encoding.", @@ -7970,12 +7986,15 @@ "name": "TextDocumentContentOptions", "properties": [ { - "name": "scheme", + "name": "schemes", "type": { - "kind": "base", - "name": "string" + "kind": "array", + "element": { + "kind": "base", + "name": "string" + } }, - "documentation": "The scheme for which the server provides content." + "documentation": "The schemes for which the server provides content." } ], "documentation": "Text document content provider options.\n\n@since 3.18.0\n@proposed", diff --git a/packages/python/lsprotocol/types.py b/packages/python/lsprotocol/types.py index a7d6d16..bd5c0d9 100644 --- a/packages/python/lsprotocol/types.py +++ b/packages/python/lsprotocol/types.py @@ -2826,6 +2826,23 @@ class TextDocumentContentParams: """The uri of the text document.""" +@attrs.define +class TextDocumentContentResult: + """Result of the `workspace/textDocumentContent` request. + + @since 3.18.0 + @proposed""" + + # Since: 3.18.0 + # Proposed + + text: str = attrs.field(validator=attrs.validators.instance_of(str)) + """The text content of the text document. Please note, that the content of + any subsequent open notifications for the text document might differ + from the returned content due to whitespace and line ending + normalizations done on the client""" + + @attrs.define class TextDocumentContentOptions: """Text document content provider options. @@ -2836,8 +2853,8 @@ class TextDocumentContentOptions: # Since: 3.18.0 # Proposed - scheme: str = attrs.field(validator=attrs.validators.instance_of(str)) - """The scheme for which the server provides content.""" + schemes: Sequence[str] = attrs.field() + """The schemes for which the server provides content.""" @attrs.define @@ -2850,8 +2867,8 @@ class TextDocumentContentRegistrationOptions: # Since: 3.18.0 # Proposed - scheme: str = attrs.field(validator=attrs.validators.instance_of(str)) - """The scheme for which the server provides content.""" + schemes: Sequence[str] = attrs.field() + """The schemes for which the server provides content.""" id: Optional[str] = attrs.field( validator=attrs.validators.optional(attrs.validators.instance_of(str)), @@ -5159,19 +5176,13 @@ class Position: # Since: 3.17.0 - support for negotiated position encoding. line: int = attrs.field(validator=validators.uinteger_validator) - """Line position in a document (zero-based). - - If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. - If a line number is negative, it defaults to 0.""" + """Line position in a document (zero-based).""" character: int = attrs.field(validator=validators.uinteger_validator) """Character offset on a line in a document (zero-based). The meaning of this offset is determined by the negotiated - `PositionEncodingKind`. - - If the character value is greater than the line length it defaults back to the - line length.""" + `PositionEncodingKind`.""" def __eq__(self, o: object) -> bool: if not isinstance(o, Position): @@ -10442,9 +10453,6 @@ class InlineCompletionResponse: jsonrpc: str = attrs.field(default="2.0") -TextDocumentContentResult = str - - @attrs.define class TextDocumentContentRequest: """The `workspace/textDocumentContent` request is sent from the client to the diff --git a/packages/rust/lsprotocol/src/lib.rs b/packages/rust/lsprotocol/src/lib.rs index e175945..2555cf0 100644 --- a/packages/rust/lsprotocol/src/lib.rs +++ b/packages/rust/lsprotocol/src/lib.rs @@ -3576,6 +3576,21 @@ pub struct TextDocumentContentParams { pub uri: Url, } +/// Result of the `workspace/textDocumentContent` request. +/// +/// @since 3.18.0 +/// @proposed +#[cfg(feature = "proposed")] +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct TextDocumentContentResult { + /// The text content of the text document. Please note, that the content of + /// any subsequent open notifications for the text document might differ + /// from the returned content due to whitespace and line ending + /// normalizations done on the client + pub text: String, +} + /// Text document content provider registration options. /// /// @since 3.18.0 @@ -3588,8 +3603,8 @@ pub struct TextDocumentContentRegistrationOptions { /// the request again. See also Registration#id. pub id: Option, - /// The scheme for which the server provides content. - pub scheme: String, + /// The schemes for which the server provides content. + pub schemes: Vec, } /// Parameters for the `workspace/textDocumentContent/refresh` request. @@ -5326,15 +5341,9 @@ pub struct Position { /// /// The meaning of this offset is determined by the negotiated /// `PositionEncodingKind`. - /// - /// If the character value is greater than the line length it defaults back to the - /// line length. pub character: u32, /// Line position in a document (zero-based). - /// - /// If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. - /// If a line number is negative, it defaults to 0. pub line: u32, } @@ -5990,8 +5999,8 @@ pub struct InlineCompletionOptions { #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TextDocumentContentOptions { - /// The scheme for which the server provides content. - pub scheme: String, + /// The schemes for which the server provides content. + pub schemes: Vec, } /// General parameters to register for a notification or to register a provider. @@ -10811,7 +10820,7 @@ pub struct TextDocumentContentResponse { /// The request id. pub id: LSPIdOptional, - pub result: String, + pub result: TextDocumentContentResult, } /// The `workspace/textDocumentContent` request is sent from the server to the client to refresh diff --git a/requirements.txt b/requirements.txt index 150ef99..7d1511c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,9 +26,9 @@ exceptiongroup==1.2.2 \ # via # cattrs # pytest -importlib-resources==6.4.0 \ - --hash=sha256:50d10f043df931902d4194ea07ec57960f66a80449ff867bfe782b4c486ba78c \ - --hash=sha256:cdb2b453b8046ca4e3798eb1d84f3cce1446a0e8e7b5ef4efb600f19fc398145 +importlib-resources==6.4.4 \ + --hash=sha256:20600c8b7361938dc0bb2d5ec0297802e575df486f5a544fa414da65e13721f7 \ + --hash=sha256:dda242603d1c9cd836c3368b1174ed74cb4049ecd209e7a1a0104620c18c5c11 # via # -r ./requirements.in # jsonschema @@ -186,7 +186,7 @@ typing-extensions==4.12.2 \ --hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \ --hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8 # via cattrs -zipp==3.19.2 \ - --hash=sha256:bf1dcf6450f873a13e952a29504887c89e6de7506209e5b1bcc3460135d4de19 \ - --hash=sha256:f091755f667055f2d02b32c53771a7a6c8b47e1fdbc4b72a8b9072b3eef8015c +zipp==3.20.0 \ + --hash=sha256:0145e43d89664cfe1a2e533adc75adafed82fe2da404b4bbb6b026c0157bdb31 \ + --hash=sha256:58da6168be89f0be59beb194da1250516fdaa062ccebd30127ac65d30045e10d # via importlib-resources