OmniSharp / omnisharp-vim

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

Pattern not found #704

Closed BlueStaggo closed 3 years ago

BlueStaggo commented 3 years ago

Pattern not found

I'm using OmniSharp on Neovim for the first time and I can't seem to get Omni-completion working.

init.vim (or .vimrc for vim)

""" Plugins

call plug#begin(stdpath('data') . '/plugged')

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'OmniSharp/omnisharp-vim'
Plug 'nickspoons/vim-sharpenup'
Plug 'scrooloose/nerdtree'

call plug#end()

""" Plugin configurations

" Enable powerline symbols
let g:airline_powerline_fonts = 1

""" Settings

" This is needed and idk why
filetype plugin on

" This is cursed, but I'll use it anyways
set mouse=a

" Enable line numbers
set number

" Disable menu bar in gvim
set guioptions=

" Enable 256 colours
set t_Co=256

" Enable syntax highlighting
syntax on

" Set the color scheme
colorscheme gruvbox

after/init.vim (I don't know the Vim equivalent)

AirlineTheme gruvbox

.NET info

dotnet --version: 5.0.203 dotnet --list-sdks: 5.0.203 [C:\Program Files\dotnet\sdk] msbuild --version: 16.9.0.16703 omnisharp msbuild --version: MSBuild completely screws up here, but OmniSharp uses the one from Visual Studio, so it is ok.

OmniSharp log

NVIM v0.4.4

OmniSharp server started.
    Path: C:\Users\CENSORED\AppData\Local\omnisharp-vim\omnisharp-roslyn\OmniSharp.exe
    Target: C:\Users\CENSORED\Programming\CS\HelloWorld
    PID: 55084

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Visual Studio Community 2019 16.9.31313.79 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
            2: StandAlone 16.11.0 - "C:\Users\CENSORED\AppData\Local\omnisharp-vim\omnisharp-roslyn\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Community 2019 16.9.31313.79 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'C:\Users\CENSORED\Programming\CS\HelloWorld'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'C:\Users\CENSORED\Programming\CS\HelloWorld'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'C:\Users\CENSORED\Programming\CS\HelloWorld\HelloWorld.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'C:\Users\CENSORED\Programming\CS\HelloWorld'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'C:\Users\CENSORED\Programming\CS\HelloWorld' on host -1.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: C:\Users\CENSORED\Programming\CS\HelloWorld\HelloWorld.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'C:\Users\CENSORED\Programming\CS\HelloWorld\HelloWorld.csproj'.
All projects loaded
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project 'C:\Users\CENSORED\Programming\CS\HelloWorld\HelloWorld.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: HelloWorld
Replaying on-load requests

Extra info

nickspoons commented 3 years ago

OmniSharp-vim uses vim omni-completion. Trigger it from insert mode by typing <C-x><C-o>.

If you want completions to be displayed automatically as you type, you'll need an auto-completion plugin, as described in the README. The example config uses asyncomplete.

To verify that OmniSharp-vim is working as expected, Try some things like :OmniSharpGotoDefinition, :OmniSharpFindUsages, :OmniSharpGlobalCodeCheck.


I don't know if you want feedback on your init.vim, but the line "This is needed and idk why" triggered me :smile:. As you are using vim-plug, you don't need line 21 filetype plugin on, because vim-plug does this for you. ~And I expect the line you have in after/init.vim could go directly in your init.vim, after you set colorscheme gruvbox~ No I was wrong about this bit, sorry, discard.

BlueStaggo commented 3 years ago

I've been using <C-x><C-o> and that didn't work. The thing that surprised me was that OmniSharp commands didn't do anything and didn't throw any errors as far as I know. Also, I'm quite new to Vim, so I didn't know what filetype plugin on did.

nickspoons commented 3 years ago

Ohhhh ... neovim 0.4.4 on Windows. That doesn't work 😅

There was a neovim bug, which I reported, and was fixed. See https://github.com/OmniSharp/omnisharp-vim/issues/499 for details.

So your options are to download a nightly build of neovim, or use vim. Sorry I didn't put the pieces together immediately.

BlueStaggo commented 3 years ago

Norton hates Neovim 5.0 (just like many other things) (32 bit and 64 bit), I don't know how to get the missing dependencies to build it with MinGW and I don't know how to get Plug working with Vim. I'll just wait for 5.0 to release unless there are workarounds. I'll leave this open for now.

nickspoons commented 3 years ago

I don't think there's any reason to keep the issue open: it's a duplicate of #499 and is also mentioned in the README, under Asynchronous server interactions over Studio.

Getting vim-plug to work with vim or gvim is very simple, it's described in the project README. But if you'd prefer to wait for neovim 0.5 to be released, that's up to you. The only other workaround to get OmniSharp-vim working on Windows with neovim is to use the HTTP version of the server instead of the stdio version. However, I wouldn't recommend this, using the HTTP server means you need python, all server requests are synchronous, and many features are not available, such as popups and full semantic highlighting.

BlueStaggo commented 3 years ago

I managed to get it working with Vim. You can easily tell why I want to wait for Neovim 0.5 instead: image My guess is that the omnicompletion pop-up was added in by Neovim. I've tried the HTTP version and nothing worked. Guess I'll have to wait for 0.5!

nickspoons commented 3 years ago

You can easily tell why I want to wait for Neovim 0.5 instead

No? What's the problem? I can't see much in that small screenshot. Is the completion menu not being displayed? That's peculiar. What version of vim is this, and is it terminal or gvim?

My guess is that the omnicompletion pop-up was added in by Neovim.

No, omnicompletion and the completion menu has been part of vim for many years, long before neovim was forked.

BlueStaggo commented 3 years ago

No, omnicompletion and the completion menu has been part of vim for many years, long before neovim was forked

Sorry, I made a mistake. I set my completeopt setting to noinsert, which, apparently, is required by muComplete. I guess NeoVim automatically adds in the menu option. I guess I'll use Vim for now until NeoVim 0.5 comes out or I find a nightly build of 0.5 that Norton doesn't mind.

nickspoons commented 3 years ago

The default completeopt for both vim and neovim is completeopt=menu,preview