vimdoc
vimdoc copied to clipboard
[bug] namespace shouldn't be None
❯ vimdoc .
/usr/lib/python3.10/site-packages/vimdoc/block.py:224: DocumentationWarning: Documentation claims optional parameters that function A does not accept.
warnings.warn(
Traceback (most recent call last):
File "/usr/bin/vimdoc", line 5, in <module>
vimdoc.__main__.main()
File "/usr/lib/python3.10/site-packages/vimdoc/__main__.py", line 18, in main
for module in Modules(args.plugin):
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 440, in Modules
module.Close()
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 115, in Close
if self.GetCollection(vimdoc.FUNCTION) and 'functions' not in self.sections:
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 105, in GetCollection
non_default_names = set(x.TagName() for x in collection
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 105, in <genexpr>
non_default_names = set(x.TagName() for x in collection
File "/usr/lib/python3.10/site-packages/vimdoc/block.py", line 259, in TagName
return '{}()'.format(self.FullName())
File "/usr/lib/python3.10/site-packages/vimdoc/block.py", line 248, in FullName
return self.locals.get('namespace', '') + self.LocalName()
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
""
" @section Introduction, intro
" @library
""
" Test
function! Test() abort
echo 1
endfunction
What's the filename? Is this a .vim file in the directory root, not under a subdir like plugin/, autoload/, etc?
❯ tree -L 2
.
├── doc
└── plugin
└── a.vim
❯ vimdoc .
Traceback (most recent call last):
File "/usr/bin/vimdoc", line 5, in <module>
vimdoc.__main__.main()
File "/usr/lib/python3.10/site-packages/vimdoc/__main__.py", line 18, in main
for module in Modules(args.plugin):
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 440, in Modules
module.Close()
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 115, in Close
if self.GetCollection(vimdoc.FUNCTION) and 'functions' not in self.sections:
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 105, in GetCollection
non_default_names = set(x.TagName() for x in collection
File "/usr/lib/python3.10/site-packages/vimdoc/module.py", line 105, in <genexpr>
non_default_names = set(x.TagName() for x in collection
File "/usr/lib/python3.10/site-packages/vimdoc/block.py", line 259, in TagName
return '{}()'.format(self.FullName())
File "/usr/lib/python3.10/site-packages/vimdoc/block.py", line 248, in FullName
return self.locals.get('namespace', '') + self.LocalName()
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Agreed, the error message there sucks and should be fixed. Probably it should just skip that file, maybe with a warning that it's not included in the processing.
I found for autoload/a.vim
❯ tree -L 2
.
└── autoload
└── a.vim
vimdoc . can work. However, for plugin/a.vim, it cannot (as https://github.com/google/vimdoc/issues/119#issuecomment-1244924473). Is it a bug? Why user cannot declare function in plugin/*.vim?