1

I have a working linter with the ALE plugin.

Plugin 'dense-analysis/ale'

let g:ale_virtualtext_cursor = 0
let g:ale_python_flake8_options = '--extend-ignore=E501'
nnoremap <leader>ar :ALERename<CR>
let g:ale_linters = {
    \   'python': ['pylsp'],
    \}

However, I cannot get the :ALECodeAction command to work. I get a "No code actions received from server" error.

I'm hoping to get some quick fix suggestions like in vscode.

vscode code actions

1
  • I suspect that there are no fix for Python supported. Jul 2 at 9:39

2 Answers 2

1

I'm not aware of a Vim plugin that provide fix for warning detected by the linter.

But for automatic correction of missing Python import you could be interested by autoimport

You can fix the import problem using the following Vim command:

:!autoimport %
2
  • 1
    Thank you. autoimport and many other fixers work well with the :ALEFix command. But similar to your example they apply it on the entire buffer/file. I'm interested in inline suggestions that let me pick between fixes that are relevant.
    – Surya
    Jul 3 at 0:43
  • Thanks for your feedback. I'm not aware of a Vim solution for that need. Jul 3 at 2:40
1

For Rust it seems that the language server propose fix that can be leverage by the light-bulb plugin.

But for Python it seems that pyright provide warning but no suggestion fix that can be leveraged by light-bulb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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