From 4f8a81e9570b29f9ad246e7e7ff4b8efbf9fdf14 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 4 Oct 2024 12:04:39 -0700 Subject: [PATCH 1/3] Use custom plugins --- generator/__main__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/generator/__main__.py b/generator/__main__.py index f5f681e..0432d8a 100644 --- a/generator/__main__.py +++ b/generator/__main__.py @@ -61,6 +61,16 @@ def get_parser() -> argparse.ArgumentParser: return parser +def custom_plugin(plugin: str) -> None: + LOGGER.info(f"Loading plugin: {plugin}.") + try: + plugin_module = importlib.import_module(plugin) + except ImportError: + LOGGER.info(f"Loading plugin: generator.plugins.{plugin}.") + plugin_module = importlib.import_module(f"generator.plugins.{plugin}") + return plugin_module + + def main(argv: Sequence[str]) -> None: parser = get_parser() args = parser.parse_args(argv) @@ -95,8 +105,7 @@ def main(argv: Sequence[str]) -> None: spec: model.LSPModel = model.create_lsp_model(json_models) try: - LOGGER.info(f"Loading plugin: {plugin}.") - plugin_module = importlib.import_module(f"generator.plugins.{plugin}") + plugin_module = custom_plugin(plugin) LOGGER.info(f"Running plugin: {plugin}.") plugin_module.generate(spec, output_dir, test_dir) LOGGER.info(f"Plugin {plugin} completed.") From 216555aded8c5919415c5625226f6e4c895ad04d Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 4 Oct 2024 12:13:21 -0700 Subject: [PATCH 2/3] Code Action Tag feature for LLMs --- generator/lsp.json | 129 ++++++++++++++++++++- packages/python/lsprotocol/types.py | 167 ++++++++++++++++++++++++++- packages/python/requirements.txt | 6 +- packages/rust/lsprotocol/src/lib.rs | 171 +++++++++++++++++++++++++++- requirements.txt | 30 ++--- 5 files changed, 479 insertions(+), 24 deletions(-) diff --git a/generator/lsp.json b/generator/lsp.json index fd30606..11de032 100644 --- a/generator/lsp.json +++ b/generator/lsp.json @@ -5168,9 +5168,19 @@ "name": "CompletionItemDefaults" }, "optional": true, - "documentation": "In many cases the items of an actual completion result share the same\nvalue for properties like `commitCharacters` or the range of a text\nedit. A completion list can therefore define item defaults which will\nbe used if a completion item itself doesn't specify the value.\n\nIf a completion list specifies a default value and a completion item\nalso specifies a corresponding value the one from the item is used.\n\nServers are only allowed to return default values if the client\nsignals support for this via the `completionList.itemDefaults`\ncapability.\n\n@since 3.17.0", + "documentation": "In many cases the items of an actual completion result share the same\nvalue for properties like `commitCharacters` or the range of a text\nedit. A completion list can therefore define item defaults which will\nbe used if a completion item itself doesn't specify the value.\n\nIf a completion list specifies a default value and a completion item\nalso specifies a corresponding value, the rules for combining these are\ndefined by `applyKinds` (if the client supports it), defaulting to\n\"replace\".\n\nServers are only allowed to return default values if the client\nsignals support for this via the `completionList.itemDefaults`\ncapability.\n\n@since 3.17.0", "since": "3.17.0" }, + { + "name": "applyKind", + "type": { + "kind": "reference", + "name": "CompletionItemApplyKinds" + }, + "optional": true, + "documentation": "Specifies how fields from a completion item should be combined with those\nfrom `completionList.itemDefaults`.\n\nIf unspecified, all fields will be treated as \"replace\".\n\nIf a field's value is \"replace\", the value from a completion item (if\nprovided and not `null`) will always be used instead of the value from\n`completionItem.itemDefaults`.\n\nIf a field's value is \"merge\", the values will be merged using the rules\ndefined against each field below.\n\nServers are only allowed to return `applyKind` if the client\nsignals support for this via the `completionList.applyKindSupport`\ncapability.\n\n@since 3.18.0", + "since": "3.18.0" + }, { "name": "items", "type": { @@ -5812,6 +5822,19 @@ "optional": true, "documentation": "A data entry field that is preserved on a code action between\na `textDocument/codeAction` and a `codeAction/resolve` request.\n\n@since 3.16.0", "since": "3.16.0" + }, + { + "name": "tags", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CodeActionTag" + } + }, + "optional": true, + "documentation": "Tags for this code action.\n\n@since 3.18.0 - proposed", + "since": "3.18.0 - proposed" } ], "documentation": "A code action represents a change that can be performed in code, e.g. to fix a problem or\nto refactor code.\n\nA CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed." @@ -9182,9 +9205,36 @@ "since": "3.17.0" } ], - "documentation": "In many cases the items of an actual completion result share the same\nvalue for properties like `commitCharacters` or the range of a text\nedit. A completion list can therefore define item defaults which will\nbe used if a completion item itself doesn't specify the value.\n\nIf a completion list specifies a default value and a completion item\nalso specifies a corresponding value the one from the item is used.\n\nServers are only allowed to return default values if the client\nsignals support for this via the `completionList.itemDefaults`\ncapability.\n\n@since 3.17.0", + "documentation": "In many cases the items of an actual completion result share the same\nvalue for properties like `commitCharacters` or the range of a text\nedit. A completion list can therefore define item defaults which will\nbe used if a completion item itself doesn't specify the value.\n\nIf a completion list specifies a default value and a completion item\nalso specifies a corresponding value, the rules for combining these are\ndefined by `applyKinds` (if the client supports it), defaulting to\n\"replace\".\n\nServers are only allowed to return default values if the client\nsignals support for this via the `completionList.itemDefaults`\ncapability.\n\n@since 3.17.0", "since": "3.17.0" }, + { + "name": "CompletionItemApplyKinds", + "properties": [ + { + "name": "commitCharacters", + "type": { + "kind": "reference", + "name": "ApplyKind" + }, + "optional": true, + "documentation": "Specifies whether commitCharacters on a completion will replace or be\nmerged with those in `completionList.itemDefaults.commitCharacters`.\n\nIf \"replace\", the commit characters from the completion item will\nalways be used unless not provided, in which case those from\n`completionList.itemDefaults.commitCharacters` will be used. An\nempty list can be used if a completion item does not have any commit\ncharacters and also should not use those from\n`completionList.itemDefaults.commitCharacters`.\n\nIf \"merge\" the commitCharacters for the completion will be the union\nof all values in both `completionList.itemDefaults.commitCharacters`\nand the completion's own `commitCharacters`.\n\n@since 3.18.0", + "since": "3.18.0" + }, + { + "name": "data", + "type": { + "kind": "reference", + "name": "ApplyKind" + }, + "optional": true, + "documentation": "Specifies whether the `data` field on a completion will replace or\nbe merged with data from `completionList.itemDefaults.data`.\n\nIf \"replace\", the data from the completion item will be used if\nprovided (and not `null`), otherwise\n`completionList.itemDefaults.data` will be used. An empty object can\nbe used if a completion item does not have any data but also should\nnot use the value from `completionList.itemDefaults.data`.\n\nIf \"merge\", a shallow merge will be performed between\n`completionList.itemDefaults.data` and the completion's own data\nusing the following rules:\n\n- If a completion's `data` field is not provided (or `null`), the\n entire `data` field from `completionList.itemDefaults.data` will be\n used as-is.\n- If a completion's `data` field is provided, each field will\n overwrite the field of the same name in\n `completionList.itemDefaults.data` but no merging of nested fields\n within that value will occur.\n\n@since 3.18.0", + "since": "3.18.0" + } + ], + "documentation": "Specifies how fields from a completion item should be combined with those\nfrom `completionList.itemDefaults`.\n\nIf unspecified, all fields will be treated as \"replace\".\n\nIf a field's value is \"replace\", the value from a completion item (if\nprovided and not `null`) will always be used instead of the value from\n`completionItem.itemDefaults`.\n\nIf a field's value is \"merge\", the values will be merged using the rules\ndefined against each field below.\n\nServers are only allowed to return `applyKind` if the client\nsignals support for this via the `completionList.applyKindSupport`\ncapability.\n\n@since 3.18.0", + "since": "3.18.0" + }, { "name": "CompletionOptions", "properties": [ @@ -12681,6 +12731,16 @@ "documentation": "Whether the client supports documentation for a class of\ncode actions.\n\n@since 3.18.0\n@proposed", "since": "3.18.0", "proposed": true + }, + { + "name": "tagSupport", + "type": { + "kind": "reference", + "name": "CodeActionTagOptions" + }, + "optional": true, + "documentation": "Client supports the tag property on a code action. Clients\nsupporting tags have to handle unknown tags gracefully.\n\n@since 3.18.0 - proposed", + "since": "3.18.0 - proposed" } ], "documentation": "The Client Capabilities of a {@link CodeActionRequest}." @@ -13537,6 +13597,16 @@ "optional": true, "documentation": "The client supports the following itemDefaults on\na completion list.\n\nThe value lists the supported property names of the\n`CompletionList.itemDefaults` object. If omitted\nno properties are supported.\n\n@since 3.17.0", "since": "3.17.0" + }, + { + "name": "applyKindSupport", + "type": { + "kind": "base", + "name": "boolean" + }, + "optional": true, + "documentation": "Specifies whether the client supports `CompletionList.applyKind` to\nindicate how supported values from `completionList.itemDefaults`\nand `completion` will be combined.\n\nIf a client supports `applyKind` it must support it for all fields\nthat it supports that are listed in `CompletionList.applyKind`. This\nmeans when clients add support for new/future fields in completion\nitems the MUST also support merge for them if those fields are\ndefined in `CompletionList.applyKind`.\n\n@since 3.18.0", + "since": "3.18.0" } ], "documentation": "The client supports the following `CompletionList` specific\ncapabilities.\n\n@since 3.17.0", @@ -13624,6 +13694,24 @@ "documentation": "@since 3.18.0", "since": "3.18.0" }, + { + "name": "CodeActionTagOptions", + "properties": [ + { + "name": "valueSet", + "type": { + "kind": "array", + "element": { + "kind": "reference", + "name": "CodeActionTag" + } + }, + "documentation": "The tags supported by the client." + } + ], + "documentation": "@since 3.18.0 - proposed", + "since": "3.18.0 - proposed" + }, { "name": "ClientCodeLensResolveOptions", "properties": [ @@ -14772,6 +14860,22 @@ "supportsCustomValues": true, "documentation": "A set of predefined code action kinds" }, + { + "name": "CodeActionTag", + "type": { + "kind": "base", + "name": "uinteger" + }, + "values": [ + { + "name": "LLMGenerated", + "value": 1, + "documentation": "Marks the code action as LLM-generated." + } + ], + "documentation": "Code action tags are extra annotations that tweak the behavior of a code action.\n\n@since 3.18.0 - proposed", + "since": "3.18.0 - proposed" + }, { "name": "TraceValue", "type": { @@ -15257,6 +15361,27 @@ ], "documentation": "How a completion was triggered" }, + { + "name": "ApplyKind", + "type": { + "kind": "base", + "name": "string" + }, + "values": [ + { + "name": "Replace", + "value": "replace", + "documentation": "The value from the individual item (if provided and not `null`) will be\nused instead of the default." + }, + { + "name": "Merge", + "value": "merge", + "documentation": "The value from the item will be merged with the default.\n\nThe specific rules for mergeing values are defined against each field\nthat supports merging." + } + ], + "documentation": "Defines how values from a set of defaults and an individual item will be\nmerged.\n\n@since 3.18.0", + "since": "3.18.0" + }, { "name": "SignatureHelpTriggerKind", "type": { diff --git a/packages/python/lsprotocol/types.py b/packages/python/lsprotocol/types.py index bd5c0d9..9839e0d 100644 --- a/packages/python/lsprotocol/types.py +++ b/packages/python/lsprotocol/types.py @@ -463,6 +463,17 @@ class CodeActionKind(str, enum.Enum): # Since: 3.18.0 +@enum.unique +class CodeActionTag(int, enum.Enum): + """Code action tags are extra annotations that tweak the behavior of a code action. + + @since 3.18.0 - proposed""" + + # Since: 3.18.0 - proposed + LlmGenerated = 1 + """Marks the code action as LLM-generated.""" + + @enum.unique class TraceValue(str, enum.Enum): Off = "off" @@ -674,6 +685,24 @@ class CompletionTriggerKind(int, enum.Enum): """Completion was re-triggered as current completion list is incomplete""" +@enum.unique +class ApplyKind(str, enum.Enum): + """Defines how values from a set of defaults and an individual item will be + merged. + + @since 3.18.0""" + + # Since: 3.18.0 + Replace = "replace" + """The value from the individual item (if provided and not `null`) will be + used instead of the default.""" + Merge = "merge" + """The value from the item will be merged with the default. + + The specific rules for mergeing values are defined against each field + that supports merging.""" + + @enum.unique class SignatureHelpTriggerKind(int, enum.Enum): """How a signature help was triggered. @@ -3493,7 +3522,9 @@ class CompletionList: be used if a completion item itself doesn't specify the value. If a completion list specifies a default value and a completion item - also specifies a corresponding value the one from the item is used. + also specifies a corresponding value, the rules for combining these are + defined by `applyKinds` (if the client supports it), defaulting to + "replace". Servers are only allowed to return default values if the client signals support for this via the `completionList.itemDefaults` @@ -3502,6 +3533,26 @@ class CompletionList: @since 3.17.0""" # Since: 3.17.0 + apply_kind: Optional["CompletionItemApplyKinds"] = attrs.field(default=None) + """Specifies how fields from a completion item should be combined with those + from `completionList.itemDefaults`. + + If unspecified, all fields will be treated as "replace". + + If a field's value is "replace", the value from a completion item (if + provided and not `null`) will always be used instead of the value from + `completionItem.itemDefaults`. + + If a field's value is "merge", the values will be merged using the rules + defined against each field below. + + Servers are only allowed to return `applyKind` if the client + signals support for this via the `completionList.applyKindSupport` + capability. + + @since 3.18.0""" + # Since: 3.18.0 + @attrs.define class CompletionOptions: @@ -4206,6 +4257,12 @@ class CodeAction: @since 3.16.0""" # Since: 3.16.0 + tags: Optional[Sequence[CodeActionTag]] = attrs.field(default=None) + """Tags for this code action. + + @since 3.18.0 - proposed""" + # Since: 3.18.0 - proposed + @attrs.define class CodeActionOptions: @@ -6240,7 +6297,9 @@ class CompletionItemDefaults: be used if a completion item itself doesn't specify the value. If a completion list specifies a default value and a completion item - also specifies a corresponding value the one from the item is used. + also specifies a corresponding value, the rules for combining these are + defined by `applyKinds` (if the client supports it), defaulting to + "replace". Servers are only allowed to return default values if the client signals support for this via the `completionList.itemDefaults` @@ -6283,6 +6342,72 @@ class CompletionItemDefaults: # Since: 3.17.0 +@attrs.define +class CompletionItemApplyKinds: + """Specifies how fields from a completion item should be combined with those + from `completionList.itemDefaults`. + + If unspecified, all fields will be treated as "replace". + + If a field's value is "replace", the value from a completion item (if + provided and not `null`) will always be used instead of the value from + `completionItem.itemDefaults`. + + If a field's value is "merge", the values will be merged using the rules + defined against each field below. + + Servers are only allowed to return `applyKind` if the client + signals support for this via the `completionList.applyKindSupport` + capability. + + @since 3.18.0""" + + # Since: 3.18.0 + + commit_characters: Optional[ApplyKind] = attrs.field(default=None) + """Specifies whether commitCharacters on a completion will replace or be + merged with those in `completionList.itemDefaults.commitCharacters`. + + If "replace", the commit characters from the completion item will + always be used unless not provided, in which case those from + `completionList.itemDefaults.commitCharacters` will be used. An + empty list can be used if a completion item does not have any commit + characters and also should not use those from + `completionList.itemDefaults.commitCharacters`. + + If "merge" the commitCharacters for the completion will be the union + of all values in both `completionList.itemDefaults.commitCharacters` + and the completion's own `commitCharacters`. + + @since 3.18.0""" + # Since: 3.18.0 + + data: Optional[ApplyKind] = attrs.field(default=None) + """Specifies whether the `data` field on a completion will replace or + be merged with data from `completionList.itemDefaults.data`. + + If "replace", the data from the completion item will be used if + provided (and not `null`), otherwise + `completionList.itemDefaults.data` will be used. An empty object can + be used if a completion item does not have any data but also should + not use the value from `completionList.itemDefaults.data`. + + If "merge", a shallow merge will be performed between + `completionList.itemDefaults.data` and the completion's own data + using the following rules: + + - If a completion's `data` field is not provided (or `null`), the + entire `data` field from `completionList.itemDefaults.data` will be + used as-is. + - If a completion's `data` field is provided, each field will + overwrite the field of the same name in + `completionList.itemDefaults.data` but no merging of nested fields + within that value will occur. + + @since 3.18.0""" + # Since: 3.18.0 + + @attrs.define class SignatureHelpContext: """Additional information about the context in which a signature help request was triggered. @@ -8481,6 +8606,13 @@ class CodeActionClientCapabilities: # Since: 3.18.0 # Proposed + tag_support: Optional["CodeActionTagOptions"] = attrs.field(default=None) + """Client supports the tag property on a code action. Clients + supporting tags have to handle unknown tags gracefully. + + @since 3.18.0 - proposed""" + # Since: 3.18.0 - proposed + @attrs.define class CodeLensClientCapabilities: @@ -9291,6 +9423,23 @@ class CompletionListCapabilities: @since 3.17.0""" # Since: 3.17.0 + apply_kind_support: Optional[bool] = attrs.field( + validator=attrs.validators.optional(attrs.validators.instance_of(bool)), + default=None, + ) + """Specifies whether the client supports `CompletionList.applyKind` to + indicate how supported values from `completionList.itemDefaults` + and `completion` will be combined. + + If a client supports `applyKind` it must support it for all fields + that it supports that are listed in `CompletionList.applyKind`. This + means when clients add support for new/future fields in completion + items the MUST also support merge for them if those fields are + defined in `CompletionList.applyKind`. + + @since 3.18.0""" + # Since: 3.18.0 + @attrs.define class ClientSignatureInformationOptions: @@ -9352,6 +9501,16 @@ class ClientCodeActionResolveOptions: """The properties that a client can resolve lazily.""" +@attrs.define +class CodeActionTagOptions: + """@since 3.18.0 - proposed""" + + # Since: 3.18.0 - proposed + + value_set: Sequence[CodeActionTag] = attrs.field() + """The tags supported by the client.""" + + @attrs.define class ClientCodeLensResolveOptions: """@since 3.18.0""" @@ -13053,6 +13212,7 @@ def is_special_property(cls: type, property_name: str) -> bool: ALL_TYPES_MAP: Dict[str, Union[type, object]] = { "AnnotatedTextEdit": AnnotatedTextEdit, + "ApplyKind": ApplyKind, "ApplyWorkspaceEditParams": ApplyWorkspaceEditParams, "ApplyWorkspaceEditRequest": ApplyWorkspaceEditRequest, "ApplyWorkspaceEditResponse": ApplyWorkspaceEditResponse, @@ -13117,6 +13277,8 @@ def is_special_property(cls: type, property_name: str) -> bool: "CodeActionResolveResponse": CodeActionResolveResponse, "CodeActionResponse": CodeActionResponse, "CodeActionResult": CodeActionResult, + "CodeActionTag": CodeActionTag, + "CodeActionTagOptions": CodeActionTagOptions, "CodeActionTriggerKind": CodeActionTriggerKind, "CodeDescription": CodeDescription, "CodeLens": CodeLens, @@ -13144,6 +13306,7 @@ def is_special_property(cls: type, property_name: str) -> bool: "CompletionClientCapabilities": CompletionClientCapabilities, "CompletionContext": CompletionContext, "CompletionItem": CompletionItem, + "CompletionItemApplyKinds": CompletionItemApplyKinds, "CompletionItemDefaults": CompletionItemDefaults, "CompletionItemKind": CompletionItemKind, "CompletionItemLabelDetails": CompletionItemLabelDetails, diff --git a/packages/python/requirements.txt b/packages/python/requirements.txt index 1f72eb8..653f1da 100644 --- a/packages/python/requirements.txt +++ b/packages/python/requirements.txt @@ -10,9 +10,9 @@ attrs==24.2.0 \ # via # -r ./packages/python/requirements.in # cattrs -cattrs==23.2.3 \ - --hash=sha256:0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108 \ - --hash=sha256:a934090d95abaa9e911dac357e3a8699e0b4b14f8529bcc7d2b1ad9d51672b9f +cattrs==24.1.2 \ + --hash=sha256:67c7495b760168d931a10233f979b28dc04daf853b30752246f4f8471c6d68d0 \ + --hash=sha256:8028cfe1ff5382df59dd36474a86e02d817b06eaf8af84555441bac915d2ef85 # via -r ./packages/python/requirements.in exceptiongroup==1.2.2 \ --hash=sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b \ diff --git a/packages/rust/lsprotocol/src/lib.rs b/packages/rust/lsprotocol/src/lib.rs index 2555cf0..94838e9 100644 --- a/packages/rust/lsprotocol/src/lib.rs +++ b/packages/rust/lsprotocol/src/lib.rs @@ -1368,6 +1368,37 @@ pub enum CodeActionKind { Notebook, } +/// Code action tags are extra annotations that tweak the behavior of a code action. +/// +/// @since 3.18.0 - proposed +#[derive(PartialEq, Debug, Eq, Clone)] +pub enum CodeActionTag { + /// Marks the code action as LLM-generated. + Llmgenerated = 1, +} +impl Serialize for CodeActionTag { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + match self { + CodeActionTag::Llmgenerated => serializer.serialize_i32(1), + } + } +} +impl<'de> Deserialize<'de> for CodeActionTag { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let value = i32::deserialize(deserializer)?; + match value { + 1 => Ok(CodeActionTag::Llmgenerated), + _ => Err(serde::de::Error::custom("Unexpected value")), + } + } +} + #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] pub enum TraceValue { /// Turn tracing off. @@ -1864,6 +1895,25 @@ impl<'de> Deserialize<'de> for CompletionTriggerKind { } } +/// Defines how values from a set of defaults and an individual item will be +/// merged. +/// +/// @since 3.18.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +pub enum ApplyKind { + /// The value from the individual item (if provided and not `null`) will be + /// used instead of the default. + #[serde(rename = "replace")] + Replace, + + /// The value from the item will be merged with the default. + /// + /// The specific rules for mergeing values are defined against each field + /// that supports merging. + #[serde(rename = "merge")] + Merge, +} + /// How a signature help was triggered. /// /// @since 3.15.0 @@ -4086,6 +4136,25 @@ pub struct CompletionItem { #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionList { + /// Specifies how fields from a completion item should be combined with those + /// from `completionList.itemDefaults`. + /// + /// If unspecified, all fields will be treated as "replace". + /// + /// If a field's value is "replace", the value from a completion item (if + /// provided and not `null`) will always be used instead of the value from + /// `completionItem.itemDefaults`. + /// + /// If a field's value is "merge", the values will be merged using the rules + /// defined against each field below. + /// + /// Servers are only allowed to return `applyKind` if the client + /// signals support for this via the `completionList.applyKindSupport` + /// capability. + /// + /// @since 3.18.0 + pub apply_kind: Option, + /// This list it not complete. Further typing results in recomputing this list. /// /// Recomputed lists have all their items replaced (not appended) in the @@ -4098,7 +4167,9 @@ pub struct CompletionList { /// be used if a completion item itself doesn't specify the value. /// /// If a completion list specifies a default value and a completion item - /// also specifies a corresponding value the one from the item is used. + /// also specifies a corresponding value, the rules for combining these are + /// defined by `applyKinds` (if the client supports it), defaulting to + /// "replace". /// /// Servers are only allowed to return default values if the client /// signals support for this via the `completionList.itemDefaults` @@ -4593,6 +4664,11 @@ pub struct CodeAction { /// Used to filter code actions. pub kind: Option>, + /// Tags for this code action. + /// + /// @since 3.18.0 - proposed + pub tags: Option>, + /// A short, human-readable, title for this code action. pub title: String, } @@ -6413,7 +6489,9 @@ pub struct InsertReplaceEdit { /// be used if a completion item itself doesn't specify the value. /// /// If a completion list specifies a default value and a completion item -/// also specifies a corresponding value the one from the item is used. +/// also specifies a corresponding value, the rules for combining these are +/// defined by `applyKinds` (if the client supports it), defaulting to +/// "replace". /// /// Servers are only allowed to return default values if the client /// signals support for this via the `completionList.itemDefaults` @@ -6449,6 +6527,68 @@ pub struct CompletionItemDefaults { pub insert_text_mode: Option, } +/// Specifies how fields from a completion item should be combined with those +/// from `completionList.itemDefaults`. +/// +/// If unspecified, all fields will be treated as "replace". +/// +/// If a field's value is "replace", the value from a completion item (if +/// provided and not `null`) will always be used instead of the value from +/// `completionItem.itemDefaults`. +/// +/// If a field's value is "merge", the values will be merged using the rules +/// defined against each field below. +/// +/// Servers are only allowed to return `applyKind` if the client +/// signals support for this via the `completionList.applyKindSupport` +/// capability. +/// +/// @since 3.18.0 +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct CompletionItemApplyKinds { + /// Specifies whether commitCharacters on a completion will replace or be + /// merged with those in `completionList.itemDefaults.commitCharacters`. + /// + /// If "replace", the commit characters from the completion item will + /// always be used unless not provided, in which case those from + /// `completionList.itemDefaults.commitCharacters` will be used. An + /// empty list can be used if a completion item does not have any commit + /// characters and also should not use those from + /// `completionList.itemDefaults.commitCharacters`. + /// + /// If "merge" the commitCharacters for the completion will be the union + /// of all values in both `completionList.itemDefaults.commitCharacters` + /// and the completion's own `commitCharacters`. + /// + /// @since 3.18.0 + pub commit_characters: Option, + + /// Specifies whether the `data` field on a completion will replace or + /// be merged with data from `completionList.itemDefaults.data`. + /// + /// If "replace", the data from the completion item will be used if + /// provided (and not `null`), otherwise + /// `completionList.itemDefaults.data` will be used. An empty object can + /// be used if a completion item does not have any data but also should + /// not use the value from `completionList.itemDefaults.data`. + /// + /// If "merge", a shallow merge will be performed between + /// `completionList.itemDefaults.data` and the completion's own data + /// using the following rules: + /// + /// - If a completion's `data` field is not provided (or `null`), the + /// entire `data` field from `completionList.itemDefaults.data` will be + /// used as-is. + /// - If a completion's `data` field is provided, each field will + /// overwrite the field of the same name in + /// `completionList.itemDefaults.data` but no merging of nested fields + /// within that value will occur. + /// + /// @since 3.18.0 + pub data: Option, +} + /// Completion options. #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] @@ -8381,6 +8521,12 @@ pub struct CodeActionClientCapabilities { /// /// @since 3.16.0 pub resolve_support: Option, + + /// Client supports the tag property on a code action. Clients + /// supporting tags have to handle unknown tags gracefully. + /// + /// @since 3.18.0 - proposed + pub tag_support: Option, } /// The client capabilities of a [CodeLensRequest]. @@ -8926,6 +9072,19 @@ pub struct ClientCompletionItemOptionsKind { #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct CompletionListCapabilities { + /// Specifies whether the client supports `CompletionList.applyKind` to + /// indicate how supported values from `completionList.itemDefaults` + /// and `completion` will be combined. + /// + /// If a client supports `applyKind` it must support it for all fields + /// that it supports that are listed in `CompletionList.applyKind`. This + /// means when clients add support for new/future fields in completion + /// items the MUST also support merge for them if those fields are + /// defined in `CompletionList.applyKind`. + /// + /// @since 3.18.0 + pub apply_kind_support: Option, + /// The client supports the following itemDefaults on /// a completion list. /// @@ -8981,6 +9140,14 @@ pub struct ClientCodeActionResolveOptions { pub properties: Vec, } +/// @since 3.18.0 - proposed +#[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct CodeActionTagOptions { + /// The tags supported by the client. + pub value_set: Vec, +} + /// @since 3.18.0 #[derive(Serialize, Deserialize, PartialEq, Debug, Eq, Clone)] #[serde(rename_all = "camelCase", deny_unknown_fields)] diff --git a/requirements.txt b/requirements.txt index 7d1511c..fe49691 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,9 +12,9 @@ attrs==24.2.0 \ # cattrs # jsonschema # referencing -cattrs==23.2.3 \ - --hash=sha256:0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108 \ - --hash=sha256:a934090d95abaa9e911dac357e3a8699e0b4b14f8529bcc7d2b1ad9d51672b9f +cattrs==24.1.2 \ + --hash=sha256:67c7495b760168d931a10233f979b28dc04daf853b30752246f4f8471c6d68d0 \ + --hash=sha256:8028cfe1ff5382df59dd36474a86e02d817b06eaf8af84555441bac915d2ef85 # via -r ./requirements.in colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ @@ -26,9 +26,9 @@ exceptiongroup==1.2.2 \ # via # cattrs # pytest -importlib-resources==6.4.4 \ - --hash=sha256:20600c8b7361938dc0bb2d5ec0297802e575df486f5a544fa414da65e13721f7 \ - --hash=sha256:dda242603d1c9cd836c3368b1174ed74cb4049ecd209e7a1a0104620c18c5c11 +importlib-resources==6.4.5 \ + --hash=sha256:980862a1d16c9e147a59603677fa2aa5fd82b87f223b6cb870695bcfce830065 \ + --hash=sha256:ac29d5f956f01d5e4bb63102a5a19957f1b9175e45649977264a1416783bb717 # via # -r ./requirements.in # jsonschema @@ -61,9 +61,9 @@ pyhamcrest==2.1.0 \ --hash=sha256:c6acbec0923d0cb7e72c22af1926f3e7c97b8e8d69fc7498eabacaf7c975bd9c \ --hash=sha256:f6913d2f392e30e0375b3ecbd7aee79e5d1faa25d345c8f4ff597665dcac2587 # via -r ./requirements.in -pytest==8.3.2 \ - --hash=sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5 \ - --hash=sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce +pytest==8.3.3 \ + --hash=sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181 \ + --hash=sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2 # via -r ./requirements.in referencing==0.35.1 \ --hash=sha256:25b42124a6c8b632a425174f24087783efb348a6f1e0008e63cd4466fedf703c \ @@ -178,15 +178,15 @@ rpds-py==0.20.0 \ # via # jsonschema # referencing -tomli==2.0.1 \ - --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ - --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f +tomli==2.0.2 \ + --hash=sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38 \ + --hash=sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed # via pytest typing-extensions==4.12.2 \ --hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \ --hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8 # via cattrs -zipp==3.20.0 \ - --hash=sha256:0145e43d89664cfe1a2e533adc75adafed82fe2da404b4bbb6b026c0157bdb31 \ - --hash=sha256:58da6168be89f0be59beb194da1250516fdaa062ccebd30127ac65d30045e10d +zipp==3.20.2 \ + --hash=sha256:a817ac80d6cf4b23bf7f2828b7cabf326f15a001bea8b1f9b49631780ba28350 \ + --hash=sha256:bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29 # via importlib-resources From 2c118feb26e2c24f41cd1c6d00ee595a014f39f4 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 4 Oct 2024 12:17:09 -0700 Subject: [PATCH 3/3] Update package version --- packages/python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/pyproject.toml b/packages/python/pyproject.toml index c54934a..812dd73 100644 --- a/packages/python/pyproject.toml +++ b/packages/python/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] name = "lsprotocol" description = 'Python types for Language Server Protocol.' -version = "2024.0.0a3" +version = "2024.0.0b1" authors = [ { name = "Microsoft Corporation", email = "lsprotocol-help@microsoft.com" }, ]