Giter Club home page Giter Club logo

Comments (7)

lewis6991 avatar lewis6991 commented on May 26, 2024 1

This is fixed now, context is now [[gnu::hot]] int xyz()

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

I think the best option would be to try to rewrite the text of the declaration so that it fits in a single line.

As for the indentation level, it should take the lowest indentation level for all lines of the declaration. So the monstrosity above would appear as:

|<--------- starts at 0
int build_stl_str_hl( win_T *wp, char_u *out, // buffer to write into != NameBuff size_t outlen, ...

But Example.method below:

class Example {
   method(x, y) {
     // code
  }
}

Would appear as:

|-|<---------------- starts at 2
  method(x, y) {

The highlighting code in the first case becomes a bit more complex though.

from nvim-treesitter-context.

willeccles avatar willeccles commented on May 26, 2024

I just found out that once it finds the wrong context, it will then not find the right context. For example:

class X {
public:
  [[gnu::hot]]
  void xyz() {
    if (something) {
    } else {
    }
  }
private:
  void other() {
    // cursor is here
  }
};

In this case, it will give me context relating to the function called "[[gnu::hot]]" and the conditional block within it while I am inside the other() function. It seems to get quite stuck on this sort of thing.

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

I'll try to look at it when I find time. Is this exact code example triggering the issue? Can you provide a screenshot? If possible in a new issue, yours is a bug, this is a feature request.

from nvim-treesitter-context.

willeccles avatar willeccles commented on May 26, 2024

I can't provide a screenshot as the code in question is company property, but I will see if I can't recreate this issue with a small snippet and post a screenshot in a new issue.

from nvim-treesitter-context.

willeccles avatar willeccles commented on May 26, 2024

Actually, I think this is related to the original issue and is not a bug. I may have been incorrectly reading the context before or had broken code (quite likely) without realizing it so that the parser was getting confused. However, similarly to the original issue, in this case:

[[gnu::hot]]
int xyz() {
  // cursor is here
}

The context will say that I am inside a function called [[gnu::hot]], just like the int in the original example. I can't seem to reproduce the issue I mentioned before, even on the exact same file, so I am willing to say I probably misinterpreted the context I was reading.

from nvim-treesitter-context.

romgrk avatar romgrk commented on May 26, 2024

Ok cool, so yeah it's the same issue then. I'll try to work on this when I have some time.

from nvim-treesitter-context.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.