Git Product home page Git Product logo

Comments (12)

prabirshrestha avatar prabirshrestha commented on May 25, 2024 2

Also, does vim-lsp support all LSP functionalities ?

If it is not mentioned here it isn't implemented yet. https://github.com/prabirshrestha/vim-lsp#supported-commands.

I couldn't find anything regarding signatures and code linting.

Ideally I wanted to use ALE to show code linting but seems like it wouldn't be possible. dense-analysis/ale#517 (comment). My plan is to start implementing lsp diagnostics sometime next month. For signatures, currently no plans but it is something I would like to get it in the far future someday. PRs welcome for both.

Out of curiosity, what version of neovim are you using to get it to work ? I am on 0.2.0, the Release for MacOS Sierra.

For work I use latest vim8 on windows. For testing I do use latest vim8 and neovim on windows, mac and linux. So it should be working there. It should had actually even worked on neovim 0.2.0.

from vim-lsp.

prabirshrestha avatar prabirshrestha commented on May 25, 2024 1

I have implemented partial textDocument/publishDiagnostics support. But for now you need to manually call : LspDocumentDiagnostics. I will be improving this feature next month.

from vim-lsp.

prabirshrestha avatar prabirshrestha commented on May 25, 2024

Your vimrc looks ok and is behaving correctly.

Since you set g:asyncomplete_auto_popup to 0, you need to manually call asyncomplete_force_refresh i.e. <c-space> in your case. By default g:asyncomplete_auto_popup it is set to 1.

from vim-lsp.

seba-1511 avatar seba-1511 commented on May 25, 2024

Thanks for your quick answer.

When I hit <C-space> in insert mode, the text <Plug>(asyncomplete_force_refresh) is inserted and the command not executed.

Out of curiosity, what version of neovim are you using to get it to work ? I am on 0.2.0, the Release for MacOS Sierra.

from vim-lsp.

seba-1511 avatar seba-1511 commented on May 25, 2024

I just tried on Linux with neovim 0.2.1. I tried to change g:asyncomplete_auto_popup to 1, commented the omni line, but I still can't get the popup to show. <C-space> now just seems to behave like a no-op.

What's weird is that the rest of the LSP functionalities work well. What would be the best way for me to test the autocompletion plugin, maybe without LSP ?

from vim-lsp.

prabirshrestha avatar prabirshrestha commented on May 25, 2024

If you are just trying trying to test the autocompletion plugin try one of the sources from https://github.com/prabirshrestha/asyncomplete.vim#sources. Some Go/Typescript/Racer are async sources.

Another option would be to try looking at the logs. https://github.com/prabirshrestha/vim-lsp#debugging

from vim-lsp.

seba-1511 avatar seba-1511 commented on May 25, 2024

Thangs for LspDocumentDiagnostics, this will be useful.

I tried to use asyncomplete.vim with Typescript only (vimrc below) and typed exactly what you did in here: https://twitter.com/PrabirShrestha/status/828344799790919680

However, I get the following error message when opening neovim:

person.ts" 4L, 32C
Error detected while processing function tscompletejob#add_buffer[3]..<SNR>39_ensureReload[2]..tscompletejob#send_command[4]..<SNR>40_se
ndCommand[24]..tscompletejob#jobcompat#send_raw:
line    2:
E900: Invalid job id
Error detected while processing function tscompletejob#add_buffer[3]..<SNR>39_ensureReload[2]..tscompletejob#send_command[4]..<SNR>40_se
ndCommand[25]..tscompletejob#jobcompat#send_raw:
line    2:
E900: Invalid job id
Error detected while processing function tscompletejob#add_buffer[3]..<SNR>39_ensureReload[6]..tscompletejob#send_command[4]..<SNR>40_se
ndCommand[24]..tscompletejob#jobcompat#send_raw:
line    2:
E900: Invalid job id
Error detected while processing function tscompletejob#add_buffer[3]..<SNR>39_ensureReload[6]..tscompletejob#send_command[4]..<SNR>40_se
ndCommand[25]..tscompletejob#jobcompat#send_raw:
line    2:
E900: Invalid job id

and the log file:

["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]

Of course when typing the text no autocomplete shows up.

Any idea where that might come from ?

.vimrc:

" -------------- My Vim --------------
let mapleader = ','
if &compatible
    set nocompatible               " Be iMproved
endif
filetype plugin indent on

" -------------- Dein Config --------------

set runtimepath+=~/.vim/repos/github.com/Shougo/dein.vim
if dein#load_state(expand('~/.vim'))
    " Required:
    call dein#begin(expand('~/.vim'))
    " Let dein manage dein
    call dein#add(expand('~/.vim/repos/github.com/Shougo/dein.vim'))

    " Language Server Protocol
    call dein#add('prabirshrestha/asyncomplete.vim')
    call dein#add('runoshun/tscompletejob')
    call dein#add('prabirshrestha/asyncomplete-tscompletejob.vim')


    call dein#end()
    call dein#save_state()
endif
if dein#check_install()
    call dein#install()
endif

call asyncomplete#register_source(asyncomplete#sources#tscompletejob#get_source_options({
    \ 'name': 'tscompletejob',
    \ 'whitelist': ['typescript'],
    \ 'completor': function('asyncomplete#sources#tscompletejob#completor'),
    \ }))

imap <c-space> <Plug>(asyncomplete_force_refresh)

let g:asyncomplete_auto_popup = 0

function! s:check_back_space() abort
    let col = col('.') - 1
    return !col || getline('.')[col - 1]  =~ '\s'
endfunction

inoremap <silent><expr> <TAB>
  \ pumvisible() ? "\<C-n>" :
  \ <SID>check_back_space() ? "\<TAB>" :
  \ asyncomplete#force_refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

let g:lsp_log_verbose = 1
let g:lsp_log_file = expand('~/vim-lsp.log')

" for asyncomplete.vim log
let g:asyncomplete_log_file = expand('~/asyncomplete.log')

from vim-lsp.

prabirshrestha avatar prabirshrestha commented on May 25, 2024

I currently don't use tscompletejob these days but it should had work fine.

Can you try with this minimal vimrc. Please try with python language server. I want to make sure it is not a bug in typescript-language-server since I got this report to prabirshrestha/typescript-language-server#24. Not sure if it is related to line endings. Currently I assume line endings to always be \n in get_text_document_text(). This is something I need to fix.

set nocompatible hidden laststatus=2

if !filereadable('/tmp/plug.vim')
  silent !curl --insecure -fLo /tmp/plug.vim
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif

source /tmp/plug.vim

call plug#begin('/tmp/plugged')
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
call plug#end()

imap <c-space> <Plug>(asyncomplete_force_refresh)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif

if executable('pyls')
    " pip install python-language-server
    au User lsp_setup call lsp#register_server({
        \ 'name': 'pyls',
        \ 'cmd': {server_info->['pyls']},
        \ 'whitelist': ['python'],
        \ })
endif

autocmd VimEnter * PlugClean! | PlugUpdate --sync

from vim-lsp.

seba-1511 avatar seba-1511 commented on May 25, 2024

Just tried the above minimal vimrc with neovim 0.2.1: I get the exact same same outcome as with my first vimrc. That is, I only get the autocomplete via omni complete.

At this point, I assume it might be an issue with my installation of neovim. I might try again later, after an update. Thanks for your help !

from vim-lsp.

casr avatar casr commented on May 25, 2024

I am struggling to get vim-lsp working so I am jumping in here too if possible? :)

Thanks for the minimal vimrc above. That's a great way to test. I have saved it below as examplerc.vim.

So after pip install python-language-server and checking pyls is in my PATH I ran:

vim -u examplerc.vim test.py

test.py:

def greet(name):
    print 'Hello, ', name

greet('Jack')
greet('Jill')
greet('Bob')

And then tried, whilst the cursor is over one of the invocations of greet, :LspRename to which the reply is Renaming not support by python. All the Lsp* functions have similar responses. My processes show no launches for pyls as well.

I have tested with Vim 8.0.1098 and Neovim 0.2.0. Python version is 2.7.14. Full --version output below:

❯ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct  7 2017 14:12:12)
MacOS X (unix) version
Included patches: 1-1098
Compiled by MacPorts
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminal
++builtin_terms  +fork()          +multi_lang      +terminfo
+byte_offset     +gettext         -mzscheme        +termresponse
+channel         -hangul_input    +netbeans_intg   +textobjects
+cindent         +iconv           +num64           +timers
-clientserver    +insert_expand   +packages        +title
+clipboard       +job             +path_extra      -toolbar
+cmdline_compl   +jumplist        -perl            +user_commands
+cmdline_hist    +keymap          +persistent_undo +vertsplit
+cmdline_info    +lambda          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
-cscope          +lispindent      +python3/dyn     +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      +lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      +startuptime     -xpm
+eval            +mouse_dec       +statusline      -xsmp
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_clipboard
+extra_search    -mouse_jsbterm   +syntax          -xterm_save
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "/opt/local/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -I/opt/local/include -DMACOS_X_UNIX  -pipe -Os -arch x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -o vim        -lm  -lncurses -liconv -lintl -framework Cocoa  -L/opt/local/lib -llua

❯ nvim --version
NVIM v0.2.0
Build type: Release
Compilation: /usr/bin/clang -pipe -Os -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_editors_neovim/neovim/work/build/config -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_editors_neovim/neovim/work/neovim-0.2.0/src -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/include -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_editors_neovim/neovim/work/build/src/nvim/auto -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_editors_neovim/neovim/work/build/include
Compiled by [email protected]

Optional features included (+) or not (-): +acl   +iconv    +jemalloc +tui      
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/local/share/nvim"

from vim-lsp.

prabirshrestha avatar prabirshrestha commented on May 25, 2024

@casr can you file a new issue with the same comment.

from vim-lsp.

melito00 avatar melito00 commented on May 25, 2024

Dein overwrites the file that has the same filename.
You should define

call dein#add('prabirshrestha/asyncomplete-lsp.vim', {'merged':0})

from vim-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.