neovim / tree-sitter-vimdoc

Tree-sitter parser for Vim help files
Apache License 2.0
97 stars 13 forks source link

Argument in some functions is not recognized if not preceded by whitespace #102

Closed clason closed 1 year ago

clason commented 1 year ago

Consider

vim.foo({bar})

Tree:

(block) ; [1:1 - 2:0]
 (line) ; [1:1 - 2:0]
  (word) ; [1:1 - 14]

But

vim.foo( {bar})

Tree:

(block) ; [1:1 - 2:0]
 (line) ; [1:1 - 2:0]
  (word) ; [1:1 - 8]
  (argument) ; [1:10 - 14]
   text: (word) ; [1:11 - 13]
  (word) ; [1:15 - 15]

Needless to say, that affects much of our docs.

Works fine without the dot, though:

nvim_foo({bar})

Tree:

(block) ; [1:1 - 2:0]
 (line) ; [1:1 - 2:0]
  (word) ; [1:1 - 9]
  (argument) ; [1:10 - 14]
   text: (word) ; [1:11 - 13]
  (word) ; [1:15 - 15]

But only for the first argument; if there are more arguments and these are not preceded by whitespace (as is usual), these don't get caught:

nvim_foo({bar},{baz})

Tree:

(block) ; [1:1 - 2:0]
 (line) ; [1:1 - 2:0]
  (word) ; [1:1 - 9]
  (argument) ; [1:10 - 14]
   text: (word) ; [1:11 - 13]
  (word) ; [1:15 - 21]