Skip to content

Commit

Permalink
gopls/doc/emacs.md: explain how to organize imports automatically
Browse files Browse the repository at this point in the history
This is now possible as the linked issues have been fixed.

Change-Id: Icf1b6c2f00efac65db79a4cdcb2062e30d5960b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/553575
Reviewed-by: Bryan Mills <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Michael Stapelberg <[email protected]>
  • Loading branch information
stapelberg authored and gopherbot committed Jan 29, 2024
1 parent 3d49bd5 commit dd0f88f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions gopls/doc/emacs.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ code action, which you can invoke as needed by running `M-x eglot-code-actions`
(or a key of your choice bound to the `eglot-code-actions` function) and
selecting `Organize Imports` at the prompt.

Eglot does not currently support a standalone function to execute a specific
code action (see
[joaotavora/eglot#411](https://github.com/joaotavora/eglot/issues/411)), nor an
option to organize imports as a `before-save-hook` (see
[joaotavora/eglot#574](https://github.com/joaotavora/eglot/issues/574)). In the
meantime, see those issues for discussion and possible workarounds.
To automatically organize imports before saving, add a hook:

```elisp
(add-hook 'before-save-hook
(lambda ()
(call-interactively 'eglot-code-action-organize-imports))
nil t)
```

## Troubleshooting

Expand Down

0 comments on commit dd0f88f

Please sign in to comment.