hrsh7th / nvim-compe

Auto completion Lua plugin for nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto-import doesn't work on Windows 10

johans opened this issue · comments

Checkhealth

health#compe#check

compe:snippet

  • OK: snippet engine detected.

compe:mapping

  • OK: compe#complete is mapped: (i <C-Space> compe#complete())
  • OK: compe#confirm is mapped: (i <CR> compe#confirm("<CR>"))
  • INFO: compe#close is not mapped
  • INFO: compe#scroll is not mapped

Describe the bug

Auto-import isn't inserted on Windows 10 for some reason, it works great on Linux with the same config. @mjlbach could reproduce this when posted over at mjlbach/starter.nvim#29 I'll forward his trace here:

These lines I type drop

[ DEBUG ] 2021-07-22T08:40:27-0700 ] C:\tools\neovim\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1035 ] "on_lines bufnr: 1, changedtick: 31, firstline: 2, lastline: 3, new_lastline: 3, old_byte_size: 1, old_utf32_size: 1, old_utf16_size: 1" { "d" }
[ DEBUG ] 2021-07-22T08:40:27-0700 ] ...ols\neovim\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { end = { character = 0, line = 2 }, start = { character = 0, line = 2 } }, rangeLength = 0, text = "d" } }, textDocument = { uri = "file:///C:/Users/michael/test/index.js", version = 31 } }}
[ DEBUG ] 2021-07-22T08:40:27-0700 ] C:\tools\neovim\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1035 ] "on_lines bufnr: 1, changedtick: 32, firstline: 2, lastline: 3, new_lastline: 3, old_byte_size: 2, old_utf32_size: 2, old_utf16_size: 2" { "dr" }
[ DEBUG ] 2021-07-22T08:40:27-0700 ] ...ols\neovim\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { end = { character = 1, line = 2 }, start = { character = 1, line = 2 } }, rangeLength = 0, text = "r" } }, textDocument = { uri = "file:///C:/Users/michael/test/index.js", version = 32 } }}
[ DEBUG ] 2021-07-22T08:40:27-0700 ] C:\tools\neovim\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1035 ] "on_lines bufnr: 1, changedtick: 33, firstline: 2, lastline: 3, new_lastline: 3, old_byte_size: 3, old_utf32_size: 3, old_utf16_size: 3" { "dro" }
[ DEBUG ] 2021-07-22T08:40:27-0700 ] ...ols\neovim\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { end = { character = 2, line = 2 }, start = { character = 2, line = 2 } }, rangeLength = 0, text = "o" } }, textDocument = { uri = "file:///C:/Users/michael/test/index.js", version = 33 } }}
[ DEBUG ] 2021-07-22T08:40:27-0700 ] C:\tools\neovim\Neovim\share\nvim\runtime\lua\vim\lsp.lua:1035 ] "on_lines bufnr: 1, changedtick: 34, firstline: 2, lastline: 3, new_lastline: 3, old_byte_size: 4, old_utf32_size: 4, old_utf16_size: 4" { "drop" }
[ DEBUG ] 2021-07-22T08:40:27-0700 ] ...ols\neovim\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didChange", params = { contentChanges = { { range = { end = { character = 3, line = 2 }, start = { character = 3, line = 2 } }, rangeLength = 0, text = "p" } }, textDocument = { uri = "file:///C:/Users/michael/test/index.js", version = 34 } }}

Here is the completion item resolve request

[ DEBUG ] 2021-07-22T08:40:27-0700 ] C:\tools\neovim\Neovim\share\nvim\runtime\lua\vim\lsp.lua:895 ] "LSP[tsserver]" "client.request" 1 "completionItem/resolve" { commitCharacters = { ".", ",", "(" }, data = { entryNames = { { name = "drop", source = "c:/Users/michael/test/node_modules/@types/lodash/index" } }, file = "c:\Users\michael\test\index.js", line = 3, offset = 2 }, insertTextFormat = 2, kind = 2, label = "drop", sortText = "�6"} <function 1> nil
[ DEBUG ] 2021-07-22T08:40:27-0700 ] ...ols\neovim\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:395 ] "rpc.send.payload" { id = 3, jsonrpc = "2.0", method = "completionItem/resolve", params = { commitCharacters = { ".", ",", "(" }, data = { entryNames = { { name = "drop", source = "c:/Users/michael/test/node_modules/@types/lodash/index" } }, file = "c:\Users\michael\test\index.js", line = 3, offset = 2 }, insertTextFormat = 2, kind = 2, label = "drop", sortText = "�6" }}

Here is the typescript completion code action

[ DEBUG ] 2021-07-22T08:40:27-0700 ] ...ols\neovim\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:496 ] "decoded" { id = 3, jsonrpc = "2.0", result = { command = { arguments = { "c:\Users\michael\test\index.js", { { changes = { { fileName = "c:/Users/michael/test/index.js", textChanges = { { end = { line = 1, offset = 22 }, newText = ", drop", start = { line = 1, offset = 22 } } } } }, description = "Add 'drop' to existing import declaration from "lodash"" } } }, command = "_typescript.applyCompletionCodeAction", title = "" }, commitCharacters = { ".", ",", "(" }, data = { entryNames = { { name = "drop", source = "c:/Users/michael/test/node_modules/@types/lodash/index" } }, file = "c:\Users\michael\test\index.js", line = 3, offset = 2 }, detail = "Auto import from 'lodash'\n(method) LoDashStatic.drop(array: List, n?: number): T[]", documentation = { kind = "markdown", value = "Creates a slice of array with n elements dropped from the beginning.\n\n*@param* array — The array to query. \n\n*@param* n — The number of elements to drop. \n\n*@return* — Returns the slice of array." }, insertTextFormat = 2, kind = 2, label = "drop", sortText = "�6" }}

I think this is all internally handled by compe (believe this is a custom tsserver extension), so I would maybe file an issue there.

Originally posted by @mjlbach in mjlbach/starter.nvim#29 (comment)

Sorey. It's known issue. see #196

@hrsh7th Sorry I missed it, thanks for a great plugin!

@hrsh7th Thanks, I don't use typescript (or windows) really so I wasn't aware of this. I updated the lspconfig wiki with a reference to the upstream theia issue.

Thank you and sorry for annoying.
I will update README.md

Oh not annoyed at all! Thanks so much for answering the OP and informing me!