Bug fixes and new fields added to LSP (#328) · microsoft/lsprotocol@c6bb31e · GitHub
Skip to content

Commit c6bb31e

Browse files
authored
Bug fixes and new fields added to LSP (#328)
Closes #326
1 parent 36b1ab1 commit c6bb31e

6 files changed

Lines changed: 354 additions & 112 deletions

File tree

‎generator/lsp.json‎

Lines changed: 67 additions & 1 deletion

‎noxfile.py‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ def lint(session: nox.Session):
3939
session.run("ruff", "--version")
4040
session.run("mypy", "--version")
4141

42-
session.run("ruff", "check", ".")
43-
session.run("ruff", "check", "--select=I001", ".")
4442
session.run("ruff", "format", "--check", ".")
43+
4544
session.run("mypy", "--strict", "--no-incremental", "./packages/python/lsprotocol")
4645

4746
session.log("Linting: generated Rust code.")
@@ -59,10 +58,7 @@ def format(session: nox.Session):
5958
def _format_code(session: nox.Session):
6059
session.install("ruff")
6160
session.run("ruff", "--version")
62-
63-
session.run("ruff", "check", "--fix", "--select=I001", ".")
6461
session.run("ruff", "format", ".")
65-
session.run("ruff", "check", "--fix", ".")
6662

6763

6864
@nox.session()

‎packages/python/lsprotocol/types.py‎

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
import enum
1111
import functools
1212
from typing import Any, Dict, Optional, Sequence, Tuple, Union
13-
1413
import attrs
15-
1614
from . import validators
1715

1816
__lsp_version__ = "3.17.0"
@@ -454,6 +452,12 @@ class CodeActionKind(str, enum.Enum):
454452
455453
@since 3.15.0"""
456454
# Since: 3.15.0
455+
Notebook = "notebook"
456+
"""Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using
457+
this should always begin with `notebook.`
458+
459+
@since 3.18.0"""
460+
# Since: 3.18.0
457461

458462

459463
@enum.unique
@@ -4038,6 +4042,17 @@ class Command:
40384042
command: str = attrs.field(validator=attrs.validators.instance_of(str))
40394043
"""The identifier of the actual command handler."""
40404044

4045+
tooltip: Optional[str] = attrs.field(
4046+
validator=attrs.validators.optional(attrs.validators.instance_of(str)),
4047+
default=None,
4048+
)
4049+
"""An optional tooltip.
4050+
4051+
@since 3.18.0
4052+
@proposed"""
4053+
# Since: 3.18.0
4054+
# Proposed
4055+
40414056
arguments: Optional[Sequence[LSPAny]] = attrs.field(default=None)
40424057
"""Arguments that the command handler should be
40434058
invoked with."""
@@ -4120,6 +4135,27 @@ class CodeActionOptions:
41204135
The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
41214136
may list out every specific kind they provide."""
41224137

4138+
documentation: Optional[Sequence["CodeActionKindDocumentation"]] = attrs.field(
4139+
default=None
4140+
)
4141+
"""Static documentation for a class of code actions.
4142+
4143+
Documentation from the provider should be shown in the code actions menu if either:
4144+
4145+
- Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that
4146+
most closely matches the requested code action kind. For example, if a provider has documentation for
4147+
both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
4148+
the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.
4149+
4150+
- Any code actions of `kind` are returned by the provider.
4151+
4152+
At most one documentation entry should be shown per provider.
4153+
4154+
@since 3.18.0
4155+
@proposed"""
4156+
# Since: 3.18.0
4157+
# Proposed
4158+
41234159
resolve_provider: Optional[bool] = attrs.field(
41244160
validator=attrs.validators.optional(attrs.validators.instance_of(bool)),
41254161
default=None,
@@ -4154,6 +4190,27 @@ class CodeActionRegistrationOptions:
41544190
The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
41554191
may list out every specific kind they provide."""
41564192

4193+
documentation: Optional[Sequence["CodeActionKindDocumentation"]] = attrs.field(
4194+
default=None
4195+
)
4196+
"""Static documentation for a class of code actions.
4197+
4198+
Documentation from the provider should be shown in the code actions menu if either:
4199+
4200+
- Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that
4201+
most closely matches the requested code action kind. For example, if a provider has documentation for
4202+
both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
4203+
the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.
4204+
4205+
- Any code actions of `kind` are returned by the provider.
4206+
4207+
At most one documentation entry should be shown per provider.
4208+
4209+
@since 3.18.0
4210+
@proposed"""
4211+
# Since: 3.18.0
4212+
# Proposed
4213+
41574214
resolve_provider: Optional[bool] = attrs.field(
41584215
validator=attrs.validators.optional(attrs.validators.instance_of(bool)),
41594216
default=None,
@@ -6855,6 +6912,10 @@ class ParameterInformation:
68556912
signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
68566913
string representation as `Position` and `Range` does.
68576914
6915+
To avoid ambiguities a server should use the [start, end] offset value instead of using
6916+
a substring. Whether a client support this is controlled via `labelOffsetSupport` client
6917+
capability.
6918+
68586919
*Note*: a label of type string should be a substring of its containing signature label.
68596920
Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`."""
68606921

@@ -6863,6 +6924,29 @@ class ParameterInformation:
68636924
in the UI but can be omitted."""
68646925

68656926

6927+
@attrs.define
6928+
class CodeActionKindDocumentation:
6929+
"""Documentation for a class of code actions.
6930+
6931+
@since 3.18.0
6932+
@proposed"""
6933+
6934+
# Since: 3.18.0
6935+
# Proposed
6936+
6937+
kind: Union[CodeActionKind, str] = attrs.field()
6938+
"""The kind of the code action being documented.
6939+
6940+
If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any
6941+
refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the
6942+
documentation will only be shown when extract refactoring code actions are returned."""
6943+
6944+
command: Command = attrs.field()
6945+
"""Command that is ued to display the documentation to the user.
6946+
6947+
The title of this documentation code action is taken from {@linkcode Command.title}"""
6948+
6949+
68666950
@attrs.define
68676951
class NotebookCellTextDocumentFilter:
68686952
"""A notebook cell text document filter denotes a cell text
@@ -8238,6 +8322,18 @@ class CodeActionClientCapabilities:
82388322
@since 3.16.0"""
82398323
# Since: 3.16.0
82408324

8325+
documentation_support: Optional[bool] = attrs.field(
8326+
validator=attrs.validators.optional(attrs.validators.instance_of(bool)),
8327+
default=None,
8328+
)
8329+
"""Whether the client supports documentation for a class of
8330+
code actions.
8331+
8332+
@since 3.18.0
8333+
@proposed"""
8334+
# Since: 3.18.0
8335+
# Proposed
8336+
82418337

82428338
@attrs.define
82438339
class CodeLensClientCapabilities:
@@ -12726,6 +12822,7 @@ def is_special_property(cls: type, property_name: str) -> bool:
1272612822
"CodeActionContext": CodeActionContext,
1272712823
"CodeActionDisabled": CodeActionDisabled,
1272812824
"CodeActionKind": CodeActionKind,
12825+
"CodeActionKindDocumentation": CodeActionKindDocumentation,
1272912826
"CodeActionOptions": CodeActionOptions,
1273012827
"CodeActionParams": CodeActionParams,
1273112828
"CodeActionRegistrationOptions": CodeActionRegistrationOptions,

‎packages/rust/lsprotocol/Cargo.toml‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)