Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

TSNodeUnderCursor's popup has a weird red highlighed underline char under the Node field #116

Open
unphased opened this issue Feb 9, 2023 · 2 comments

Comments

@unphased
Copy link

unphased commented Feb 9, 2023

Describe the highlighting problem

image

I was also able to get this by calling :TSHighlightCapturesUnderCursor with my cursor on top of the red underline char. Notice another red underline char is also highlighted red in the ensuing popup.

image

Example snippet that causes the problem

I think it's just some kind of syntax that is marking all _ chars in a red bgcolor. Not sure it's a TS problem specifically. But dunno where else to report this.

Tree-sitter parsing result

N/A, doesn't work in this popup. I tried to look up filetype in the popup and it says empty.

Example screenshot

included above, sorry

Expected behavior

no unsightly red underscore char?

Output of :checkhealth nvim-treesitter

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

Installation ~
- OK `tree-sitter` found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v16.19.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 14.0.0 (clang-1400.0.29.202)
- 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 = "21.6.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 21.6.0: Sun Nov  6 23:31:13 PST 2022; root:xnu-8020.240.14~1/RELEASE_ARM64_T6000"
} ~

Parser/Features         H L F I J
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - json                ✓ ✓ ✓ ✓ .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - help                ✓ . . . ✓
  - yaml                ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓

  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`

```text
NVIM v0.9.0-dev-869+g964ae205a-dirty
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by slu@Stevens-MacBook-Pro.local

Features: +acl +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/HEAD-964ae20/share/nvim"

Run :checkhealth for more info

Additional context

No response

@clason
Copy link
Contributor

clason commented Feb 9, 2023

Use vim.treesitter.get_node_at_cursor() instead; this function is obsolete and will be removed.

@unphased
Copy link
Author

unphased commented Feb 12, 2023

I see that I can get a string representation of the Node using that lua function (and that I can get the values of the rest of the table with vim.treesitter.get_captures_at_cursor()), which is definitely cool for deep scripting of treesitter functionality, but let's say I just want to make a bind so I can keep using that little popup behavior that :TSNodeUnderCursor gives. Could you point me at whatever code or config might be causing the syntax highlight there? Is it because of the Markdown language and we'd need to wrap it in a string or something?

On second thought though maybe an even cooler thing I should look into for this instead is to configure TSPlayground output to include more of this cool data.

@theHamsta theHamsta transferred this issue from nvim-treesitter/nvim-treesitter Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants