OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

Highlighter errors when installed with vim 8 packs #657

Closed fractalic closed 4 years ago

fractalic commented 4 years ago

When loading a .cs file, after cloning omnisharp-vim into pack/plugins/start, I encounter an error message that seems to be related to omnisharp's hightlight groups:

Error detected while processing function OmniSharp#proc#vimOutHandler[11]..OmniSharp#stdio#HandleResponse[42].
.<SNR>28_HighlightRH[29]..<SNR>28_GetHighlight:
line    9:
E970: Unknown highlight group name: 'Identifier'

Then, when I attempt to run :OmniSharpHighlight, I see this error:

E969: Property type OSHighlightNamespaceName already defined

I initially encountered this error in an existing vim setup, but I've been able to replicate it in a clean installation, which I've detailed below:

tree -L 4 ~/.vim

├── autoload
├── bundle
├── colors
├── conf
├── ftdetect
├── indent
└── pack
    └── plugins
        └── start
            └── omnisharp-vim

~/.vimrc

filetype indent plugin on
let g:OmniSharp_highlight_groups = {
\ 'Comment': 'NonText',
\ 'XmlDocCommentName': 'Identifier',
\ 'XmlDocCommentText': 'NonText'
\}

vi --version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov  4 2020 11:27:02)
macOS version
Included patches: 1-1950
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        +termguicolors
-balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
-browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl              +title
-clientserver      +job               +persistent_undo   -toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3           +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua               +ruby              +wildmenu
+dialog_con        +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       -X11
-dnd               +mouse             -sound             -xfontset
-ebcdic            -mouseshape        +spell             -xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              -mouse_gpm         +statusline        -xsmp
+ex_extra          -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.32.0/lib/perl5/5.32.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin -lpython3.9 -framework CoreFoundation  -lruby.2.7   

And finally a sample XUnit test file where I see this error on loading:

using Xunit;

public class Sample
{
    [Fact]
    public void First()
    {
            Assert.True(True);
    }
}

When installed with vim-plug, OmniSharp-vim works fine. Maybe I just missed some configuration?

fractalic commented 4 years ago

Pathogen installation also works fine.

nickspoons commented 4 years ago

Thanks for the detailed issue. I haven't had a chance to look into it yet, but I will.

fractalic commented 4 years ago

Thanks Nick :) honestly still haven't ruled out some sort of user error on my part 😅

nickspoons commented 4 years ago

Oh! You just have to turn on Vim's syntax, because otherwise the standard highlight groups aren't configured.

filetype indent plugin on
syntax enable
nickspoons commented 4 years ago

I added a note about this to the README.

fractalic commented 4 years ago

🎉 and also 🤦 😃