prabirshrestha / asyncomplete.vim Goto Github PK
View Code? Open in Web Editor NEWasync completion in pure vim script for vim8 and neovim
License: MIT License
async completion in pure vim script for vim8 and neovim
License: MIT License
Hi, and nice work ๐
you wrote exprimental
but you forgot an e
to do experimental
โบ
I wasn't sure if this project supported LanguageClient-neovim and its many available language servers (or if it would even be possible), but that would be great. Looks like there's a vim-specific solution here, but it doesn't support completion yet: https://github.com/tjdevries/nvim-langserver-shim
Great addon, thanks a lot for creating it! I'm currently use it together with
asyncomplete-buffer.vim. Fuzzy-matching capabilities and it's really a lightweight one!
Some feature requests (if you don't mind...):
E.g. (default value): let g:asyncomplete_popup_on_minimum_characters = 0
I for myself would set that option to 3 so you'd need to type 3 characters before the autocomplete popup appears
Keep the popup open after invoking it (with or ctrl+space) when let g:asyncomplete_auto_popup = 0 is used
Atm the popup closes automatically if you type more to narrow down the result list
If there is only one possible match, don't show the popup first (with that single entry) but automatically autocomplete the item immediately
Ofc as an option, e.g.: let g:asyncomplete_complete_on_single_match = 1
Refer to vim/vim#1691 and vim/vim#2372 for more details on reason behind why TextChangedP
is better than timers.
Use exists('##TextChangedP')
to detect if the autocmd exists.
System: gvim 8.1 - 1-116 / windows10
I'm tesing this plugin with python file, when type p
you have a list of candidates, then type print
--> using backspace to delete nt
, now we have no candidates.
Hi,
Thanks for awesome plugins by the way. Your plugins are the best lang server integration I've seen. I'm getting great relevant langserver completion results but there are also "dumb" results with keywords from the current file (See rad
in image below).
Is it possible to only use the results from the lang server?
Hi,
Just wondering if it is possible to use this plugin with FZF, so that rather than searching using the standard prefix search, the plugin just provides a list of possible words to FZF and FZF fuzzy matches them?
This is great plugin. Thanks so much for your efforts. I am wondering how I could set keymapping for goto function.
In a python file, type print
in a fast way, for the first time no candidate appears at all, I have to force refresh, but it doesn't happen with snips that come up with its own supported plugin asyncomplete-ultisnips
, so I guess there's something with update completion on change of context.
when using deoplete, I use deoplete-clang2 or deoplete-clang, will this plugin support clang sources?
I'm trying to install this plugin in windows (Babun) I get this error message when I go to insert mode. Am I missing any dependencies?
Error detected while processing function 59_change_tick_start:
line 6:
E117: Unknown function: timer_start
Press ENTER or type command to continue
Error detected while processing function 59_change_tick_start:
line 6:
E15: Invalid expression: timer_start(30, function('s:check_changes'), { 'repeat': -1 })
Hi, the roots of the issue you could find here (prabirshrestha/asyncomplete-gocode.vim#7). I found that the line let l:candidates = s:supports_smart_completion() ? s:custom_filter_completion_items(a:ctx['typed'][a:startcol-1 : col('.') - 1], a:matches) : a:matches
does the odd trick with a:matches list: namely removes the last element. Is that intended?
When I set vim-lsp's lsp_async_completion=1
, my Ultisnips completion just flashes for a short amount of time and is then gone again, if I force refresh, it doesn't show any Ultisnips completion results.
When I set lsp_async_completion=0
, I get duplicate results (even though I have that flag for duplicate results enabled, it's not filtering them out)
Let me know if I should repost this issue in another repository!
with the latest version of asyncomplete (which reintroduced TextChangedP) the completion is working ok, but there's a little issue: If I start typing a word the completion menu appears, but if for some reason I delete a letter (e.g. because I made a mistake) the menu disappear and it doesn't appear anymore unless I erase all the word except the first letter. It doesn't matter if I write another letter, press tab etc. If I want the menu back I have to erase the word up to the first letter. for example:
I'm using neovim:
NVIM v0.2.3-715-g1d5eec2c6
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180305-87677-1emzc9v/build/config -I/tmp/neovim-20180305-87677-1emzc9v/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include -I/tmp/neovim-20180305-87677-1emzc9v/build/src/nvim/auto -I/tmp/neovim-20180305-87677-1emzc9v/build/include
Compilato da [email protected]
Features: +acl +iconv +jemalloc +tui
this is my config:
let g:asyncomplete_remove_duplicates = 1
let g:lsp_async_completion = 1
let g:lsp_log_file = ''
call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
\ 'name': 'buffer',
\ 'whitelist': ['*'],
\ 'completor': function('asyncomplete#sources#buffer#completor'),
\ }))
call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
\ 'name': 'omni',
\ 'whitelist': ['*'],
\ 'blacklist': ['html', 'javascript', 'javascript.jsx'],
\ 'completor': function('asyncomplete#sources#omni#completor')
\ }))
call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
\ 'name': 'file',
\ 'priority': 10,
\ 'whitelist': ['*'],
\ 'completor': function('asyncomplete#sources#file#completor')
\ }))
if executable('typescript-language-server')
call lsp#register_server({
\ 'name': 'typescript-language-server',
\ 'priority': 9,
\ 'cmd': { server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']},
\ 'root_uri': { server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_directory(lsp#utils#get_buffer_path(), '.git/..'))},
\ 'whitelist': ['typescript', 'javascript', 'javascript.jsx']
\ })
endif
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
imap <expr> <Space> pumvisible() ? "\<C-y>\<Space>" : "\<Space>"
I've already opened similar issue on deoplete
and Shougo was kind enough to implement it after I've made a pull request.
The behaviour I want to preserve is when there is not popupmenu (because there's no completion yet because you haven't entered enough characters to trigger it) C-n
and C-p
should insert closest next/previous word. It's actually pretty useful in some cases. Consider in python
Some = namedtuple('|
pressing C-p
here twice would insert Some
. Or when passing keyword arguments in python context=context
instead of retyping one could simply press C-p
. Also there is a recipe that uses this behaviour to create a mapping to autoclose xml tags.
System: gvim 8.1 1-116 / windows 10
Relevant vimrc config:
if executable('rls')
au User lsp_setup call lsp#register_server({
\ 'name': 'rls',
\ 'cmd': {server_info->['rustup', 'run', 'nightly', 'rls']},
\ 'whitelist': ['rust'],
\ })
endif
Rust on windows10 packages:
> rustup component list
cargo-x86_64-pc-windows-msvc (default)
rls-preview-x86_64-pc-windows-msvc (installed)
rustc-x86_64-pc-windows-msvc (default)
I can't trigger asyncomplete to work with .rs
file under cargo project (cargo new _test --bin
), but autocompletion for Ultisnips
work well on them, I can choose snips candidates from pop-up menu.
Hi,
First off, I'm genuinely impressed by how snappy your plugin ecosystem works, much appreciated ๐
I couldn't find anything, so I was wondering if there is any way to limit the number of results a plugin returns (for example, at most n snippets) and/or the total number of results (e.g. at most 10 completions)?
I have a small test project from LanguageClient-neovim. This seems to work. I get autocompletion.
With my project, it does not work (~70000 loc). I do not get completion.
Hi,
Is it possible to group a few sources together and make a asyncomplete plugin such as buffer, filename etc?
And let language server utilize omni_complete function?
I like the plugin at it does not require python binding.
Thanks
Firstly, this plugin works really well and is quite lightweight. Thank you for your work on it! I am using it with g:asyncomplete_auto_popup = 0
and manually invoking it with <tab>
as described in the readme.
I am wondering why it is necessary to set completeopt
in s:core_complete
? Are these settings (menuone,noselect/noinsert
) considered mandatory for the plugin to work? Why are they set at every invocation instead of once during initialization? Why aren't the user's initial settings restored?
I was initially surprised when my completeopt
settings were being changed after pressing <tab>
. This functionality/limitation unfortunately does not seem to be addressed in either the readme or doc.
It looks like asyncomplete tries to complete on any buffer change by default. Is it possible to only try to complete when user explicitly asks for it โ on Tab
keypress, for example?
There are a couple issues floating around GitHub for the different LSP clients for vim/nvim, their completion engines, and various snippet integration engines.
An issue does not seem to be filed with asyncomplete.vim yet for this support (correct me and close this if I'm wrong!) so I wanted to start that thread.
For any that are unaware, it appears that clangd broadcasts support for c++ snippets and those broadcasts appropriately show up in the omni popup menu.
I can navigate through those "completion" options that are sourced as "snippets" from clangd, but I can't invoke the snippet.
Now, maybe this isn't a job for the completion engine? Should this fall onto a snippet engine instead? If that's the case, I feel it may be time to write a vim-lsp-snippet project for that very reason, as LSP snippets (I don't think) don't belong in the hands of something like UltiSnips/neosnippet/etc. Or at least, if they do, this vim-lsp/asyncomplete.vim/etc. toolset would be best not to rely on them for fear of "getting more than you bargained for". But I am not familiar with snippet engines in general so I could be very wrong about this.
Nonetheless, there's my two cents. Is expanding LSP snippets something the asyncomplete project feels it should handle? Should that fall into the hands of something like UltiSnips? Should another tool for this vim-lsp chain be added explicitly for LSP snippet expansion?
P.S. I apologize for this being mildly incoherent. I'm up way past my bedtime and far too tired to be very coherent ATM ๐
I've been attempting to wrap LanguageClient-neovim to provide completions for asyncomplete, which has mostly worked, but I've noticed that some of the candidates passed into asyncomplete#complete()
appear to be ignored by it -- they don't show up in the popup menu, and I don't get an error message displayed or logged.
I'm unfamiliar with vimscript, so this could definitely be some error on my part, but the behaviour is pretty odd, and I can't figure out what could be causing it.
This first one looks about right...
Where'd json.loads
go?
json.dumps
has vanished but this otherwise is what I'd expect
Still good...
wat.
call plug#begin("~/.config/nvim/plugged")
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }
Plug 'prabirshrestha/async.vim' | Plug 'prabirshrestha/asyncomplete.vim'
call plug#end()
let g:LanguageClient_serverCommands = {}
if executable('pyls')
let g:LanguageClient_serverCommands.python = ['pyls']
endif
" LanguageClient-neovim / asyncomplete integration wrapper, must be after LC server registrations
function! s:LanguageClient_handle_asyncomplete_callback(name, ctx, startcol, matches)
let l:result = get(a:matches, 'result')
let l:result = l:result is v:null ? [] : l:result
call asyncomplete#log('LanguageClient-nvim', 'handle_asyncomplete_callback', a:matches)
call asyncomplete#complete(a:name, a:ctx, a:startcol, l:result)
endfunction
function! s:LanguageClient_asyncompletor(opt, ctx) abort
let l:col = a:ctx['col']
let l:typed = a:ctx['typed']
let l:kw = matchstr(l:typed, '\w\+$')
let l:kwlen = len(l:kw)
let l:startcol = l:col - l:kwlen
" Have LC generate the completion matches and pass it a callback partial into asyncomplete
" LanguageClient's Rust code uses 0-based column indexing instead of 1-based, AFAICT
call LanguageClient#omniComplete(
\ {
\ 'complete_position': (l:startcol - 1),
\ 'character': (l:col - 1),
\ },
\ function('s:LanguageClient_handle_asyncomplete_callback', [a:opt['name'], a:ctx, l:startcol]))
endfunction
let s:lc_languages = keys(get(g:, 'LanguageClient_serverCommands', {}))
au User asyncomplete_setup call asyncomplete#register_source({
\ 'name': 'LanguageClient-neovim',
\ 'whitelist': s:lc_languages,
\ 'priority': 5,
\ 'completor': function('s:LanguageClient_asyncompletor'),
\ })
let g:asyncomplete_log_file = expand('~/.local/share/nvim/asyncomplete.log')
Here's the log. As per the given init.vim, I added a log statement in my callback handler to capture the callback result from LanguageClient#omniComplete()
, and from what I can see it does contain a list of valid complete-items
in the return
attribute. I pass that list into asyncomplete#complete()
, but then only some of the items actually end up listed in the pop-up?
What's the config I should use to make tmux-complete.vim working well with asyncomplete.vim? Thanks!
(I'm sorry for my poor English.)
Hi, prabirshrestha
First of all, I appreciate vim-lsp, asyncomplete and related great plugins.
Duplicate "$" completion for PHP file. :(
list
[NG]done
$$variable2
:(
" plugin (use vim-plug) {{{
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
call plug#end()
" }}}
" log
let g:asyncomplete_log_file = expand('/tmp/asyncomplete.log')
" [LSP] php-language-server
"
" @see
" https://github.com/prabirshrestha/vim-lsp/wiki/Servers-PHP
augroup LspPHP
au!
au User lsp_setup call lsp#register_server({
\ 'name': 'php-language-server',
\ 'cmd': {server_info->['php', expand('~/.composer/vendor/felixfbecker/language-server/bin/php-language-server.php')]},
\ 'whitelist': ['php'],
\ })
augroup end
vim -N -u minimal.vimrc example.php
|
is cursor.
<?php
$variable1 = "test";
$variable2 = "test";
echo $|
["core","s:clear_active_sources",1]
["core","remote_insert_enter"]
["core","computing get_active_sources_for_buffer",1]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["",-1,-1],{"lnum":5,"bufnr":1,"col":1,"changedtick":4,"typed":"","filetype":"php","curpos":[0,5,1,0,1],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["",-1,-1],{"lnum":6,"bufnr":1,"col":1,"changedtick":5,"typed":"","filetype":"php","curpos":[0,6,1,0,1],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["e",0,1],{"lnum":6,"bufnr":1,"col":2,"changedtick":6,"typed":"e","filetype":"php","curpos":[0,6,2,0,2],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","completor()","asyncomplete_lsp_php-language-server",{"lnum":6,"bufnr":1,"col":2,"changedtick":6,"typed":"e","filetype":"php","curpos":[0,6,2,0,2],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["ec",0,2],{"lnum":6,"bufnr":1,"col":3,"changedtick":7,"typed":"ec","filetype":"php","curpos":[0,6,3,0,3],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["ech",0,3],{"lnum":6,"bufnr":1,"col":4,"changedtick":8,"typed":"ech","filetype":"php","curpos":[0,6,4,0,4],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["echo",0,4],{"lnum":6,"bufnr":1,"col":5,"changedtick":9,"typed":"echo","filetype":"php","curpos":[0,6,5,0,5],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["",-1,-1],{"lnum":6,"bufnr":1,"col":6,"changedtick":10,"typed":"echo ","filetype":"php","curpos":[0,6,6,0,6],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["",-1,-1],{"lnum":6,"bufnr":1,"col":7,"changedtick":11,"typed":"echo $","filetype":"php","curpos":[0,6,7,0,7],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["v",6,7],{"lnum":6,"bufnr":1,"col":8,"changedtick":12,"typed":"echo $v","filetype":"php","curpos":[0,6,8,0,8],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","completor()","asyncomplete_lsp_php-language-server",{"lnum":6,"bufnr":1,"col":8,"changedtick":12,"typed":"echo $v","filetype":"php","curpos":[0,6,8,0,8],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:python_cm_complete","asyncomplete_lsp_php-language-server",{"lnum":6,"bufnr":1,"col":8,"changedtick":12,"typed":"echo $v","filetype":"php","curpos":[0,6,8,0,8],"filepath":"/Users/maamo888/_Dev/php/example.php"},7,true,0]
["core","s:core_complete"]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["va",6,8],{"lnum":6,"bufnr":1,"col":9,"changedtick":17,"typed":"echo $va","filetype":"php","curpos":[0,6,9,0,9],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","completor()","asyncomplete_lsp_php-language-server",{"lnum":6,"bufnr":1,"col":9,"changedtick":17,"typed":"echo $va","filetype":"php","curpos":[0,6,9,0,9],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:python_cm_complete","asyncomplete_lsp_php-language-server",{"lnum":6,"bufnr":1,"col":9,"changedtick":17,"typed":"echo $va","filetype":"php","curpos":[0,6,9,0,9],"filepath":"/Users/maamo888/_Dev/php/example.php"},7,true,0]
["core","s:core_complete"]
["core","s:remote_refresh","asyncomplete_lsp_php-language-server",["",-1,-1],{"lnum":6,"bufnr":1,"col":18,"changedtick":30,"typed":"echo $$variable2;","filetype":"php","curpos":[0,6,18,0,18],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","completor()","asyncomplete_lsp_php-language-server",{"lnum":6,"bufnr":1,"col":18,"changedtick":30,"typed":"echo $$variable2;","filetype":"php","curpos":[0,6,18,0,18],"filepath":"/Users/maamo888/_Dev/php/example.php"}]
["core","s:python_cm_complete","asyncomplete_lsp_php-language-server",{"lnum":6,"bufnr":1,"col":18,"changedtick":30,"typed":"echo $$variable2;","filetype":"php","curpos":[0,6,18,0,18],"filepath":"/Users/maamo888/_Dev/php/example.php"},18,true,0]
["core","remote_insert_leave"]
Hello @prabirshrestha, sometimes on completion I get annoying messages such as Pattern not found
or match 1 of <number>
. This messages are completely useless. Maybe it's better to disable them? After some digging I found this thread. This patch was merged in vim 7.4.something, so as long as this plugin relies on vim 8 features, this feature is available. It allows to set set shortmess+=c
in order to disable such messages. Also, youcompleteme sets this flag here, discussion.
README describes only use of full words while from what I have seen in docs it provides much more possibilities. I think it would be worth to list them.
When I type
class A
a popup helpfully appears offering me completions for A
. If I just want to make a new class without choosing any selections, I have to press Esc
which also takes me out of insert mode. In other popups that I'm used it by pressing <Enter>
after the A
the popup goes away and I am left with just the A
I typed. Can I configure you do to that? I didn't see anything obvious in the docs.
System: gvim 8.1 - 116 / windows10
Runing with corei7/ssd pc, should not have any problem with os itself. Completion causes vim not respond as image below. I believe it happens randomly especially after install asyncomplete-tags.vim
, I'll disable that plugin for a while and give feedback if this issue still occurs.
This issue happens sometime for me in recent couple of days, never happend before.
Plugins in suspection: ludovicchabant/vim-gutentags
, prabirshrestha/asyncomplete-tags.vim
If you have any ways to troubleshoot this, please do let me know.
core should compute startcol
and pass it to completor function as part of context
Currently when more than a single sources is enabled for a buffer it is possible to get duplicates in the completion menu. For example, for JS I use both buffer
and flow
(this is needed as buffer
is more robust โ even when syntax is not valid it can do its job while flow
is more "correct").
I think asyncomplete
can do dedup. That would probably require to provide some priority order for sources though โ for example flow
should be prioritised over buffer
as its completions are more "correct" (based on semantic source code knowledge).
Any plans to import the NCP tag completion functionality?
Yes, I'm asking/begging because I'm not capable of doing it myself ^^
Hi,
I saw your posts on reddit and I'm really interesting in trying out your plugin. It seems the setup is different from what I'm used to or I am missing something?
No popup is showing when I type...
I'm using neovim on ubuntu:
Config
`Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-tags.vim'
let g:asyncomplete_auto_popup = 1
inoremap pumvisible() ? "<C-n>" : "<Tab>"
inoremap pumvisible() ? "<C-p>" : "<S-Tab>"
inoremap pumvisible() ? "<C-y>" : "<cr>"
let g:asyncomplete_log_file = expand('~/asyncomplete.log')
imap (asyncomplete_force_refresh)
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#tags#get_source_options({
\ 'name': 'tags',
\ 'whitelist': ['c'],
\ 'completor': function('asyncomplete#sources#tags#completor'),
\ 'config': {
\ 'max_file_size': 50000000,
\ },
\ }))
`
Log:
["core","python_cm_insert_enter"]
["core","python_cm_insert_enter"]
["core","python_cm_insert_enter"]
["core","python_cm_insert_enter"]
["core","python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
["core", "python_cm_insert_enter"]
Hi All,
I'm trying to check out asyncomplete and there's a mismatch between my expectations and results. My expectation is that as I type, I should see suggestions start popping up. But in reality, after I type something (while still in Insert mode), I press and I see a list pop up where I can tab through some results. This is in the context of a simple C++ project. I'm using vim8.1 in Windows and I'm using Pathogen to handle all the extra additions listed here:
asyncomplete.vim
async.vim
vim-lsp
I've verified that I've downloaded the LLVM binaries and I've registered with the clangd LSP. Here's a snippet from my .vimrc.
" Registering clangd LSP with asyncomplete
if executable('clangd')
au User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd']},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
\ })
endif
" Asyncomplete tab completion
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
let g:asyncomplete_remove_duplicates = 1
let g:asyncomplete_smart_completion = 1
Any ideas on the disconnect between my expectation and my current result??
I have noticed that the double splat operator '**' will cause asyncomplete to hang or emit error messages across several different file types. In python files it tends to hang very briefly then emit messages similar to below. With a Makefile I recently edited it froze vim indefinitely and I ended up having to stop vim with kill -9
.
I would not normally expect vim to auto complete these types of special characters / operators.
This looked like it might have a workaround by editing the matching regex, I will respond here if I find anything.
:messages
output from the error while editing a python file.
Error detected while processing function <SNR>32_on_vim_job_event[12]..<SNR>32_on_exec_events[8]..<SNR>32_complete[3]..asyncomplete#complete[11]..<SNR>28_python_cm_complete[19]
..<SNR>28_python_refresh_completions[49]..<SNR>28_filter_completion_items:
line 3:
E871: (NFA regexp) Can't have a multi follow a multi !
E61: Nested *
Error detected while processing function <SNR>32_on_vim_job_event[12]..<SNR>32_on_exec_events[8]..<SNR>32_complete[3]..asyncomplete#complete[11]..<SNR>28_python_cm_complete[19]
..<SNR>28_python_refresh_completions:
line 49:
E734: Wrong variable type for +=
Vim version:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 30 2018 08:01:13)
Included patches: 1-1608
Compiled by ryan@fanai
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +cmdline_hist +eval +job +mouse +num64 +scrollbind +termresponse +windows
+arabic +cmdline_info +ex_extra +jumplist +mouseshape +packages +signs +textobjects +writebackup
+autocmd +comments +extra_search +keymap +mouse_dec +path_extra +smartindent +timers +X11
-autoservername +conceal +farsi +lambda -mouse_gpm +perl +startuptime +title -xfontset
+balloon_eval +cryptv +file_in_path +langmap -mouse_jsbterm +persistent_undo +statusline +toolbar +xim
+balloon_eval_term +cscope +find_in_path +libcall +mouse_netterm +postscript -sun_workshop +user_commands +xpm
+browse +cursorbind +float +linebreak +mouse_sgr +printer +syntax +vertsplit +xsmp_interact
++builtin_terms +cursorshape +folding +lispindent -mouse_sysmouse +profile +tag_binary +virtualedit +xterm_clipboard
+byte_offset +dialog_con_gui -footer +listcmds +mouse_urxvt -python +tag_old_static +visual -xterm_save
+channel +diff +fork() +localmap +mouse_xterm +python3 -tag_any_white +visualextra
+cindent +digraphs +gettext +lua +multi_byte +quickfix -tcl +viminfo
+clientserver +dnd -hangul_input +menu +multi_lang +reltime +termguicolors +vreplace
+clipboard -ebcdic +iconv +mksession -mzscheme +rightleft +terminal +wildignore
+cmdline_compl +emacs_tags +insert_expand +modify_fname +netbeans_intg +ruby +terminfo +wildmenu
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/
include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/
pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16
-I/usr/include/freetype2 -I/usr/include/libpng16 -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -L/home/ryan/.rbenv/versions/2.5.0/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgd
k-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11
-lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -ldl -L/usr/lib -llua5.1 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -lperl
-ldl -lm -lpthread -lcrypt -L/usr/lib/python3.5/config -lpython3.6m -Wl,-rpath,/home/ryan/.rbenv/versions/2.5.0/lib -L/home/ryan/.rbenv/versions/2.5.0/lib -lruby-static -lpt
hread -lgmp -ldl -lcrypt -lm -L/home/ryan/.rbenv/versions/2.5.0/lib
asterisk, star, splat, hang, freeze, operator
The LSP allow us to send an autocomplete with textEdit
and additionalTextEdits
fields. This client seems to ignore those fields and use only the label for autocompletion.
Awesome plugin!
Do you have a suggestion of how to include regular keyword completions as a source?
When writing a regular text document it's nice to be able to set complete+=kspell
and get dictionary word suggestions from pressing <C-n>
or <C-p>
.
First of all, thank you for an amazing completion plugin, it's truly awesome!
I have a small issue after upgrading and enabling smart completion. Without smart completion enabled, when completion menu popups, you don't select any item and press <Cr>
- it would close the completion menu. However, with smart completion enabled, after you press <Cr>
it just reopens completion menu, so you need to manually close it some other way (e.g. press <Esc>
).
My vimrc:
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-buffer.vim'
Plug 'prabirshrestha/asyncomplete-file.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim' " depends: vim-lsp
Plug 'prabirshrestha/vim-lsp' " depends: async.vim
let g:asyncomplete_remove_duplicates = 1
let g:asyncomplete_smart_completion = 1
function! asyncomplete_sources() abort
call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
\ 'name': 'buffer',
\ 'whitelist': ['*'],
\ 'completor': function('asyncomplete#sources#buffer#completor'),
\ }))
call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
\ 'name': 'file',
\ 'whitelist': ['*'],
\ 'completor': function('asyncomplete#sources#file#completor')
\ }))
endfunction
autocmd User asyncomplete_setup call asyncomplete_sources()
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
@prabirshrestha Thanks for your project, and I just use this projecjt in spacevim, but sometimes I found the cursor jump to some where when complete, can you check this issue?
LSP does not work for me like jedi-vim
does. In fact, it seems that it does not work, so I am trying to have jedi
again.
jedi
is synchronous for now, and I have tried to follow what you have provided in synchronous example, but the omnifunc that jedi-vim
points does not seem to work for me. Do you have any hint?asnycomplete
?Nice plugin. Thanks in advance :)
Not every guy get used to use 'noselect' while completing. Is it proper to provide a switch for that?
It seems asyncomplete-omni.vim
issue but hitting any character in insert mode at |
move cursor at 1,1
.
It occurs when the filename is test.vue
but test.html
.
Btw, No message is produced.
<template>
<div>
<span class="|">
</div>
</template>
" vim -u ~/.vim/vimrc.min
if has('vim_starting')
set nocompatible
execute 'set runtimepath^=~/.cache/dein/repos/github.com/prabirshrestha/async.vim'
execute 'set runtimepath^=~/.cache/dein/repos/github.com/prabirshrestha/asyncomplete.vim'
execute 'set runtimepath^=~/.cache/dein/repos/github.com/prabirshrestha/asyncomplete-omni.vim'
endif
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
\ 'name': 'omni',
\ 'whitelist': ['*'],
\ 'blacklist': ['c', 'cpp', 'html'],
\ 'completor': function('asyncomplete#sources#omni#completor')
\ }))
filetype plugin indent on
syntax on
It would nice to have a source which completes filesystem paths.
It's even better if such source could complete paths relative to the current buffer rather then cwd
(this is how Vim's built-in fs path completion works I believe).
It appears that the server_info->[...
syntax used for the RLS and clangd
servers is not valid in NeoVim 0.1.7 (the current Debian stable version). The syntax error is hidden from the user except via the :messages
command.
Updating to NeoVim 0.2.0, from Debian testing fixed the issue and made RLS integration work properly.
I do not see any mention of the NeoVim version requirements in the README.md
.
It seems one of the latest commit broke the plugin. no matter what I type, the complete menu opens with the same list of completions. even when I'm typing spaces (see images below)
I'm using neovim compiled with brew install --HEAD nvim
NVIM v0.2.3-715-g1d5eec2c6
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20180305-87677-1emzc9v/build/config -I/tmp/neovim-20180305-87677-1emzc9v/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include -I/tmp/neovim-20180305-87677-1emzc9v/build/src/nvim/auto -I/tmp/neovim-20180305-87677-1emzc9v/build/include
Compilato da [email protected]
Features: +acl +iconv +jemalloc +tui
I'm aware of prabirshrestha/vim-lsp
& prabirshrestha/asyncomplete-lsp.vim
, but I'm happy with LanguageClient-neovim
& trying to migrate from nvim-completion-manager
without too many changes right now. So if I can get this to work with asyncomplete
it will be great! Maybe in the future I'll look into prabirshrestha/vim-lsp
& prabirshrestha/asyncomplete-lsp.vim
or even hopefully this will land in neovim neovim/neovim#6856
So my question is since LanguageClient-neovim
has an omni function LanguageClient#complete
, how can I use it with asyncomplete
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.