From 4c5dfe3ea5fa704efe6b22a24bf4ee187518c6a1 Mon Sep 17 00:00:00 2001 From: baabelfish Date: Sun, 31 Jan 2016 22:57:43 +0200 Subject: [PATCH] WIP --- README.md | 20 +++++++++++++++++--- autoload/features/definition.vim | 2 +- autoload/features/info.vim | 1 - autoload/features/usages.vim | 1 - autoload/suggest.vim | 19 ++++++++++++++++--- ftdetect/nim.vim | 7 ++++++- 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2f0c4f0..ee2bc84 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nim support for Neovim # TODO -- [ ] Add global options for user +- [x] Add global options for user - [ ] Doc - [ ] Bindings - [ ] Options @@ -34,6 +34,7 @@ Nim support for Neovim - [x] NimRenameSymbol - [ ] NimRenameSymbolProject - [ ] IDE features + - [ ] Parse proc parameter types for parameter completion - [ ] Auto complete modules - [ ] Outline with unite - [ ] Outline with a proper tagbar @@ -43,13 +44,26 @@ Nim support for Neovim - [ ] REPL interaction - [ ] Add tests - [x] CI integration - - [ ] Test nimsuggest for surprises + - [x] Test nimsuggest for surprises - [ ] Unit tests + - [ ] Suggest module + - [ ] Async + - [ ] Sync + - [ ] Integration tests + - [ ] NimDefinition + - [ ] NimOutline + - [ ] NimInfo + - [ ] NimUsages + - [ ] NimUsagesProject + - [ ] NimRenameSymbol + - [ ] NimRenameSymbolProject + # TASKS -- [ ] Sync version communicating with nimsuggest +- [x] Sync version communicating with nimsuggest - [ ] Test the user's versions - [ ] Add roadmap + # BUGS - [ ] Not all lines are read from stdin for some reason with job-control diff --git a/autoload/features/definition.vim b/autoload/features/definition.vim index 02b7f66..a529a26 100644 --- a/autoload/features/definition.vim +++ b/autoload/features/definition.vim @@ -18,6 +18,6 @@ endfunction function! features#definition#run() - call util#StartQuery() call suggest#New("def", 0, s:DefinitionImpl) endfunction + diff --git a/autoload/features/info.vim b/autoload/features/info.vim index 78323bb..09434f8 100644 --- a/autoload/features/info.vim +++ b/autoload/features/info.vim @@ -67,6 +67,5 @@ endfunction function! features#info#run() - call util#StartQuery() call suggest#New("def", 0, s:InfoImpl) endfunction diff --git a/autoload/features/usages.vim b/autoload/features/usages.vim index 7ec20bb..c955bc5 100644 --- a/autoload/features/usages.vim +++ b/autoload/features/usages.vim @@ -51,7 +51,6 @@ function! s:UsagesDefinitionImpl.run(data) endfunction function! features#usages#run(findInProject) - call util#StartQuery() cclose call setqflist([]) let s:findInProject = a:findInProject diff --git a/autoload/suggest.vim b/autoload/suggest.vim index 42f3b61..b18a497 100644 --- a/autoload/suggest.vim +++ b/autoload/suggest.vim @@ -22,7 +22,8 @@ function! s:NimSuggest.on_exit() if len(self.lines) > 0 call self.handler.run(self) else - echo "" + " Clear cli + echo "" endif endfunction @@ -38,8 +39,20 @@ function! suggest#NewKnown(command, useV2, file, line, col, handler) " call writefile(getline(1, '$'), result.tempfile) " endif " let nimcom = completion . " " . file . (a:useTempFile ? (";" . result.tempfile) : "") . ":" . line . ":" . col - let result.job = jobstart([g:nvim_nim_exec_nimsuggest, (a:useV2 ? '--v2' : ''), '--stdin', result.file], result) - call jobsend(result.job, a:command . " " . result.file . ":" . result.line . ":" . result.col . "\nquit\n") + + let jobcmd = [g:nvim_nim_exec_nimsuggest, (a:useV2 ? '--v2' : ''), '--stdin', result.file] + let jobcmdstr = g:nvim_nim_exec_nimsuggest . " " . (a:useV2 ? '--v2' : '') . " " . '--stdin' . " " . result.file + let jobstdin = a:command . " " . result.file . ":" . result.line . ":" . result.col + + if !g:nvim_nim_enable_async || !has("nvim") + let fullcmd = 'echo -e ' . shellescape(jobstdin, 1) . '|' . jobcmdstr + let result.lines = split(system(fullcmd), "\n")[4:-2] + call a:handler.run(result) + else + call util#StartQuery() + let result.job = jobstart([g:nvim_nim_exec_nimsuggest, (a:useV2 ? '--v2' : ''), '--stdin', result.file], result) + call jobsend(result.job, jobcmd) + endif return result endfunction diff --git a/ftdetect/nim.vim b/ftdetect/nim.vim index 71145d5..eb00eef 100644 --- a/ftdetect/nim.vim +++ b/ftdetect/nim.vim @@ -6,4 +6,9 @@ let s:loaded = 1 au BufNewFile,BufRead *.nim set filetype=nim au BufNewFile,BufRead *.nims set filetype=nims -let g:nvim_nim_enable_highlighter = 0 +let g:nvim_nim_enable_highlighter = 0 +let g:nvim_nim_enable_async = 0 +let g:nvim_nim_highlight_builtin = 1 +let g:nvim_nim_highlight_use_unite = 0 +let g:nvim_nim_autocomplete = "omni" " omni, deoplete, ycm +let g:nvim_nim_outline = "quickfix" " quickfix, outline