Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions generator/lsp.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"kind": "reference",
"name": "ImplementationRegistrationOptions"
},
"documentation": "A request to resolve the implementation locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type {@link Definition} or a\nThenable that resolves to such."
"documentation": "A request to resolve the implementation locations of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPositionParams}\nthe response is of type {@link Definition} or a Thenable that resolves to such."
},
{
"method": "textDocument/typeDefinition",
Expand Down Expand Up @@ -105,7 +105,7 @@
"kind": "reference",
"name": "TypeDefinitionRegistrationOptions"
},
"documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type {@link Definition} or a\nThenable that resolves to such."
"documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPositionParams}\nthe response is of type {@link Definition} or a Thenable that resolves to such."
},
{
"method": "workspace/workspaceFolders",
Expand Down Expand Up @@ -293,7 +293,7 @@
"kind": "reference",
"name": "DeclarationRegistrationOptions"
},
"documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type {@link Declaration}\nor a typed array of {@link DeclarationLink} or a Thenable that resolves\nto such."
"documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPositionParams}\nthe response is of type {@link Declaration} or a typed array of {@link DeclarationLink}\nor a Thenable that resolves to such."
},
{
"method": "textDocument/selectionRange",
Expand Down Expand Up @@ -1274,7 +1274,7 @@
"kind": "reference",
"name": "DefinitionRegistrationOptions"
},
"documentation": "A request to resolve the definition location of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPosition]\n(#TextDocumentPosition) the response is of either type {@link Definition}\nor a typed array of {@link DefinitionLink} or a Thenable that resolves\nto such."
"documentation": "A request to resolve the definition location of a symbol at a given text\ndocument position. The request's parameter is of type {@link TextDocumentPosition}\nthe response is of either type {@link Definition} or a typed array of\n{@link DefinitionLink} or a Thenable that resolves to such."
},
{
"method": "textDocument/references",
Expand Down Expand Up @@ -1346,7 +1346,7 @@
"kind": "reference",
"name": "DocumentHighlightRegistrationOptions"
},
"documentation": "Request to resolve a {@link DocumentHighlight} for a given\ntext document position. The request's parameter is of type [TextDocumentPosition]\n(#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\n(#DocumentHighlight) or a Thenable that resolves to such."
"documentation": "Request to resolve a {@link DocumentHighlight} for a given\ntext document position. The request's parameter is of type {@link TextDocumentPosition}\nthe request response is an array of type {@link DocumentHighlight}\nor a Thenable that resolves to such."
},
{
"method": "textDocument/documentSymbol",
Expand Down Expand Up @@ -5818,7 +5818,7 @@
"name": "LSPAny"
},
"optional": true,
"documentation": "A data entry field that is preserved on a code lens item between\na {@link CodeLensRequest} and a [CodeLensResolveRequest]\n(#CodeLensResolveRequest)"
"documentation": "A data entry field that is preserved on a code lens item between\na {@link CodeLensRequest} and a {@link CodeLensResolveRequest}"
}
],
"documentation": "A code lens represents a {@link Command command} that should be shown along with\nsource text, like the number of references, a way to run tests, etc.\n\nA code lens is _unresolved_ when no command is associated to it. For performance\nreasons the creation of a code lens and resolving should be done in two stages."
Expand Down Expand Up @@ -6754,7 +6754,7 @@
"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": "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`](#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`](#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.",
"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.",
"since": "3.17.0 - support for negotiated position encoding."
},
{
Expand Down Expand Up @@ -14590,7 +14590,7 @@
"name": "string"
},
"optional": true,
"documentation": "A glob pattern, like `*.{ts,js}`."
"documentation": "A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples`."
}
]
}
Expand Down Expand Up @@ -14623,7 +14623,7 @@
"name": "string"
},
"optional": true,
"documentation": "A glob pattern, like `*.{ts,js}`."
"documentation": "A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples`."
}
]
}
Expand Down Expand Up @@ -14656,7 +14656,7 @@
"kind": "base",
"name": "string"
},
"documentation": "A glob pattern, like `*.{ts,js}`."
"documentation": "A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples`."
}
]
}
Expand Down
31 changes: 15 additions & 16 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ def tests(session: nox.Session):
session.log("Running tests: generator and generated Python code.")
session.run("pytest", "./tests")

# TODO: Uncomment after tests are ready
# session.log("Running tests: generated Rust code.")
# with session.chdir("./tests/rust/lsprotocol"):
# session.run("cargo", "test", external=True)

# TODO: Uncomment after tests are ready
# session.log("Running tests: generated C# code.")
# with session.chdir("./test/dotnet/lsprotocol_tests"):
# session.run("dotnet", "test", external=True)


@nox.session()
def lint(session: nox.Session):
Expand All @@ -62,13 +52,22 @@ def format(session: nox.Session):
def _format_code(session: nox.Session):
session.install("isort", "black")

session.run("isort", "--profile", "black", ".")
session.run("black", ".")
session.run("isort", "--profile", "black", "noxfile.py")
session.run("black", "noxfile.py")

session.run("isort", "--profile", "black", "generator")
session.run("black", "generator")

session.run("isort", "--profile", "black", "tests/generator")
session.run("black", "tests/generator")

session.run("isort", "--profile", "black", "tests/python")
session.run("black", "tests/python")

# this is for the lsprotocol package only
python_package_path = pathlib.Path("./packages/python/lsprotocol")
session.run("isort", "--profile", "black", os.fspath(python_package_path))
session.run("black", os.fspath(python_package_path))
python_package_path = os.fspath(pathlib.Path("./packages/python/lsprotocol"))
session.run("isort", "--profile", "black", python_package_path)
session.run("black", python_package_path)


@nox.session()
Expand All @@ -92,7 +91,7 @@ def _get_content(uri) -> str:
MODEL = "https://raw.githubusercontent.com/microsoft/vscode-languageserver-node/main/protocol/metaModel.json"


def _download_models(session: nox.session):
def _download_models(session: nox.Session):
session.log("Downloading LSP model schema.")
model_schema_text: str = _get_content(MODEL_SCHEMA)
session.log("Downloading LSP model.")
Expand Down
43 changes: 19 additions & 24 deletions packages/python/lsprotocol/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ class TextDocumentFilter_Type1:
validator=attrs.validators.optional(attrs.validators.instance_of(str)),
default=None,
)
"""A glob pattern, like `*.{ts,js}`."""
"""A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples`."""


@attrs.define
Expand All @@ -883,13 +883,13 @@ class TextDocumentFilter_Type2:
validator=attrs.validators.optional(attrs.validators.instance_of(str)),
default=None,
)
"""A glob pattern, like `*.{ts,js}`."""
"""A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples`."""


@attrs.define
class TextDocumentFilter_Type3:
pattern: str = attrs.field(validator=attrs.validators.instance_of(str))
"""A glob pattern, like `*.{ts,js}`."""
"""A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples`."""

language: Optional[str] = attrs.field(
validator=attrs.validators.optional(attrs.validators.instance_of(str)),
Expand Down Expand Up @@ -4408,8 +4408,7 @@ class CodeLens:

data: Optional[LSPAny] = attrs.field(default=None)
"""A data entry field that is preserved on a code lens item between
a {@link CodeLensRequest} and a [CodeLensResolveRequest]
(#CodeLensResolveRequest)"""
a {@link CodeLensRequest} and a {@link CodeLensResolveRequest}"""


@attrs.define
Expand Down Expand Up @@ -5106,14 +5105,14 @@ class Position:
offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
Since 3.17 clients and servers can agree on a different string encoding
representation (e.g. UTF-8). The client announces it's supported encoding
via the client capability [`general.positionEncodings`](#clientCapabilities).
via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
The value is an array of position encodings the client supports, with
decreasing preference (e.g. the encoding at index `0` is the most preferred
one). To stay backwards compatible the only mandatory encoding is UTF-16
represented via the string `utf-16`. The server can pick one of the
encodings offered by the client and signals that encoding back to the
client via the initialize result's property
[`capabilities.positionEncoding`](#serverCapabilities). If the string value
[`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
`utf-16` is missing from the client's capability `general.positionEncodings`
servers can safely assume that the client supports UTF-16. If the server
omits the position encoding in its initialize result the encoding defaults
Expand Down Expand Up @@ -8877,9 +8876,8 @@ class ResponseErrorMessage:
@attrs.define
class TextDocumentImplementationRequest:
"""A request to resolve the implementation locations of a symbol at a given text
document position. The request's parameter is of type [TextDocumentPositionParams]
(#TextDocumentPositionParams) the response is of type {@link Definition} or a
Thenable that resolves to such."""
document position. The request's parameter is of type {@link TextDocumentPositionParams}
the response is of type {@link Definition} or a Thenable that resolves to such."""

id: Union[int, str] = attrs.field()
"""The request id."""
Expand All @@ -8900,9 +8898,8 @@ class TextDocumentImplementationResponse:
@attrs.define
class TextDocumentTypeDefinitionRequest:
"""A request to resolve the type definition locations of a symbol at a given text
document position. The request's parameter is of type [TextDocumentPositionParams]
(#TextDocumentPositionParams) the response is of type {@link Definition} or a
Thenable that resolves to such."""
document position. The request's parameter is of type {@link TextDocumentPositionParams}
the response is of type {@link Definition} or a Thenable that resolves to such."""

id: Union[int, str] = attrs.field()
"""The request id."""
Expand Down Expand Up @@ -9041,10 +9038,9 @@ class TextDocumentFoldingRangeResponse:
@attrs.define
class TextDocumentDeclarationRequest:
"""A request to resolve the type definition locations of a symbol at a given text
document position. The request's parameter is of type [TextDocumentPositionParams]
(#TextDocumentPositionParams) the response is of type {@link Declaration}
or a typed array of {@link DeclarationLink} or a Thenable that resolves
to such."""
document position. The request's parameter is of type {@link TextDocumentPositionParams}
the response is of type {@link Declaration} or a typed array of {@link DeclarationLink}
or a Thenable that resolves to such."""

id: Union[int, str] = attrs.field()
"""The request id."""
Expand Down Expand Up @@ -9897,10 +9893,9 @@ class TextDocumentSignatureHelpResponse:
@attrs.define
class TextDocumentDefinitionRequest:
"""A request to resolve the definition location of a symbol at a given text
document position. The request's parameter is of type [TextDocumentPosition]
(#TextDocumentPosition) the response is of either type {@link Definition}
or a typed array of {@link DefinitionLink} or a Thenable that resolves
to such."""
document position. The request's parameter is of type {@link TextDocumentPosition}
the response is of either type {@link Definition} or a typed array of
{@link DefinitionLink} or a Thenable that resolves to such."""

id: Union[int, str] = attrs.field()
"""The request id."""
Expand Down Expand Up @@ -9944,9 +9939,9 @@ class TextDocumentReferencesResponse:
@attrs.define
class TextDocumentDocumentHighlightRequest:
"""Request to resolve a {@link DocumentHighlight} for a given
text document position. The request's parameter is of type [TextDocumentPosition]
(#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
(#DocumentHighlight) or a Thenable that resolves to such."""
text document position. The request's parameter is of type {@link TextDocumentPosition}
the request response is an array of type {@link DocumentHighlight}
or a Thenable that resolves to such."""

id: Union[int, str] = attrs.field()
"""The request id."""
Expand Down
Loading