shougo / neoinclude.vim Goto Github PK
View Code? Open in Web Editor NEWInclude completion framework for neocomplete/deoplete
License: Other
Include completion framework for neocomplete/deoplete
License: Other
vlog ../Src/remote_update/
, can't complete path
vlog "../Src/remote_update/
, can complete path
According to w3:
Partial URLs are interpreted relative to the source of the style sheet, not relative to the document.
Source: https://www.w3.org/TR/REC-CSS1/#url
So if I have a css file in css/ and images in img/, proper completion result must be:
background-image: url(../img/bg.png);
Windows8.1、Kaoriya-vim 64ビットの最新バージョンにて、
以下の設定の場合、phpのインクルード補完のキャッシュが
生成されません。
動的、またはNeoCompleteIncludeMakeCacheを手動で実行しても、
結果は同様となります。
■設定
" -----------------------------------------------------------
" neoinclude
let g:neocomplete#delimiter_patterns = {'php': ['->', '::', '']}
let g:neoinclude#exts = {'php': ['php', 'inc', 'tpl']}
let g:neoinclude#max_processes = 5
let g:neoinclude#delimiters = '/'
let g:neoinclude#paths = "d:/xampp/htdocs/test_goutte/vendor/"
↑
言語はPHP。
vendor以下にある、サードパーティライブラリのメソッドを
インクルード補完の対象として取得することを目的としております。
このような場合、どのようにすればキャッシュを生成できるもので
しょうか。
maybe I'm doing something wrong (Although I have no way to know at the moment because the "EXAMPLES" portion of the documentation is kind of... blank.)
As far as I've surmised, what I'm meant to do is:
let g:neoinclude#paths = {'c++' : '/path/to/include/directory'}
which I have done. I'm not getting completions for that library however. Interestingly enough the same path given to syntastic seems to be fine. Is there something else I'm meant to do to get this working? If there is, would it be possible to update neoinclude.txt with such an example for those of us less adept with vim?
When the include source was part of neocomplete I could use the command :NeoCompleteIncludeMakeCache
to make cache. How do I this now? Thanks in advance.
I want to be able to use the following mapping again:
nnoremap <silent> <Leader>te :NeoCompleteIncludeMakeCache<CR>:Unite
\ tag/include<CR>
I managed to get the file include working with a pattern but obviously that makes no sense with go. Its also only recognizes the single line version of the import statement, e.g.
import "io/ioutil"
But it can't recognize
import (
"io/ioutil"
)
I can add a vim function or even an external program to get a list of all the import paths but how would I plug that into this plugin?
Consider the following minimal vimrc:
set nocompatible
let $ONEDRIVE_HOME = expand('C:/OD/Users/Pedro')
let $DOTVIM = expand('$ONEDRIVE_HOME/vimfiles')
set runtimepath+=$DOTVIM/bundle/unite
set runtimepath+=$DOTVIM/bundle/neoinclude
set runtimepath+=$DOTVIM/bundle/unite-tag
set runtimepath+=$DOTVIM/bundle/vimproc
set runtimepath+=$DOTVIM/bundle/tagbar/
filetype plugin indent on
nnoremap <silent> ,te :NeoIncludeMakeCache<CR>:sleep 3m<CR>:Unite
\ tag/include<CR>
Now open the Gvim
, edit that vimrc_min
file and press ,te
. Candidates will be correctly displayed but for each candidate there is no information of its kind
. On the other hand the tagbar
plugin shows this useful info (whether a candidate is variable
or a map
or a function
, etc). So I was wondering if it is possible to show the kind
of each candidate in the unite buffer and to allow to filter by kind
. I think this might be a nice feature to have.
Thanks in advance!
Hello,
I saw your comment on the deoplete.nvim thread https://github.com/Shougo/deoplete.nvim/issues/300
I tried multiple ways to make this work but frankly, I'm quite unsure of how to use the options in this plugin cut off the extension when importing '.js' files.
I tried:
if !exists('g:neoinclude#reverse_exprs')
let g:neoinclude#reverse_exprs = {}
endif
let g:neoinclude#reverse_exprs.js =
\ 'fnamemodify(substitute(v:fname, "\.js$", "", ""), ":r")'
I also tried setting the option directly:
set includeexpr= 'fnamemodify(substitutev:fname,'\\.js', '', ''))'
But these were just shots in the dark. I would appreciate your guidance in this.
The tag completion source is only initialized when the on_event
of deoplete source is called. So if I added some new include files, I must save the file to get completion from those files. This is a bit annoying.
Even worse, when I first open a file (e.g. nvim foo.c
), I can't get the neoinclude completions, I must first enter insert mode then exit (to activate deoplete & neoinclude), and then save the file (with no modifications yet) to make the neoinclude completions work, this is very strange. I would expect I can get neoinclude completions without any special operation, instead of activating (initializing) it manually.
Maybe this issue should be resolved by patching deoplete code (I'm not sure), but I think it's better to report it here ^_^
Consider the following R
file foo.R
:
x <- 1
foo <- function () {
y <- 2
return(y)
}
print(x)
print(foo())
Now in your .ctags
file add:
--langdef=R
--langmap=R:.R.r
--regex-R=/^[ \t]*"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*<-[ \t]function[ \t]*\(/\1/f,Functions/
--regex-R=/^"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*<-[ \t][^\(]+$/\1/g,Global_Variables/
--regex-R=/[ \t]"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*<-[ \t][^\(]+$/\1/v,Function_Variables/
Finally use the following minimal vimrc:
set nocompatible
let $ONEDRIVE_HOME = expand('C:/OD/Users/Pedro')
let $DOTVIM = expand('$ONEDRIVE_HOME/vimfiles')
set runtimepath+=$DOTVIM/bundle/unite
set runtimepath+=$DOTVIM/bundle/neoinclude
set runtimepath+=$DOTVIM/bundle/unite-tag
set runtimepath+=$DOTVIM/bundle/vimproc
filetype plugin indent on
nnoremap <silent> ,te :NeoIncludeMakeCache<CR>:sleep 3m<CR>:Unite
\ tag/include<CR>
Open Gvim
and edit the foo.R
file. Press ,te
and you will see that no candidates will be shown. However if you write the .ctags
file like this --langmap=R:.r.R
candidates are shown.
So for some reason neoinclude is not correctly parsing the --langmap
flag. It seem to only take into account the last file extension in --langmap
.
I found this through coc.nvim, it links to lots of interesting projects, so I like to check them out even if I don't recognise the name. However I landed here and couldn't tell what it was for.
or maybe someone can tell me how to add $(npm config get prefix)/lib/node_modules
and $(npm prefix)/node_modules
as paths.
Consider the following minimal vimrc:
set nocompatible
let $ONEDRIVE_HOME = expand('C:/OD/Users/Pedro')
let $DOTVIM = expand('$ONEDRIVE_HOME/vimfiles')
set runtimepath+=$DOTVIM/bundle/unite
set runtimepath+=$DOTVIM/bundle/neocomplete
set runtimepath+=$DOTVIM/bundle/neoinclude
set runtimepath+=$DOTVIM/bundle/unite-tag
set runtimepath+=$DOTVIM/bundle/vimproc
filetype plugin indent on
let g:neocomplete#enable_at_startup = 1
nnoremap <silent> ,te :NeoIncludeMakeCache<CR>:Unite
\ tag/include<CR>
As in the GIF, open Gvim, edit the vimrc_min
file and press ,te
. The unite buffer will display the candidates from the tag source. Now close the unite buffer with q
and once again press ,te
. The unite buffer is now empty. I expect for it to show the candidates.
As neoinclude user I'd like to add additional paths to g:neoinclude#paths. Unfortunately, I didn't find an API call to do it. Is it possible to add such API call or include an example into the documentation.
Suppose I have the following m
files in the same directory:
i) bar.m
:
function y = bar(x)
y = x + 2;
end
ii) foo.m
disp(bar(2))
(i.e from the file foo.m
I'm calling a function bar()
defined in the file bar.m
).
Now, using universal-ctags If run !ctags -R *.m
from the file foo.m
, the following tag file is generated:
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
!_TAG_PROGRAM_VERSION Development //
bar bar.m /^function y = bar(x)$/;" f
which then allows me to place the cursor in bar(2)
(in foo.m
) and press C-]
to jump to the bar()
function definition in bar.m
.
I'm trying to replicate this behavior using neoinclude
and unite-tag
. However when I use the mapping (without running !ctags -R *.m
):
nnoremap <buffer> <silent> <C-]> :NeoIncludeMakeCache<CR>
\ :UniteWithCursorWord -immediately -sync tag/include<CR>
nothing happens.
I think I found the problem: if from foo.m
I run :NeoIncludeMakeCache
and then :Unite tag/include
I get an empty buffer.
So this means that no tags are generated for bar.m
. However I expect neoinclude to generate tags for bar.m
since according to the docs:
g:neoinclude#paths
It is the variable to enumerate path of the include file
every file type. When there is not it, 'path' is used.
Refer to 'path' for the description form. It is the
dictionary of the character string that assumed file type a
key.
and I run set path?
I get path=.,,
which means that the current directory is included (however echo g:neoinclude#_paths
returns {}
.
Btw, here is a minimal vimrc and Gif showing the problem:
set nocompatible
let $ONEDRIVE_HOME = expand('C:/OD/Users/Pedro')
let $DOTVIM = expand('$ONEDRIVE_HOME/vimfiles')
set runtimepath+=$DOTVIM/bundle/unite
set runtimepath+=$DOTVIM/bundle/neoinclude
set runtimepath+=$DOTVIM/bundle/unite-tag
set runtimepath+=$DOTVIM/bundle/vimproc
filetype plugin indent on
This issue was originally opened due to performance issues caused by my own ignorance. There was a legitimate bug in that when using nvim-completion-manager, get_include_files()
was being run all the time, instead of just on #include
directives, which is what PR #30 fixes. The following is the original, misguided report.
I'm using neovim-completion-manager and getting very poor performance when using neoinclude; check out this profile. Specifically:
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
11 9.991828 9.959356 neoinclude#file_include#get_include_files()
...
I'm unsure why, but neoinclude is executing this function no matter what I'm typing in a cpp buffer, even if it's not an #include
directive. For example, when creating the above profile, this is all that I typed into an empty cpp buffer:
int main()
{
return 0;
}
The UI froze several times as I typed this, likely due to get_include_files()
executing. Of course, this makes nvim entirely unusable. Is this normal? Shouldn't neoinclude only be executing when the line matches an #include
directive? Even then the slow-down makes this unusable.
this is more of a feature request/suggestion
i am using neoinclude to perform header file (cpp) path completion, and that's the only thing i really want. i found that ctags is significantly slowing down large cpp file with lots of codes/includes. in my case a file with ~2000 lines of codes will freeze the window for up to 10 seconds. my workaround is to disable ctags
" disable ctags
let g:neoinclude#ctags_command = ""
then everything is fast. since im using vim-gutentags to navigate between declaration/definition and vim-clang to do api completion, I have no problem with using neoinclude w/out ctags support.
from a new user perspective, it would be nice to have an option to explicitly disable ctags. im new to neocomplete, so it took me a while to figure out the root cause of the slowness and come up with the hack above.
Hello.
There is a problem with the current vim ctags arguments. ctags for VimL files does not work properly and causes problems for projects that use neoinclude
(see this issue).
More info follows below.
EDIT: make link name longer for easy clicks.
error caught in async handler 'deoplete_on_event [{'dict__dictionary': '', 'input': '', 'max_abbr_width': 135, 'encoding': 'utf-8', 'delay': 150, 'filetype': 'javascript', 'camelcase': 0, 'sources': [], '
complete_str': '', 'custom': {'_': {}}, 'bufvars': {}, 'ignorecase': 0, 'max_menu_width': 135, 'bufnr': 2, 'start_complete': '\udc80\udcfdR_', 'vars': {'deoplete#max_menu_width': 40, 'deoplete#keyword_pat
terns': {}, 'deoplete#member#prefix_patterns': {}, 'deoplete#sources#ternjs#tern_bin': 'tern', 'deoplete#_context': {}, 'deoplete#enable_refresh_always': 0, 'deoplete#omni#input_patterns': {}, 'deoplete#a
uto_refresh_delay': 50, 'deoplete#omni_patterns': {}, 'deoplete#disable_auto_complete': 0, 'deoplete#_keyword_patterns': {'_': '[a-zA-Z_]\\k*'}, 'deoplete#_channel_id': 8, 'deoplete#omni#functions': {}, '
deoplete#auto_complete_start_length': 2, 'deoplete#delimiters': ['/', '.', '::', ':', '#'], 'deoplete#_omni_patterns': {'xhtml': ['<', '<[^>]*\\s[[:alnum:]-]*'], 'mkd': ['<', '<[^>]*\\s[[:alnum:]-]*'], 'h
tml': ['<', '<[^>]*\\s[[:alnum:]-]*'], 'xml': ['<', '<[^>]*\\s[[:alnum:]-]*'], 'markdown': ['<', '<[^>]*\\s[[:alnum:]-]*']}, 'deoplete#max_abbr_width': 80, 'deoplete#sources': {}, 'deoplete#enable_camel_c
ase': 0, 'deoplete#enable_profile': 0, 'deoplete#enable_smart_case': 0, 'deoplete#ignore_sources': {}, 'deoplete#_rank': {}, 'deoplete#enable_ignore_case': 0, 'deoplete#enable_at_startup': 1, 'deoplete#ma
x_list': 100, 'deoplete#_neovim_python_version': ['0.1.11'], 'deoplete#auto_complete_delay': 150}, 'bufname': 'migrations/20161125154032-add-member-family-fields.js', 'cwd': '/Users/carlitux/Projects/dent
al-server', 'position': [0, 5, 1, 0], 'runtimepath': '/Users/carlitux/.config/nvim,/etc/xdg/nvim,/Users/carlitux/.local/share/nvim/site,/usr/local/share/nvim/site,/Users/carlitux/.cache/dein/repos/github.
com/Shougo/vimproc.vim,/Users/carlitux/.cache/dein/repos/github.com/othree/javascript-libraries-syntax.vim,/Users/carlitux/.cache/dein/repos/github.com/maksimr/vim-jsbeautify,/Users/carlitux/.cache/dein/r
epos/github.com/leshill/vim-json,/Users/carlitux/.cache/dein/repos/github.com/pangloss/vim-javascript,/Users/carlitux/.cache/dein/repos/github.com/moll/vim-node,/Users/carlitux/.cache/dein/repos/github.co
m/editorconfig/editorconfig-vim,/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim,/Users/carlitux/.cache/dein/.cache/init.vim/.dein,/usr/share/nvim/site,/usr/local/Cellar/neovim/HEAD-42736
d6/share/nvim/runtime,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,/Users/carlitux/.local/share/nvim/site/after,/etc/xdg/nvim/after,/Users/carlitux/.config/nvim/after,/Users/carlitux/.confi
g/nvim/bundle/dein.vim/,/Users/carlitux/.cache/dein/.cache/init.vim/.dein/after,/Users/carlitux/.cache/dein/repos/github.com/pangloss/vim-javascript/after,/Users/carlitux/.cache/dein/repos/github.com/othr
ee/javascript-libraries-syntax.vim/after', 'next_input': '', 'filetypes': ['javascript'], 'smartcase': 0, 'same_filetypes': [], 'event': 'BufRead', 'keyword_patterns': '[a-zA-Z_][a-zA-Z@0-9_À-ÿ$]*', 'chan
gedtick': 10, 'rpc': 'deoplete_on_event', 'omni__omnifunc': 'javascriptcomplete#CompleteJS'}]'
Traceback (most recent call last):
File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/__init__.py", line 62, in on_event
self.__deoplete.on_event(context)
File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 380, in on_event
source.on_event(context)
File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/source/tag.py", line 34, in on_event
self.__tagfiles[context['bufnr']] = self.__get_tagfiles(context)
File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/source/tag.py", line 58, in __get_tagfiles
'exists', '*neoinclude#include#get_tag_files') else []
File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 230, in call
return self.request('nvim_call_function', name, args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 131, in request
res = self._session.request(name, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
raise self.error_wrapper(err)
neovim.api.nvim.NvimError: b'Vim(return):E121: Variable sin definir: command'
There are two places where :lcd
is used, and this causes haslocaldir()
to become 1.
I think that :lcd
should only be used if there is local working dir already, and otherwise tcd
/cd
should be used.
Then this also can be skipped if the cwd
is the expected one already.
I am using the following in Neomake:
https://github.com/neomake/neomake/blob/0ec94d39a26dd624e939f774adb161d08d6d193e/autoload/neomake.vim#L1713-L1727
[deoplete] Traceback (most recent call last):
[deoplete] File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 47, in completion_begin
[deoplete] complete_position, candidates = self.gather_candidates(context)
[deoplete] File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 81, in gather_candidates
[deoplete] results = self.gather_results(context)
[deoplete] File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 132, in gather_results
[deoplete] context['candidates'] = source.gather_candidates(context)
[deoplete] File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/sources/tag.py", line 32, in gather_candidates
[deoplete] self.__make_cache(context)
[deoplete] File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/sources/tag.py", line 43, in __make_cache
[deoplete] for filename in self.__get_tagfiles():
[deoplete] File "/Users/carlitux/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/sources/tag.py", line 55, in __get_tagfiles
[deoplete] 'exists', '*neoinclude#include#get_tag_files') else []
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 213, in call
[deoplete] return self.request('vim_call_function', name, args, **kwargs)
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 129, in request
[deoplete] res = self._session.request(name, *args, **kwargs)
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
[deoplete] raise self.error_wrapper(err)
[deoplete] neovim.api.nvim.NvimError: b'Vim(return):E121: Undefined variable: b:node_root'
[deoplete] An error has occurred. Please execute :messages command.
There are several errors with html script tag.
When I start to edit at the cursor_position_1, expepected that the deoplete will be triggered neoinclude source, but there are only omni pattens. Nevertheless, inside of the tag (at the cursor_position_1) I don't find a single omni (although everthing works well if I try to complete manually with )
Test file content:
<script src="{cursor_position_1}"> {cursor_position_2} </script>Neovim config file content:
set runtimepath+=/.vim/bundle/deoplete.nvim//.vim/bundle/neoinclude.vim/
set runtimepath+=
filetype plugin indent on
Compilers provides ability to ask them about system include directory. It would be great to reuse this functionality instead of own heuristic. For example:
clang++ -E -x c++ - -v < /dev/null
....include "..." search starts here:
include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
....
With neoinclude
and deoplete-clangx
, completion stops working after the first time for me.
After investigating what's happening, I noticed the huge amount of arguments deoplete-clangx
was using on the second run.
It's about 550 single -I
parameters and seems to include every single library on my system. This can't be how it's supposed to work, can it? I had to disable this plugin since clangx was basically unusable.
I use mklink to create a lin in windows 7 os. when save a file, I get:
Error detected while processing function <SNR>351_check_buffer[18]..<SNR>351_get_buffer_include_files[18]..neoinclude#util#cd:
line 8:
E472: Command failed
Hello, can I use this tool to develop kernel code?
I want to specify a directory. For example, in kernel/include, all function declarations will be automatically prompted when I use vim.
neoinclude.vim Can you help me achieve this function? How to set it?
Thank you from the bottom of my heart
How can I set this up to complete for things like iostream, iomanip, cmath, etc. in C++?
Specifically referring to these statements:
#include <iostream>
#include <iomanip>
#include <cmath>
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.