fannheyward / coc-rust-analyzer

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

Cannot enable diagnostic highlight & virtual text on NeoVim #1019

Closed huyHA9597 closed 2 years ago

huyHA9597 commented 2 years ago

Hi, I'm trying to get the highlight and virtual text of warning & error like VSCode on Neovim but currently I still stuck on how to enable them.

In Neovim, I cannot see any warning or error highlight Screen Shot 2022-07-21 at 19 52 49

However in VSCode I can see and check the warning quite easily. Screen Shot 2022-07-21 at 19 53 34

Here is my CocConfig

{
  "coc.preferences.useQuickfixForLocations": true,
  "coc.preferences.extensionUpdateCheck": "never",
  "coc.preferences.jumpCommand": "tab drop",
  "codeLens.enable": true,
  "suggest.noselect": false,
  "suggest.disableMenu": false,
  "suggest.snippetIndicator": "",
  "suggest.enablePreview": true,
  "suggest.labelMaxLength": 50,
  "suggest.enablePreselect": true,
  "suggest.triggerAfterInsertEnter": true,
  "suggest.removeDuplicateItems": false,
  "suggest.completionItemKindLabels": {
    "keyword": "\uf1de",
    "variable": "\ue79b",
    "value": "\uf89f",
    "operator": "\u03a8",
    "constructor": "\uf0ad",
    "function": "\u0192",
    "reference": "\ufa46",
    "constant": "\uf8fe",
    "method": "\uf09a",
    "struct": "\ufb44",
    "class": "\uf0e8",
    "interface": "\uf417",
    "text": "\ue612",
    "enum": "\uf435",
    "enumMember": "\uf02b",
    "module": "\uf40d",
    "color": "\ue22b",
    "property": "\ue624",
    "field": "\uf9be",
    "unit": "\uf475",
    "event": "\ufacd",
    "file": "\uf723",
    "folder": "\uf114",
    "snippet": "\ue60b",
    "typeParameter": "\uf728",
    "default": "\uf29c"
  },
  "diagnostic.virtualText": true,
  "diagnostic.virtualTextCurrentLineOnly": false,
  "diagnostic.checkCurrentLine": true,
  "diagnostic.displayByAle": true,
  "diagnostic.autoRefresh": true,
  "diagnostic.enable": true,
  "diagnostic.messageTarget": "echo",
  "diagnostic.enableHighlightLineNumber": true,
  "diagnostic.enableSign": true,
  "npm.binPath": "~/.nvm/versions/node/v12.14.1/bin/npm",
  "tsserver.disableAutomaticTypeAcquisition": false,
  "tsserver.log": "normal",
  "python.linting.pylintEnabled": true,
  "python.linting.enabled": true,
  "rust-analyzer.enable": true,
  "rust-analyzer.lens.enable": true,
  "rust-analyzer.rustc.source": "discover",
  "rust-analyzer.completion.callable.snippets": "fill_arguments",
  "rust-analyzer.signatureInfo.detail": "full",
  "rust-analyzer.cargo.autoreload": true,
  "rust-analyzer.diagnostics.enable": true,
  "rust-analyzer.lens.debug.enable": true,
  "rust-analyzer.cachePriming.enable": true,
  "rust-analyzer.inlayHints.enable": true,
  "rust-analyzer.inlayHints.typeHints.enable": true,
  "rust-analyzer.checkOnSave.allTargets": true,
  "rust-analyzer.hover.links.enable": true,
  "rust-analyzer.diagnostics.experimental.enable": true,
  "rust-analyzer.lens.run.enable": true,
  "rust-analyzer.diagnostics.disabled": [
        "macro-error",
        "unresolved-macro-call",
        "unresolved-import"
    ],
  "rust-analyzer.inlayHints.refreshOnInsertMode" : true,
  "rust-analyzer.inlayHints.chainingHints.enable": true,
  "rust-analyzer.files.watcher": "client"
}

My setting on init.vim file

" Settings: {{{
filetype indent plugin on
syntax enable
set encoding=utf-8
scriptencoding utf-8

set completeopt=menuone,noinsert,noselect,preview

set backspace=indent,eol,start
set expandtab
set autoindent
set shiftround
set softtabstop=-1
set textwidth=125
set title
set showcmd
set fileformat=unix

" Specific tab widths
set tabstop=4 
set shiftwidth=4

" TextEdit might fail if hidden is not set.
set hidden
set nofixendofline
set nostartofline
set splitbelow
set splitright
set hlsearch
set incsearch
set laststatus=2
set noruler
set noshowmode
set signcolumn=yes
set number
set relativenumber
set mouse=a
set updatetime=1000

" Some servers have issues with backup files: coc.nvim
set nobackup
set nowritebackup

set clipboard+=unnamedplus
" Move Swap Directory to something temporary.
set directory^=$HOME/tempswap//

What's the output of :CocInfo

## versions

vim version: NVIM v0.7.2
node version: v12.14.1
coc.nvim version: 0.0.81-2522eee5 2022-06-14 19:03:29 +0800
coc.nvim directory: /Users/huyhaan/.config/nvim/autoload/plugged/coc.nvim
term: iTerm.app
platform: darwin

## Log of coc.nvim

2022-07-21T19:20:44.021 INFO (pid:74043) [plugin] - coc.nvim initialized with node: v12.14.1 after 130ms
2022-07-21T19:20:45.949 INFO (pid:74043) [services] - registered service "rust-analyzer"
2022-07-21T19:20:45.950 INFO (pid:74043) [services] - Rust Analyzer Language Server state change: stopped => starting
2022-07-21T19:20:45.976 INFO (pid:74043) [language-client-index] - Language server "rust-analyzer" started with 74048
2022-07-21T19:20:45.993 INFO (pid:74043) [services] - Rust Analyzer Language Server state change: starting => running
2022-07-21T19:20:45.999 INFO (pid:74043) [services] - service rust-analyzer started
2022-07-21T19:21:32.068 WARN (pid:74043) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-07-21T19:48:20.265 INFO (pid:74043) [attach] - receive notification: showInfo []

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

rust-analyzer 0.3.1131-standalone (897a7ec4b 2022-07-17)
huyHA9597 commented 2 years ago

Hi. Just found out that there is a conflict between Ale and Coc.nvim. https://github.com/dense-analysis/ale/issues/2508#issuecomment-493366602

After I set "diagnostic.displayByAle" into false. The linter is working good now. Not coc-rust-analyzer problem. Closing issue now.