diff --git a/Default.sublime-commands b/Default.sublime-commands
index bd9c22766..92cfa689b 100644
--- a/Default.sublime-commands
+++ b/Default.sublime-commands
@@ -84,7 +84,9 @@
{
"caption": "LSP: Goto Diagnostic",
"command": "lsp_goto_diagnostic",
- "args": {"uri": "$view_uri"}
+ "args": {
+ "uri": "$view_uri"
+ }
},
{
"caption": "LSP: Goto Diagnostic in Project",
@@ -107,11 +109,20 @@
"command": "lsp_symbol_rename"
},
{
- "caption": "LSP: Run Code Action",
+ "caption": "LSP: Code Action…",
"command": "lsp_code_actions"
},
{
- "caption": "LSP: Run Source Action",
+ "caption": "LSP: Refactor…",
+ "command": "lsp_code_actions",
+ "args": {
+ "only_kinds": [
+ "refactor"
+ ]
+ },
+ },
+ {
+ "caption": "LSP: Source Action…",
"command": "lsp_code_actions",
"args": {
"only_kinds": [
diff --git a/docs/src/keyboard_shortcuts.md b/docs/src/keyboard_shortcuts.md
index dbad8b40f..4e16185f5 100644
--- a/docs/src/keyboard_shortcuts.md
+++ b/docs/src/keyboard_shortcuts.md
@@ -26,6 +26,7 @@ Refer to the [Customization section](customization.md#keyboard-shortcuts-key-bin
| Restart Server | unbound | `lsp_restart_server`
| Run Code Action | unbound | `lsp_code_actions`
| Run Code Lens | unbound | `lsp_code_lens`
+| Run Refactor Action | unbound | `lsp_code_actions` (with args: `{"only_kinds": ["refactor"]}`)
| Run Source Action | unbound | `lsp_code_actions` (with args: `{"only_kinds": ["source"]}`)
| Signature Help | ctrl alt space | `lsp_signature_help_show`
| Toggle Diagnostics Panel | ctrl alt m | `lsp_show_diagnostics_panel`
diff --git a/plugin/tooling.py b/plugin/tooling.py
index 3afdd7238..838158e2e 100644
--- a/plugin/tooling.py
+++ b/plugin/tooling.py
@@ -90,6 +90,12 @@ def _preprocess_properties(translations: Optional[Dict[str, str]], properties: D
_preprocess_properties(translations, child_properties)
+def _enum_to_str(value: Any) -> str:
+ if isinstance(value, str):
+ return '"{}"'.format(value)
+ return str(value)
+
+
class BasePackageNameInputHandler(sublime_plugin.TextInputHandler):
def initial_text(self) -> str:
@@ -185,7 +191,7 @@ def run(self, base_package_name: str) -> None:
has_default = "default" in v
default = v.get("default")
if isinstance(enum, list):
- self.writeline4('// possible values: {}'.format(", ".join(enum)))
+ self.writeline4('// possible values: {}'.format(", ".join(map(_enum_to_str, enum))))
if has_default:
value = default
else: