Closed mikez closed 6 months ago
You can add keybinding to trigger code actions like:
{
"keys": ["primary+."],
"command": "lsp_code_actions",
"context": [{"key": "lsp.session_with_capability", "operand": "codeActionProvider"}]
},
This one triggers code actions on cmd+.
. You can configure it as you want.
@rchl Thank you, I just tried it out. It doesn't show the "infer parameters from usage".
The diagnostics panel shows this:
and clicking on said line in the diagnostics panel, I see this:
However, pressing ⌘+.
while on line 21 in the actual file only shows this one action:
How can I make "infer parameters from usage" an option as well?
I think it might show if you place your cursor within parameters since those code actions are context-specific.
Here is how it works for me https://github.com/sublimelsp/LSP-typescript/assets/115091796/607d2167-9b70-45b4-9372-e582bfebf427
@rchl That resolved it! Thank you. :)
Here's my updated flow:
⌘+.
& ↵
Follow-up question: Can I cycle through all lines that appear in ⌥⌘M, as opposed to having to click on each? A "find next" diagnostic action, a bit like the ⌘G key for search.
You can find various related key bindings in Preferences: LSP key bindings
including ones that show diagnostics in a quick panel and ones that jump to next/previous diagnostics. This is a better way of handling navigation than using the panel since the latter is erratic.
@predrag-codetribe Out of curiosity, how did you record and paste that video into Github?
@rchl 👌. …/LSP/Default.sublime-keymap
is an amazing resource. Thank you!!
@mikez I use Kap . It allows me to export a video to mp4, gif.
Is there a way to trigger "Infer parameter types from usage" on request?
Currently, I do it by toggling the diagnostic panel (⌥⌘M), seeking the file and line I'm on, and then double-clicking the line where it says "Infer parameter types from usage".
Is there an easier way?
(Thank you for this plugin, @rchl.)