deoplete-plugins / deoplete-lsp

LSP Completion source for deoplete

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot complete

delphinus opened this issue · comments

Deoplete cannot show any candidates from LSP. Here's the Dockerfile to show it.

reproducible Dockerfile
FROM ubuntu:latest

RUN apt-get update && apt-get install -y \
    ninja-build gettext libtool libtool-bin autoconf automake cmake g++ \
    pkg-config unzip \
    git python3 python3-dev python3-pip \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

RUN git clone --depth 1 --single-branch --branch lsp https://github.com/h-michael/neovim ~/neovim \
 && cd ~/neovim \
 && make CMAKE_BUILD_TYPE=Release \
 && make install

RUN mkdir -p ~/test \
 && git clone https://github.com/Shougo/deoplete.nvim ~/test/deoplete.nvim \
 && git clone https://github.com/Shougo/deoplete-lsp ~/test/deoplete-lsp

RUN pip3 install pynvim
RUN pip3 install python-language-server

RUN mkdir -p ~/.config/nvim
RUN echo '\
if $USE_LSP != "" \n\
  call lsp#add_server_config({"filetype": "python", "cmd": {"execute_path": "pyls", "args": []}})\n\
  call luaeval("require(\"vim.lsp.config\").set_builtin_callback(\"textDocument/completion\")")\n\
  augroup MyLanguageServer\n\
    au!\n\
    autocmd Filetype python,go inoremap <buffer> <c-l> <c-r>=lsp#text_document_completion()<CR>\n\
  augroup END\n\
else\n\
  call lsp#add_server_config({"filetype": "python", "cmd": {"execute_path": "pyls", "args": []}})\n\
  set runtimepath+=~/test/deoplete.nvim\n\
  set runtimepath+=~/test/deoplete-lsp\n\
  call deoplete#enable()\n\
endif\n\
' >> ~/.config/nvim/init.vim

RUN echo '#!/usr/bin/env python\n\
import json\n\
\n\
def main():\n\
    json\n\
    "foo"\n\
' >> ~/hoge.py

RUN echo 'python3 -V' >> ~/.bashrc
RUN echo '( cd ~/test/deoplete.nvim && echo "deoplete.nvim: $(git rev-parse --short HEAD)" )' >> ~/.bashrc
RUN echo '( cd ~/test/deoplete-lsp  && echo "deoplete-lsp:  $(git rev-parse --short HEAD)" )' >> ~/.bashrc
RUN echo '( cd ~/neovim             && echo "neovim:        $(git rev-parse --short HEAD)" )' >> ~/.bashrc
RUN echo 'nvim --version' >> ~/.bashrc
RUN nvim +UpdateRemotePlugins +q
WORKDIR /root
ENTRYPOINT /bin/bash

asciicast

With this, it uses deoplete-lsp in default.

nvim hoge.py

And with USE_LSP env nvar, it uses the built-in LSP completion.

USE_LSP=1 nvim hoge.py

Neovim's lsp API is in review now and adding breaking change for API.
So I'll fix this issue later soon. :)

neovim/neovim#10222 (comment)

@delphinus I've fixed neovim side. Can you try with latest commit?

Confirmed. I tried and successfully completing with deoplete-lsp!! 🎉

updates Dockerfile
FROM golang:latest

RUN apt-get update && apt-get install -y \
    ninja-build gettext libtool libtool-bin autoconf automake cmake g++ \
    pkg-config unzip \
    git python3 python3-dev python3-pip \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

RUN git clone --depth 1 --single-branch --branch lsp https://github.com/h-michael/neovim ~/neovim \
 && cd ~/neovim \
 && make CMAKE_BUILD_TYPE=Release \
 && make install

RUN mkdir -p ~/test \
 && git clone https://github.com/Shougo/deoplete.nvim ~/test/deoplete.nvim \
 && git clone https://github.com/Shougo/deoplete-lsp ~/test/deoplete-lsp \
 && git clone https://github.com/dense-analysis/ale ~/test/ale

RUN pip3 install pynvim
RUN pip3 install python-language-server

RUN GO111MODULE=on go get golang.org/x/tools/gopls@831012c29e42

RUN mkdir -p ~/.config/nvim
RUN echo '\
if $USE_LSP != "" \n\
  call lsp#add_server_config({"filetype": "python", "cmd": "pyls"})\n\
  call lsp#add_server_config({"filetype": "go", "cmd": "gopls"})\n\
  call luaeval("require(\"vim.lsp.config\").set_builtin_callback(\"textDocument/completion\")")\n\
  augroup MyLanguageServer\n\
    au!\n\
    autocmd Filetype python,go inoremap <buffer> <c-l> <c-r>=lsp#text_document_completion()<CR>\n\
  augroup END\n\
elseif $USE_ALE != ""\n\
  set runtimepath+=~/test/deoplete.nvim\n\
  set runtimepath+=~/test/ale\n\
  let g:ale_linters = {"python": ["pyls"], "go": ["gopls"]}\n\
  call deoplete#enable()\n\
else\n\
  call lsp#add_server_config({"filetype": "python", "cmd": "pyls"})\n\
  call lsp#add_server_config({"filetype": "go", "cmd": "gopls"})\n\
  set runtimepath+=~/test/deoplete.nvim\n\
  set runtimepath+=~/test/deoplete-lsp\n\
  call deoplete#enable()\n\
endif\n\
' >> ~/.config/nvim/init.vim

RUN echo '#!/usr/bin/env python\n\
import json\n\
\n\
def main():\n\
    json\n\
    "foo"\n\
' >> ~/hoge.py

RUN echo 'package main\n\
\n\
import (\n\
	"fmt"\n\
)\n\
\n\
func main() {\n\
	fmt.Println("Hello, World!")\n\
}\n\
' >> ~/hoge.go

RUN echo 'go version' >> ~/.bashrc
RUN echo 'python3 -V' >> ~/.bashrc
RUN echo '( cd ~/test/deoplete.nvim && echo "deoplete.nvim: $(git rev-parse --short HEAD)" )' >> ~/.bashrc
RUN echo '( cd ~/test/deoplete-lsp  && echo "deoplete-lsp:  $(git rev-parse --short HEAD)" )' >> ~/.bashrc
RUN echo '( cd ~/test/ale           && echo "ale:           $(git rev-parse --short HEAD)" )' >> ~/.bashrc
RUN echo '( cd ~/neovim             && echo "neovim:        $(git rev-parse --short HEAD)" )' >> ~/.bashrc
RUN echo 'nvim --version' >> ~/.bashrc
RUN nvim +UpdateRemotePlugins +q
WORKDIR /root
ENTRYPOINT /bin/bash