diff --git a/pylsp_rope/refactoring.py b/pylsp_rope/refactoring.py index 09ca42d..09f915c 100644 --- a/pylsp_rope/refactoring.py +++ b/pylsp_rope/refactoring.py @@ -62,6 +62,7 @@ def get_code_action(self, title: str) -> typing.CodeAction: "title": title, "kind": self.kind, "command": { + "title": title, "command": self.name, "arguments": [self.arguments], }, diff --git a/pylsp_rope/typing.py b/pylsp_rope/typing.py index 5325464..8a88273 100644 --- a/pylsp_rope/typing.py +++ b/pylsp_rope/typing.py @@ -61,6 +61,7 @@ class Command(TypedDict): class CodeAction(TypedDict): + title: str kind: Optional[CodeActionKind] # diagnostics: Optional[List[Diagnostic]] # isPreferred: Optional[bool] diff --git a/test/test_extract.py b/test/test_extract.py index 491cff5..b229226 100644 --- a/test/test_extract.py +++ b/test/test_extract.py @@ -27,6 +27,7 @@ def test_extract_variable(config, workspace, code_action_context): "title": "Extract variable", "kind": "refactor.extract", "command": { + "title": "Extract variable", "command": commands.COMMAND_REFACTOR_EXTRACT_VARIABLE, "arguments": [ { @@ -79,6 +80,7 @@ def test_extract_variable_with_similar(config, workspace, code_action_context): "title": "Extract variable including similar statements", "kind": "refactor.extract", "command": { + "title": "Extract variable including similar statements", "command": commands.COMMAND_REFACTOR_EXTRACT_VARIABLE, "arguments": [ { @@ -133,6 +135,7 @@ def test_extract_global_variable(config, workspace, code_action_context): "title": "Extract global variable", "kind": "refactor.extract", "command": { + "title": "Extract global variable", "command": commands.COMMAND_REFACTOR_EXTRACT_VARIABLE, "arguments": [ { @@ -188,6 +191,7 @@ def test_extract_global_variable_with_similar(config, workspace, code_action_con "title": "Extract global variable including similar statements", "kind": "refactor.extract", "command": { + "title": "Extract global variable including similar statements", "command": commands.COMMAND_REFACTOR_EXTRACT_VARIABLE, "arguments": [ { @@ -262,6 +266,7 @@ def test_extract_method(config, workspace, code_action_context): "title": "Extract method", "kind": "refactor.extract", "command": { + "title": "Extract method", "command": commands.COMMAND_REFACTOR_EXTRACT_METHOD, "arguments": [ { @@ -312,6 +317,7 @@ def test_extract_method_with_similar(config, workspace, code_action_context): "title": "Extract method including similar statements", "kind": "refactor.extract", "command": { + "title": "Extract method including similar statements", "command": commands.COMMAND_REFACTOR_EXTRACT_METHOD, "arguments": [ { @@ -367,6 +373,7 @@ def test_extract_global_method(config, workspace, code_action_context): "title": "Extract global method", "kind": "refactor.extract", "command": { + "title": "Extract global method", "command": commands.COMMAND_REFACTOR_EXTRACT_METHOD, "arguments": [ { @@ -423,6 +430,7 @@ def test_extract_method_global_with_similar(config, workspace, code_action_conte "title": "Extract global method including similar statements", "kind": "refactor.extract", "command": { + "title": "Extract global method including similar statements", "command": commands.COMMAND_REFACTOR_EXTRACT_METHOD, "arguments": [ { diff --git a/test/test_generate.py b/test/test_generate.py index 2ae0870..9525fdf 100644 --- a/test/test_generate.py +++ b/test/test_generate.py @@ -22,6 +22,7 @@ def test_generate_variable(config, workspace, code_action_context): "title": "Generate variable", "kind": "quickfix", "command": { + "title": "Generate variable", "command": commands.COMMAND_GENERATE_CODE, "arguments": [ { @@ -71,6 +72,7 @@ def test_generate_function(config, workspace, code_action_context): "title": "Generate function", "kind": "quickfix", "command": { + "title": "Generate function", "command": commands.COMMAND_GENERATE_CODE, "arguments": [ { @@ -120,6 +122,7 @@ def test_generate_class(config, workspace, code_action_context): "title": "Generate class", "kind": "quickfix", "command": { + "title": "Generate class", "command": commands.COMMAND_GENERATE_CODE, "arguments": [ { diff --git a/test/test_import_utils.py b/test/test_import_utils.py index 5920258..02d7fee 100644 --- a/test/test_import_utils.py +++ b/test/test_import_utils.py @@ -26,6 +26,7 @@ def test_organize_import(config, workspace, document, code_action_context): "title": "Organize import", "kind": "source.organizeImports", "command": { + "title": "Organize import", "command": commands.COMMAND_SOURCE_ORGANIZE_IMPORT, "arguments": [ { diff --git a/test/test_inline.py b/test/test_inline.py index 99eeafd..8f5cc63 100644 --- a/test/test_inline.py +++ b/test/test_inline.py @@ -26,6 +26,7 @@ def test_inline(config, workspace, code_action_context): "title": "Inline method/variable/parameter", "kind": "refactor.inline", "command": { + "title": "Inline method/variable/parameter", "command": commands.COMMAND_REFACTOR_INLINE, "arguments": [ { diff --git a/test/test_introduce_parameter.py b/test/test_introduce_parameter.py index 43e3347..50babd8 100644 --- a/test/test_introduce_parameter.py +++ b/test/test_introduce_parameter.py @@ -26,6 +26,7 @@ def test_introduce_parameter(config, workspace, code_action_context): "title": "Introduce parameter", "kind": "refactor", "command": { + "title": "Introduce parameter", "command": commands.COMMAND_INTRODUCE_PARAMETER, "arguments": [ { diff --git a/test/test_local_to_field.py b/test/test_local_to_field.py index fa2c5ba..7a09249 100644 --- a/test/test_local_to_field.py +++ b/test/test_local_to_field.py @@ -26,6 +26,7 @@ def test_local_to_field(config, workspace, code_action_context): "title": "Convert local variable to field", "kind": "refactor.rewrite", "command": { + "title": "Convert local variable to field", "command": commands.COMMAND_REFACTOR_LOCAL_TO_FIELD, "arguments": [ { diff --git a/test/test_method_to_method_object.py b/test/test_method_to_method_object.py index 6d8e2c5..ce095ba 100644 --- a/test/test_method_to_method_object.py +++ b/test/test_method_to_method_object.py @@ -26,6 +26,7 @@ def test_method_to_method_object(config, workspace, code_action_context): "title": "To method object", "kind": "refactor.rewrite", "command": { + "title": "To method object", "command": commands.COMMAND_REFACTOR_METHOD_TO_METHOD_OBJECT, "arguments": [ { diff --git a/test/test_usefunction.py b/test/test_usefunction.py index 66282e7..01147c3 100644 --- a/test/test_usefunction.py +++ b/test/test_usefunction.py @@ -28,6 +28,7 @@ def test_use_function_globally(config, workspace, code_action_context): "title": "Use function", "kind": "refactor", "command": { + "title": "Use function", "command": commands.COMMAND_REFACTOR_USE_FUNCTION, "arguments": [ { @@ -88,6 +89,7 @@ def test_use_function_in_current_file(config, workspace, code_action_context): "title": "Use function for current file only", "kind": "refactor", "command": { + "title": "Use function for current file only", "command": commands.COMMAND_REFACTOR_USE_FUNCTION, "arguments": [ {