tree-sitter / tree-sitter-python

Python grammar for tree-sitter
MIT License
360 stars 132 forks source link

bug: TSHighlightCapturesUnderCursor empty #269

Closed EdmundsEcho closed 2 months ago

EdmundsEcho commented 2 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

When I put the mouse over a parameter, I get "No highlight groups found."

def process_matrix(project_id, jid, matrix_request, derived_fields, app):

The tree playground generates the expected syntax tree (I see function, identifier, parameters etc...). This suggests the parser is operating as expected.

However, there are no groups under the cursor. This is in contrast to other languages thus suggesting a python specific parsing issue.

More generally, any guidance on how to troubleshoot this would be greatly appreciated.

Thank you!

Steps To Reproduce/Bad Parse Tree

Put the mouse over a parameter Call :TSHighlightCapturesUnderCursor

Expected Behavior/Parse Tree

Tree-sitter function_definition identifier parameters

Repro

# Example code that causes the issue
def process_matrix(project_id, jid, matrix_request, derived_fields, app):
amaanq commented 2 months ago

this is the parser repo, not the repo that has the implementation of your highlighting tool (nvim-treesitter)

EdmundsEcho commented 2 months ago

We can close this.

Despite believing I configured treesitter to enabled highlighting, clearly it was not so.

        highlight = {
            enable = true,
            additional_vim_regex_highlighting = false,
        },

When I call :TSEnable highlight, I get the Treesitter entry in the :Inspect message as I would expect (and the highlighting works accordingly).