c0r73x / neotags.nvim

Tag highlight in neovim
MIT License
122 stars 9 forks source link

tagfiles() return an empty array #32

Closed d4em0n closed 4 years ago

d4em0n commented 6 years ago

Neotags generate tags automatically and set tag file into tags variable. but when i echo tagfiles() it's return an empty array (using set tags? it's return tags=./tags;,tags,/tmp/nvim9khncX/75). Using command like :tag tagname neovim says No tags file.

Is i must generate ctags manually or using other plugin for generate ctags ?. thanks before.

c0r73x commented 6 years ago

You can use other plugins to generate tags but neotags should be able to do it as well.

d4em0n commented 6 years ago

I'am using vim-tags right now. but i want to know how to using neotags to fix this problem. thanks for your reply

roflcopter4 commented 6 years ago

There are a few possible problems I could think of here. Impossible to say which exactly without a bit more information.

  1. Is neotags actually running correctly? If there is a problem in the plugin then it will crash and not create the temporary file. Try setting let g:neotags_verbose = 1 in your init.vim and see if the diagnostic messages look sane. If there's an error it ought to show up (warning: by "verbose" I really do mean verbose, there are lots of diagnostics).
  2. This is related to problem 1: do you have Universal ctags installed? Exuberant ctags will not work with neotags.
  3. What type of file are you looking at when you run echo tagfiles()? Not all filetypes are currently supported, and no tagfile is generated for unsupported types. More types can be added if the need arises and ctags supports them.
  4. If none of the above helps, try looking at the temporary file that set tags? returned. Does the file actually exist? Is it empty?

Let me know if any of these suggestions help. If not, I'll have to look into this a bit more because I have never seen this problem before.

d4em0n commented 6 years ago

I'm using Universal ctags. This is messages from neotags_verbose

Using compression type gzip with ext .gz
Using tags file /home/ramdhan/.vim_tags/__home__ramdhan__csm_bot.tags.gz
run_ctags -> 1
updating vim-tagfile
358: (0.0789s) END => Finished updating file list
=============== Executing Python code ===============
600: (0.0750s) END => Finished _parse, found 115 items.
Neotags: Elapsed time for reading file: 0.082886s
Finished finding tags, found 115 items.
Highlighting for buffer 1
329: (0.0249s) END => Updated highlight for _Neotags_c_g_cEnumTypeTag
Highlighting for buffer 1
329: (0.0199s) END => Updated highlight for _Neotags_c_u_cUnionTag
Highlighting for buffer 1
329: (0.0861s) END => Updated highlight for _Neotags_c_e_cEnumTag
Highlighting for buffer 1
329: (0.0224s) END => Updated highlight for _Neotags_c_s_cStructTag
Highlighting for buffer 1
329: (0.0142s) END => Updated highlight for _Neotags_c_m_cMemberTag
Highlighting for buffer 1
329: (0.0158s) END => Updated highlight for _Neotags_c_f_cFunctionTag
Highlighting for buffer 1
329: (0.0087s) END => Updated highlight for _Neotags_c_d_cPreProcTag
Highlighting for buffer 1
329: (0.0086s) END => Updated highlight for _Neotags_c_t_cTypeTag
Highlighting for buffer 1
329: (0.0087s) END => Updated highlight for _Neotags_c_v_cGlobalVar
238: (0.8546s) END => applied syntax for c
Finished all => (1.0103s)

using set tags?, it's return tags=./tags;,tags,/tmp/nvimiwsrO9/73. file /tmp/nvimiwsrO9/73 is exist like commonly ctags file.

file /tmp/nvimiwsrO9/73
/tmp/nvimiwsrO9/73: Exuberant Ctags tag file, ASCII text

But, when i run echo tagfiles() it's return empty. Syntax highlighting works like expectedly

d4em0n commented 6 years ago

it seems my neovim can't load ctags from /tmp, when i move file /tmp/nvimiwsr09/73 to /tmp/73 and i run set tags+=/tmp/73 neovim still not loaded tags (still return an empty array when i run echo tagfiles()), but when i move /tmp/nvimiwsr09/73 to /home/aaa/73 and i run set tags+=/home/aaa/73 it's works, echo tagfiles() now returns ['/home/aaa/73'] and i can run command like :tag tagname

roflcopter4 commented 6 years ago

That sounds like it must be some kind of permissions problem. That's pretty odd considering that files in /tmp can be owned by anyone, and temporary files are always owned by their creator, which should be you. What are the permissions of the file in /tmp/nvimXXXXXX and what are they after you move it to your home directory?

If for some reason neovim is creating a directory in /tmp that you don't own, then that might be the problem. I had assumed that the user would always own that directory and so simply created a normal file in it to store the tags for neovim to read. I don't know why neovim wouldn't be able to read it though. If necessary I could change back to using ordinary temporary files rather than ones inside of the Neovim instance's temp directory.

d4em0n commented 6 years ago

This is premission of folder /tmp/nvimXXXXXX.

drwx------ 2 ramdhan ramdhan 4096 Jun 27 18:51 nvimm7RCgu

This is the content of folder /tmp/nvimm7RCgu.

srwxr-xr-x 1 ramdhan ramdhan     0 Jun 27 18:51 0
-rw-r--r-- 1 ramdhan ramdhan 44424 Jun 27 18:51 43

Is it possible to change /tmp directory to ~/.local/tmp for example ?

d4em0n commented 4 years ago

it's strange my neovim can't read /tmp. but if i run using nvim -u NORC it's works. Screenshot_20200116_111413

d4em0n commented 4 years ago

it's seems this is not neotags bug, problem still occured even neotags disabled. but i don't know how to fix this, i have a lot of plugin that maybe caused this.

d4em0n commented 4 years ago

fixed, the problem is "/tmp/" is set to wildignore