Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive errors after linting #450

Closed
Confuset opened this issue Mar 8, 2019 · 8 comments
Closed

False positive errors after linting #450

Confuset opened this issue Mar 8, 2019 · 8 comments

Comments

@Confuset
Copy link

Confuset commented Mar 8, 2019

Platform:
Windows 10
VIM - Vi IMproved 8.1
MS-Windows 64 Bit GUI Version

Reproduce:
Create simple console (with VS for example)
Open Program.cs
Insert gibberish
Wait linting

-> 'Program' is now flagged as already defined.
-> 'Main' is now flagged as already defined

ezgif com-optimize

vimrc

set nocompatible " be iMproved, required
set encoding=utf-8
set ignorecase
filetype plugin on
if &diff
colorscheme traffic_lights_diff
endif
call plug#begin('~/vimfiles/plugged')
Plug 'tpope/vim-vinegar'
Plug 'w0rp/ale'
Plug 'morhetz/gruvbox'
Plug 'OmniSharp/omnisharp-vim'
call plug#end()
set guifont=DejaVu_Sans_Mono:h11:cANSI:qDRAFT
colorscheme gruvbox
"set omnifunc=OmniSharp#Complete
let g:OmniSharp_highlight_types = 1
let g:OmniSharp_timeout = 5
set completeopt=longest,menuone,preview
augroup omnisharp_commands
autocmd!
" Show type information automatically when the cursor stops moving
autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation()
" Update the highlighting whenever leaving insert mode
autocmd InsertLeave *.cs call OmniSharp#HighlightBuffer()
augroup END
let g:ale_sign_column_always = 1
let g:ale_open_list = 1
let g:ale_keep_list_window_open = 0
let g:ale_linters = {
\ 'cs': ['OmniSharp']
}

sorry for the german error Messages, if somebody knows how to Change it. Let me know :-)

Sometimes I can solve it, by stopping and starting the OmniSharp-Roslyn.

Any ideas?

@nickspoons
Copy link
Member

Yeah I've seen this. I am fairly sure it's a known OmniSharp-roslyn bug, where files that get read before the server is fully loaded are registered twice. I haven't experienced it for a while though, I believe it has been fixed, do you have the latest server?

:OmniSharpInstall

The way I've otherwise "worked around" this is to try not to do any operations that trigger the server until the server is loaded. Because you have highlighting triggered on InsertLeave this means try to wait on making any buffer changes until the server is going strong - hopefully only a few seconds but you can try experimenting.

@Confuset
Copy link
Author

Confuset commented Mar 9, 2019

mh, so timing does change things but i don't know if it is for the better or ther worst..
so i tried to wait for 10s, 20s, and 60s and tested what happens. so i observed these behaviours, kind of independand of the waiting time.

typing gibberish

  • no complains at all (mostly observed when waited long)
  • only compleining about a missing semicolon (when typing in a semicolon, no errors are reported)
  • as before, double definition of class etc.

when i check the version i get fileversion 1.32.0.0 or productversion 1.32.8 which looks like the latest stable release.

@nickspoons
Copy link
Member

The OmniSharp.exe I am currently using has Product version 1.32.10, so you could try upgrading and see if it helps?

If you run into any problems you can always downgrade again with :OmniSharpInstall 'v1.32.8'

@Confuset
Copy link
Author

looked up change notes for v1.32.10:

Updated to Roslyn 3.0 to match VS 2019

that is probably the reason you got pretty different results ;-)

will try that tomorrow and report results
iam assuming i have to call

:OmniSharpInstall 'v1.32.11'

as that is the most current pre-release

@Confuset
Copy link
Author

thats works perfectly fine. completion is faster as well.
in General everything feels snappier :-)

thanks for helping out on this.

Btw. are you using Roslynator or something like that?

@nickspoons
Copy link
Member

Glad to hear it!

No I'm not using Roslynator, I'll be interested to hear if you have success with it?

@Confuset
Copy link
Author

so, you can follow https://github.com/JosefPihrt/Roslynator/blob/master/docs/RoslynatorForVisualStudioCode.md to get roslynator somewhat to be read from omnisharp-roslyn but i did not see any changes.
Check
dotnet/vscode-csharp#43
and the PR
OmniSharp/omnisharp-roslyn#1076

It is probably the best if i create i feature request for this, as this is really off Topic now :-)

And my issue was resolved. Thanks for the help :-)

@Confuset
Copy link
Author

#451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants