tree-sitter / tree-sitter/tree-sitter-cpp

feature: parameter highlighting?

Open
#358 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
453
Forks
185
PR merge metrics
No merged PRs in 30d

Description

Did you check the tree-sitter docs?
Is your feature request related to a problem? Please describe.

Hi, I'm not very knowledgeable about treesitter so please bear with me if this is in wrong place.

I am trying to understand why/how I could get highlighting to work with parameters inside functions.

Here's a simple example:

int a, b;
void foo(int c) {
   auto g = a * c;
}

In this snippet, I would expect c within the function to have variable.parameter (or similar, I do not know the proper language) value.

So I could have all parameters same color in Helix for example.

Describe the solution you'd like

If it's at all possible, give any variable that is a parameter of a function a variable.parameter value, so that it can be colored in highlighters.

Describe alternatives you've considered

Living without it..? :'D

Additional context

Again sorry if I'm in wrong place and being bothersome, I suspect this has come across before too but I could not find any relevant issues, maybe my searching skills fail me.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked tree-sitter parser documentation and the C++ example in the issue; no source file or test is named. Investigate how parameter highlighting is represented for this grammar, then verify that function parameters receive a variable.parameter-like capture and can be colored by a highlighter such as Helix.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.