nvim-treesitter / nvim-treesitter

Nvim Treesitter configurations and abstraction layer
Apache License 2.0
9.98k stars 848 forks source link

Doxygen syntax - embedded parameters like `\p len` aren't highlighted #6725

Open XVilka opened 4 weeks ago

XVilka commented 4 weeks ago

Describe the highlighting problem

Inline function parameters aren't highlighted when using syntax like \p <paramname>

Example snippet that causes the problem

/**
 * \brief Allocates the memory chunk of \p len size and opens it as a file
 * \param core RzCore instance
 * \param fd File descriptor
 * \param perms Permission \s RZ_PERM_R
 */

Tree-sitter parsing result

(translation_unit ; [0, 0] - [6, 0]
  (comment ; [0, 0] - [5, 3]
    (document ; [0, 0] - [5, 3]
      (brief_header ; [1, 3] - [1, 74]
        (tag_name) ; [1, 3] - [1, 9]
        (brief_description)) ; [1, 10] - [1, 74]
      (tag ; [2, 3] - [2, 30]
        (tag_name) ; [2, 3] - [2, 9]
        (identifier) ; [2, 10] - [2, 14]
        (description)) ; [2, 15] - [2, 30]
      (tag ; [3, 3] - [3, 28]
        (tag_name) ; [3, 3] - [3, 9]
        (identifier) ; [3, 10] - [3, 12]
        (description)) ; [3, 13] - [3, 28]
      (tag ; [4, 3] - [4, 27]
        (tag_name) ; [4, 3] - [4, 9]
        (identifier) ; [4, 10] - [4, 15]
        (description)) ; [4, 16] - [4, 27]
      (tag ; [4, 27] - [4, 39]
        (tag_name) ; [4, 27] - [4, 29]
        (description))))) ; [4, 30] - [4, 39]

Example screenshot

Screenshot 2024-06-04 at 12 13 53 AM

Expected behavior

Highlight those parameters properly

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.22.6 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v22.2.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: Apple clang version 15.0.0 (clang-1500.3.9.4)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "arm64",
  release = "23.5.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - bibtex              ✓ . ✓ ✓ .
  - c                   ✓ ✓ ✓ ✓ ✓
  - cmake               ✓ . ✓ ✓ .
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - diff                ✓ . . . .
  - dockerfile          ✓ . . . ✓
  - doxygen             ✓ . . ✓ ✓
  - git_config          ✓ . ✓ . ✓
  - git_rebase          ✓ . . . ✓
  - gitattributes       ✓ ✓ . . ✓
  - gitcommit           ✓ . . . ✓
  - gitignore           ✓ . . . .
  - go                  ✓ ✓ ✓ ✓ ✓
  - haskell             ✓ ✓ ✓ . ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - kconfig             ✓ ✓ ✓ ✓ ✓
  - ledger              ✓ . ✓ ✓ ✓
  - llvm                ✓ . . . .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - make                ✓ . ✓ . ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - meson               ✓ . ✓ ✓ ✓
  - muttrc              ✓ . . . ✓
  - ninja               ✓ . ✓ ✓ .
  - ocaml               ✓ ✓ ✓ ✓ ✓
  - ocaml_interface     ✓ ✓ ✓ ✓ ✓
  - org                 ✓ . ✓ . ✓
  - perl                ✓ . ✓ . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - readline            ✓ . ✓ ✓ ✓
  - rst                 ✓ ✓ . . ✓
  - ruby                ✓ ✓ ✓ ✓ ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - scheme              ✓ . ✓ . ✓
  - ssh_config          ✓ ✓ ✓ ✓ ✓
  - swift               ✓ ✓ . ✓ .
  - tablegen            ✓ ✓ ✓ ✓ ✓
  - tmux                ✓ . . . ✓
  - toml                ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - xml                 ✓ ✓ ✓ ✓ ✓
  - yaml                ✓ ✓ ✓ ✓ ✓
  - zig                 ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

Output of nvim --version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478
Run "nvim -V1 -v" for more info

Additional context

No response

ribru17 commented 3 weeks ago

I think this issue should be raised on the parser's side, doesn't look like there are any nodes that could be queried to highlight such a thing right now

XVilka commented 1 week ago

Only one issue left before this can be closed: https://github.com/tree-sitter-grammars/tree-sitter-doxygen/issues/13