Shougo / ddc-source-lsp

lsp source for ddc.vim
Other
66 stars 20 forks source link

Completions not working for Python 3 -- Nvim 0.6.0 #29

Closed phgz closed 2 years ago

phgz commented 2 years ago

Problems summary

Getting error when trying to get completions from nvim-lsp (getting the same from omni completion source). [denops] at async Session.handleNotification (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:130:7)

Expected

Get completions.

Environment Information

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: " /home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

<details><summary><code>:checkhealth</code></summary>

denops: health#denops#check

lspconfig: require("lspconfig.health").check()

nvim: health#nvim#check

Configuration

Performance

Remote Plugins

terminal

tmux

nvim-treesitter: require("nvim-treesitter.health").check()

Installation

Parser/Features H L F I J

provider: health#provider#check

Clipboard (optional)

Python 2 provider (optional)

Python 3 provider (optional)

Python virtualenv

Ruby provider (optional)

Node.js provider (optional)

Perl provider (optional)

sniprun: health#sniprun#check

Installation

targets: health#targets#check

telescope: require("telescope.health").check()

Checking for required plugins

Checking external dependencies

===== Installed extensions =====

vim.lsp: require("vim.lsp.health").check()

vim.treesitter: require("vim.treesitter.health").check()

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

" Your minimal init.vim/vimrc
call ddc#custom#patch_global('sources', ['nvim-lsp'])
call ddc#custom#patch_global('sourceOptions', {
      \ '_': { 'matchers': ['matcher_head'] },
      \ 'nvim-lsp': {
      \   'mark': 'lsp',
      \   'forceCompletionPattern': '\.\w*|:\w*|->\w*' },
      \ })
call ddc#custom#patch_global('sourceParams', {
      \ 'nvim-lsp': { 'kindLabels': { 'Class': 'c' } },
      \ })
call ddc#enable()

lua << EOF
vim.lsp.handlers["textDocument/publishDiagnostics"] =
    vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
        virtual_text = false,
        underline = true,
        signs = true,
        update_in_insert = true
    })

local nvim_lsp = require('lspconfig')
nvim_lsp["pyright"].setup{}
EOF

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Open a python file.
  2. Start typing (ex.: def)

Screenshot (if possible)

Screen Shot 2021-11-12 at 12 01 32

The error is [denops] at async Session.handleNotification (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:130:7)

Shougo commented 2 years ago

It works for me.

Your neovim and deno are not latest. Please update it. nvim-lspconfig must be the latest.

The error is [denops] at async Session.handleNotification (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:130:7)

Why don't you execute :mes to print full messages?

And you have not uploaded real minimal vimrc. Note: The statusline is customed in your screenshot.

My vimrc is:

if &compatible
  set nocompatible
endif

set runtimepath^=~/work/ddc.vim
set runtimepath^=~/work/denops.vim
set runtimepath^=~/work/ddc-matcher_head
set runtimepath^=~/work/ddc-sorter_rank
set runtimepath^=~/work/ddc-around

if has('nvim')
  set runtimepath+=~/src/nvim-lspconfig
  set runtimepath^=~/work/ddc-nvim-lsp

  lua << EOF
vim.lsp.handlers["textDocument/publishDiagnostics"] =
    vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
        virtual_text = false,
        underline = true,
        signs = true,
        update_in_insert = true
    })
require'lspconfig'.pyright.setup{}
EOF
endif

set completeopt=menuone,noinsert

filetype plugin indent on
syntax enable

call ddc#custom#patch_global('sources', ['nvim-lsp'])
call ddc#custom#patch_global('sourceOptions', {
      \ '_': { 'matchers': ['matcher_head'] },
      \ 'nvim-lsp': {
      \   'mark': 'lsp',
      \   'forceCompletionPattern': '\.\w*|:\w*|->\w*' },
      \ })
call ddc#custom#patch_global('sourceParams', {
      \ 'nvim-lsp': { 'kindLabels': { 'Class': 'c' } },
      \ })
call ddc#enable()

Closing.

Shougo commented 2 years ago

スクリーンショット_2021-11-13_08-31-26

Shougo commented 2 years ago

The minimal vimrc does not means your ddc configuration part. It must be executed by nvim -u minimal.vimrc.

We have not ESP skills.

phgz commented 2 years ago

Hi!

I was not aware of the :mes command, very helpful, thank you!

As for the complete error, there it is:

[denops] Error: Failed to call 'onEvent' with ["InsertEnter"]: TypeError: error sending request for url (https://x.nest.land/arithmetic4@0.1.1/mod.ts): error trying to connect: invalid certificate: UnknownIssuer
[denops]     at https://deno.land/x/fonction@v1.8.0-beta.7/deps.ts:8:8
[denops]     at async Ddc.autoload (file:///home/philip/.vim/plugged/ddc.vim/denops/ddc/ddc.ts:195:11)
[denops]     at async Ddc.checkInvalid (file:///home/philip/.vim/plugged/ddc.vim/denops/ddc/ddc.ts:226:5)
[denops]     at async Ddc.onEvent (file:///home/philip/.vim/plugged/ddc.vim/denops/ddc/ddc.ts:280:5)
[denops]     at async Session.onEvent (file:///home/philip/.vim/plugged/ddc.vim/denops/ddc/app.ts:111:7)
[denops]     at async Session.dispatch (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:99:12)
[denops]     at async https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:108:18
[denops]     at async Session.handleRequest (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:104:29)
[denops]     at Session.call (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:207:13)
[denops]     at async Service.dispatch (file:///home/philip/.vim/plugged/denops.vim/denops/@denops-private/service.ts:101:14)
[denops]     at async Session.invoke (file:///home/philip/.vim/plugged/denops.vim/denops/@denops-private/host/nvim.ts:48:16)
[denops]     at async Session.dispatch (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:99:12)
[denops]     at async Session.handleNotification (https://deno.land/x/msgpack_rpc@v3.1.4/session.ts:130:7)

It was produced with your minimal vimrc (I updated nvim and deno to latest).

phgz commented 2 years ago

I checked about the error, and it says it might be because of a proxy server issue, but I can use DDC correctly with other sources like treesitter or around.

Also, if I execute deno run https://deno.land/std/examples/welcome.ts, I get:

Download https://deno.land/std/examples/welcome.ts
Warning Implicitly using latest version (0.114.0) for https://deno.land/std/examples/welcome.ts
Download https://deno.land/std@0.114.0/examples/welcome.ts
Check https://deno.land/std/examples/welcome.ts
Welcome to Deno!

Output of deno --version:

deno --version
deno 1.16.1 (release, x86_64-unknown-linux-gnu)
v8 9.7.106.2
typescript 4.4.2

I'm not an expert at Deno, maybe you can point me in the right direction.

Shougo commented 2 years ago

It seems the server certificate problem. So it is not ddc or ddc-nvim-lsp problem. I cannot fix the problem. I have not ESP skills.

Shougo commented 2 years ago

It works for me.

import {
  add,
} from 'https://x.nest.land/arithmetic4@0.1.1/mod.ts'

console.log(add(1, 2));
Shougo commented 2 years ago

I checked about the error, and it says it might be because of a proxy server issue, but I can use DDC correctly with other sources like treesitter or around.

Yes, because ddc-nvim-lsp source only uses equal module. Please see the dependency list.

equal -> fonction -> equal

Shougo commented 2 years ago

And why I use equal module instead. Please read this.

https://github.com/Shougo/ddc-nvim-lsp/pull/13

Shougo commented 2 years ago

I have removed equal module. Please update to the latest.