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

Omnicomplete flickers when changing selection #204

Closed
amagee opened this issue Mar 19, 2015 · 6 comments
Closed

Omnicomplete flickers when changing selection #204

amagee opened this issue Mar 19, 2015 · 6 comments

Comments

@amagee
Copy link

amagee commented Mar 19, 2015

Suppose I type Console. and press <c-o><c-x> to open the Omnicomplete window. Every time I press the up or down arrow to select from the completions, the entire completion window seems to be redrawn, resulting in an annoying flicker. This doesn't seem to happen on my setup with Omnicomplete on other file types such as CSS.

@thinca
Copy link
Member

thinca commented Mar 19, 2015

I can't reproduce. Please tell me your environment(Vim's version and minimum vimrc).

@amagee
Copy link
Author

amagee commented Mar 19, 2015

Here are the first two lines of gvim --version (happy to post more if that would be useful, let me know). It's the vim from the Ubuntu 14.10 apt repositories.

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 20 2014 16:09:34)
Included patches: 1-273

I just tried with a clean .vimrc as follows (this is exactly the .vimrc appearing here https://github.com/OmniSharp/omnisharp-vim , just with execute pathogen#infect() inserted at the start.

execute pathogen#infect()

" OmniSharp won't work without this setting
filetype plugin on

"This is the default value, setting it isn't actually necessary
let g:OmniSharp_host = "http://localhost:2000"

"Set the type lookup function to use the preview window instead of the status line
"let g:OmniSharp_typeLookupInPreview = 1

"Timeout in seconds to wait for a response from the server
let g:OmniSharp_timeout = 1

"Showmatch significantly slows down omnicomplete
"when the first match contains parentheses.
set noshowmatch

"Super tab settings - uncomment the next 4 lines
"let g:SuperTabDefaultCompletionType = 'context'
"let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"
"let g:SuperTabDefaultCompletionTypeDiscovery = ["&omnifunc:<c-x><c-o>","&completefunc:<c-x><c-n>"]
"let g:SuperTabClosePreviewOnPopupClose = 1

"don't autoselect first item in omnicomplete, show if only one item (for preview)
"remove preview if you don't want to see any documentation whatsoever.
set completeopt=longest,menuone,preview
" Fetch full documentation during omnicomplete requests.
" There is a performance penalty with this (especially on Mono)
" By default, only Type/Method signatures are fetched. Full documentation can still be fetched when
" you need it with the :OmniSharpDocumentation command.
" let g:omnicomplete_fetch_documentation=1

"Move the preview window (code documentation) to the bottom of the screen, so it doesn't move the code!
"You might also want to look at the echodoc plugin
set splitbelow

" Get Code Issues and syntax errors
let g:syntastic_cs_checkers = ['syntax', 'semantic', 'issues']
" If you are using the omnisharp-roslyn backend, use the following
" let g:syntastic_cs_checkers = ['code_checker']
augroup omnisharp_commands
    autocmd!

    "Set autocomplete function to OmniSharp (if not using YouCompleteMe completion plugin)
    autocmd FileType cs setlocal omnifunc=OmniSharp#Complete

    " Synchronous build (blocks Vim)
    "autocmd FileType cs nnoremap <F5> :wa!<cr>:OmniSharpBuild<cr>
    " Builds can also run asynchronously with vim-dispatch installed
    autocmd FileType cs nnoremap <leader>b :wa!<cr>:OmniSharpBuildAsync<cr>
    " automatic syntax check on events (TextChanged requires Vim 7.4)
    autocmd BufEnter,TextChanged,InsertLeave *.cs SyntasticCheck

    " Automatically add new cs files to the nearest project on save
    autocmd BufWritePost *.cs call OmniSharp#AddToProject()

    "show type information automatically when the cursor stops moving
    autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation()

    "The following commands are contextual, based on the current cursor position.

    autocmd FileType cs nnoremap gd :OmniSharpGotoDefinition<cr>
    autocmd FileType cs nnoremap <leader>fi :OmniSharpFindImplementations<cr>
    autocmd FileType cs nnoremap <leader>ft :OmniSharpFindType<cr>
    autocmd FileType cs nnoremap <leader>fs :OmniSharpFindSymbol<cr>
    autocmd FileType cs nnoremap <leader>fu :OmniSharpFindUsages<cr>
    "finds members in the current buffer
    autocmd FileType cs nnoremap <leader>fm :OmniSharpFindMembers<cr>
    " cursor can be anywhere on the line containing an issue
    autocmd FileType cs nnoremap <leader>x  :OmniSharpFixIssue<cr>
    autocmd FileType cs nnoremap <leader>fx :OmniSharpFixUsings<cr>
    autocmd FileType cs nnoremap <leader>tt :OmniSharpTypeLookup<cr>
    autocmd FileType cs nnoremap <leader>dc :OmniSharpDocumentation<cr>
    "navigate up by method/property/field
    autocmd FileType cs nnoremap <C-K> :OmniSharpNavigateUp<cr>
    "navigate down by method/property/field
    autocmd FileType cs nnoremap <C-J> :OmniSharpNavigateDown<cr>

augroup END


" this setting controls how long to wait (in ms) before fetching type / symbol information.
set updatetime=500
" Remove 'Press Enter to continue' message when type information is longer than one line.
set cmdheight=2

" Contextual code actions (requires CtrlP or unite.vim)
nnoremap <leader><space> :OmniSharpGetCodeActions<cr>
" Run code actions with text selected in visual mode to extract method
vnoremap <leader><space> :call OmniSharp#GetCodeActions('visual')<cr>

" rename with dialog
nnoremap <leader>nm :OmniSharpRename<cr>
nnoremap <F2> :OmniSharpRename<cr>
" rename without dialog - with cursor on the symbol to rename... ':Rename newname'
command! -nargs=1 Rename :call OmniSharp#RenameTo("<args>")

" Force OmniSharp to reload the solution. Useful when switching branches etc.
nnoremap <leader>rl :OmniSharpReloadSolution<cr>
nnoremap <leader>cf :OmniSharpCodeFormat<cr>
" Load the current .cs file to the nearest project
nnoremap <leader>tp :OmniSharpAddToProject<cr>

" (Experimental - uses vim-dispatch or vimproc plugin) - Start the omnisharp server for the current solution
nnoremap <leader>ss :OmniSharpStartServer<cr>
nnoremap <leader>sp :OmniSharpStopServer<cr>

" Add syntax highlighting for types and interfaces
nnoremap <leader>th :OmniSharpHighlightTypes<cr>
"Don't ask to save when changing buffers (i.e. when jumping to a type definition)

@thinca
Copy link
Member

thinca commented Mar 20, 2015

Please try on smallest vimrc.
I think only the line of filetype plugin on is enough.

@amagee
Copy link
Author

amagee commented Mar 22, 2015

If my .vimrc only has filetype plugin on I get no omni-complete at all. I get "option 'omnifunc' is not set".

@thinca
Copy link
Member

thinca commented Mar 23, 2015

Please try at latest version. 'omnifunc' is set at latest version.

And... please try putting set completeopt-=preview in your vimrc.

I'm thinking set completeopt=longest,menuone,preview line is probably the cause. completeopt=preview makes Vim slow.

@amagee
Copy link
Author

amagee commented Mar 23, 2015

Ah yes I did put completeopt-=preview and that fixed the problem, thanks
:) Maybe it shouldn't be in the suggested settings if it causes that
behaviour?

On Mon, Mar 23, 2015 at 1:52 PM, thinca notifications@github.com wrote:

Please try at latest version. 'omnifunc' is set at latest version.

And... please try putting set completeopt-=preview in your vimrc.

I'm thinking set completeopt=longest,menuone,preview line is probably the
cause. completeopt=preview makes Vim slow.


Reply to this email directly or view it on GitHub
#204 (comment)
.

Andrew Magee
Freelance software developer

e: amagee@gmail.com
p: 0403 642 438
f: http://facebook.com/mageea
t: @amagee99 http://twitter.com/amagee99

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

3 participants