typescript - Emacs LSP 模式 - 是否可以避免单击鼠标来完成建议的操作?

标签 typescript emacs language-server-protocol

我目前正在使用带有 LSP 模式的 Emacs 来编写 TypeScript 代码,它运行得很好。

我目前唯一的烦恼是每次我都需要点击鼠标来完成建议的操作,例如

Add async modifier to containing function

Add 'fooFunc' to existing import declaration from 'some/dep'

我在(view-lossage)中注意到的唯一命令是:

<down-mouse-1> [evil-mouse-drag-region]
<mouse-1> <down-mouse-1> [evil-mouse-drag-region]
<mouse-1> <mouse-1> [mouse-set-point]
<down-mouse-1> [anonymous-command]
<drag-mouse-1> [mouse-set-region]

理想情况下,它应该具有某种使用键盘的向上/向下导航来选择所需的选项/操作。

有办法吗?

已添加带有示例的屏幕截图 enter image description here

最佳答案

事实证明这非常简单。

lsp-execute-code-action 是您遇到相同问题时可能正在寻找的函数。

在 spacemacs 中,它的快捷方式是 SPC a a

lsp-execute-code-action

关于typescript - Emacs LSP 模式 - 是否可以避免单击鼠标来完成建议的操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65597861/

相关文章:

python - 如何在 Neovim 中使用 Python 语言服务器协议(protocol)

kotlin - VSCode 长时间显示 'Installing Kotlin Language Server'。我能阻止吗?

node.js - 如何使用 require ('typescript' ).transform?

javascript - 稍后在 TypeScript 中解决或拒绝 Promise

emacs - 在 Emacs 中一次编辑多行

Emacs:如何绑定(bind)两次点击的键?

javascript - Visual Studio Code Language Server - 如何验证工作区中的所有文件

javascript - HttpInterceptor 在拦截器内调用另一个服务并等待响应

typescript - 使用matb33 :collection-hooks in typescript

regex - emacs 编译模式将错误行标记为错误