-
Notifications
You must be signed in to change notification settings - Fork 73
Emacs Usage
Brendan Maginnis edited this page Mar 26, 2021
·
1 revision
- Install the lsp-mode LSP client for Emacs.
- Install the sourcery-cli pypi package
pip install --user sourcery-cli
. Note down the full command path with
which sourcery
. - Sign up for Sourcery on the website and get your token.
- Add the following code to your emacs config:
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("<Command to run Sourcery>" "lsp"))
:initialization-options '((token . "<your_token_here>")
(extension_version . "emacs-lsp")
(editor_version . "emacs"))
:activation-fn (lsp-activate-on "python")
:server-id 'sourcery
:add-on? t
:priority 2))
Sourcery scans the currently open Python file. If lsp-modeline-diagnostics-mode
is enabled it highlights the relevant lines of code with improvements.
When on a suggestion line, you can hover to see the suggestion, and run the code action to refactor that code.
See the Sourcery Tutorial for more detailed info.
Please see the Sourcery configuration section for details.
Please visit our newer docs at https://docs.sourcery.ai