2

I installed NeoVim and dense-analysis/ale plugin with vim-plug.

All of those seems to be installed, as the commands starting with :ALE autocomplete in NeoVim.

Then I tried to install PYLS via

python3 -m pip install --user python-language-server

and enabled it in my init.vim file that you can read here :

# File .config/nvim/init.vim
call plug#begin('~/.config/nvim/plugged')
Plug 'dense-analysis/ale'
let g:ale_linters = {'python': ['pyls']}
let g:ale_fixers = {'python': ['black']}
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 0
let g:ale_completion_enabled = 1
call plug#end()

" Display
set number " show the line numbers
set cursorline " underline the current line
colorscheme koehler " use my preferred palette

" Syntax highlighting
syntax on

" Set tabs to have 4 spaces
set tabstop=4 " nb of spaces in a tab
set softtabstop=4
set shiftwidth=4 " nb of spaces when using << or >>
set expandtab " use spaces when pressing <tab>

" Input
set mouse=a

" Output
set fileformat=unix
set encoding=utf-8

The problem is : commands like ":ALEGoToDefinition" or ":ALEFindReferences" don't work.

I saw that PYLS need Jedi to provide those, so I installed Jedi too.

python3 -m pip install --user jedi

But there's no change.

Here's my :ALEInfo content :

:ALEInfo...
 Current Filetype: python
Available Linters: ['bandit', 'flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pyls', 'pyre', 'vulture']
 Current Filetype: python
Available Linters: ['bandit', 'flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pyls', 'pyre', 'vulture']
  Enabled Linters: ['pyls']
 Suggested Fixers:
  'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
  'autopep8' - Fix PEP8 issues with autopep8.
  'black' - Fix PEP8 issues with black.
  'isort' - Sort Python imports with isort.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'reorder-python-imports' - Sort Python imports with reorder-python-imports.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
  'yapf' - Fix Python files with yapf.
 Linter Variables:
let g:ale_python_auto_pipenv = 0
let g:ale_python_pyls_auto_pipenv = 0
let g:ale_python_pyls_config = {}
let g:ale_python_pyls_executable = 'pyls'
let g:ale_python_pyls_use_global = 0
 Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = v:null
let g:ale_command_wrapper = v:null
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 1
let g:ale_completion_max_suggestions = 50
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = v:null
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'python': ['black']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = v:null
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 0
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_linter_aliases = {}
let g:ale_linters = {'python': ['pyls']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = v:null
let g:ale_list_window_size = v:null
let g:ale_loclist_msg_format = v:null
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = v:null
let g:ale_max_signs = v:null
let g:ale_maximum_file_size = v:null
let g:ale_open_list = v:null
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = v:null
let g:ale_sign_error = v:null
let g:ale_sign_info = v:null
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = v:null
let g:ale_sign_style_warning = v:null
let g:ale_sign_warning = v:null
let g:ale_statusline_format = v:null
let g:ale_type_map = v:null
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

Press ENTER or type command to continue

Did I forget some steps ? Thanks you

  • You should probably install jedi using vim plug – eyal karni Aug 21 '19 at 17:56
  • Do you mean the jedi-vim plugin ? I tried, but it's no use. It allows to get autocompletion of Jedi directly in Vim, but I want to get this autocompletion with PYLS using Jedi. And the commands I want (like :ALEGoToDefinition) still don't work. – lial_slasher Aug 22 '19 at 13:48
  • Make sure you can import jedi and that pyls is accessible. And that you don't mix python2 and 3. Other than that, I don't know. – eyal karni Aug 22 '19 at 20:49
  • I got Command History: (executable check - success) pyls at the end of my ALEInfo and >>> import jedi in Python3 works. – lial_slasher Aug 22 '19 at 21:23
1

python-language-server requires registration. (See Servers-Python)

Here are two options to do this:

  1. Install vim-lsp-pythonv
  2. Register the python-language-server in .vimrc
if executable('pyls')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'pyls',
        \ 'cmd': {server_info->['pyls']},
        \ 'whitelist': ['python'],
        \ })
endif
| improve this answer | |
  • I wanted to try, but as soon as I changed my config file to use pyls, that worked fine. Since I can't reproduce the bug, I can't evaluate your response, sorry. – lial_slasher Dec 13 '19 at 22:16

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.