0

I was beyond stoked to discover how complete Flutter support is in Emacs these days thanks to the seemingly polished lsp-dart (featured prominently in the official "get started" docs for Flutter, awesome).

Anyways, when I hover over a Flutter widget while lsp-ui is enabled I get this nice yellow list of "Context Actions" hovering off to the right that I can click on to perform the action, just like in Android Studio. I'm trying to figure out how to use those without touching my mouse, but I can't for the life of me figure out what commands they're actually running. I've grepped around my entire elpa directory to no avail. (Yes the time I've spent researching this question has probably already outweighed the time I'll save by not having to touch my mouse, but it's really about comfort and joy, isn't it?)

Are these interactive commands that I can run? Alternatively, does anyone know how this hovering list is built in lsp-ui? Might help with the source dive.

Screenshot

1

The LSP server just provides a list of action names that are applicable, and the client must request that the server invoke them. This means that the client doesn't actually know how they're implemented or what the full set of actions will be, and that they cannot be interactive commands. Instead there is only a command that lets you select which action you want to invoke, lsp-execute-code-action. If I recall correctly, the default key binding for it is C-c l a a.

I recommend installing which-key mode if you haven't already. If you hesitate after typing a prefix key such as C-c, it pops up a menu to remind you what options are available. This makes exploring the labyrinthine recesses of LSP mode easier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.