fannheyward / coc-rust-analyzer

rust-analyzer extension for coc.nvim
MIT License
1.13k stars 39 forks source link

Popup jump to LSP suggestion despite Snippet with higher priority. #1193

Closed hungpham3112 closed 1 year ago

hungpham3112 commented 1 year ago

What's the output of :CocInfo

## versions

vim version: VIM - Vi IMproved 9.0 9002001
node version: v20.8.0
coc.nvim version: 0.0.82-d1568d56 2023-09-29 19:43:34 +0800
coc.nvim directory: C:\Users\sofia\vimfiles\plugged\coc.nvim
term: xterm-256color
platform: win32

## Log of coc.nvim

2023-10-18T16:22:17.633 ERROR (pid:10324) [extensions-index] - Error on load package.json of coc-pyright Error: main file lib/index.js not found, you may need to build the project.
    at z7 (C:\Users\sofia\vimfiles\plugged\coc.nvim\build\index.js:251:21268)
    at async gF.globalExtensions (C:\Users\sofia\vimfiles\plugged\coc.nvim\build\index.js:252:7107)
    at async gF.init (C:\Users\sofia\vimfiles\plugged\coc.nvim\build\index.js:252:3671)
    at async Gy.init (C:\Users\sofia\vimfiles\plugged\coc.nvim\build\index.js:277:45414)
    at async EventEmitter.<anonymous> (C:\Users\sofia\vimfiles\plugged\coc.nvim\build\index.js:277:47234)
2023-10-18T16:22:17.876 INFO (pid:10324) [plugin] - coc.nvim initialized with node: v20.8.0 after 365
2023-10-18T16:22:17.890 ERROR (pid:10324) [node-client] - request error on "nvim_call_function" [ 'pyxeval', [ '1' ] ] Error: request error on "nvim_call_function" - Vim(return):E448: Could not load library function PyRun_SimpleString on api "call_function" ["pyxeval",["1"]]
    at UltiSnippetsProvider.init (C:\Users\sofia\AppData\Local\coc\extensions\node_modules\coc-snippets\lib\index.js:3335:18)
    at C:\Users\sofia\AppData\Local\coc\extensions\node_modules\coc-snippets\lib\index.js:1671:23
    at Array.map (<anonymous>)
    at ProviderManager.init (C:\Users\sofia\AppData\Local\coc\extensions\node_modules\coc-snippets\lib\index.js:1670:33)
    at Object.activate (C:\Users\sofia\AppData\Local\coc\extensions\node_modules\coc-snippets\lib\index.js:3921:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-10-18T16:22:19.114 INFO (pid:10324) [services] - LanguageClient Rust Analyzer Language Server state change: stopped => starting
2023-10-18T16:22:19.129 INFO (pid:10324) [language-client-index] - Language server "rust-analyzer" started with 14344
2023-10-18T16:22:19.154 INFO (pid:10324) [services] - LanguageClient Rust Analyzer Language Server state change: starting => running
2023-10-18T16:22:19.209 INFO (pid:10324) [services] - service rust-analyzer started
2023-10-18T16:22:51.356 INFO (pid:10324) [attach] - receive notification: checkJsonExtension []
2023-10-18T16:22:51.446 INFO (pid:10324) [services] - LanguageClient Json language server state change: stopped => starting
2023-10-18T16:22:51.461 INFO (pid:10324) [language-client-index] - Language server "json" started with 2760
2023-10-18T16:22:51.622 INFO (pid:10324) [services] - LanguageClient Json language server state change: starting => running
2023-10-18T16:22:51.629 INFO (pid:10324) [services] - service json started
2023-10-18T16:22:54.897 INFO (pid:10324) [attach] - receive notification: openList [ 'sources' ]
2023-10-18T16:23:13.316 INFO (pid:10324) [attach] - receive notification: openList [ 'sources' ]
2023-10-18T16:26:26.607 INFO (pid:10324) [attach] - receive notification: checkJsonExtension []
2023-10-18T16:27:20.206 INFO (pid:10324) [snippets-session] - Unable to find changed placeholder, cancel snippet session
2023-10-18T16:27:23.254 INFO (pid:10324) [attach] - receive notification: openList [ 'sources' ]
2023-10-18T16:31:15.441 INFO (pid:10324) [attach] - receive notification: showInfo []

What's the output of :CocCommand rust-analyzer.serverVersion image

What's your coc-rust-analyzer version? You can get it from :CocList extensions version 0.75.0

I have coc-snippet with 100 priority and rust LSP with 99 priority. But when I type the popup jumps to LSP although coc-snippet has higher-priority. How can I change that behavior to jump to higher priority. image

image

fannheyward commented 1 year ago

By default, coc.nvim enabled suggest.enablePreselect that if LS returns an item with preselect property, coc.nvim will select this one.

You can disable suggest.enablePreselect for your case.