atom / language-c

C support in Atom
Other
118 stars 152 forks source link

namespace marker "::" breaks bracket highlights when after "operator" with a return stament containing more than one token #344

Open SoAsEr opened 4 years ago

SoAsEr commented 4 years ago

if I type

class test{
  operator namespace::type() const{
    return a+b;
  }
};

then the bracket after the return statement is parsed as belonging to test{ and "return" is not highlighted if I only have one token in the return statement, like this:

class test{
  operator namespace::type() const{
    return a;
  }
};

then the close bracket is parsed correctly, but "return" is still not highlighted Removing the namespace:

class test{
  operator type() const{
    return a+b;
  }
};

fixes both issues

The incorrect parsing of this bracket causes the rest of the file to be incorrectly parsed as well.

This might be related to https://github.com/atom/language-c/issues/260.

lkashef commented 4 years ago

Hey @SoAsEr, thanks for the report!

Please use the template to help us address your report more efficiently.

Also it would be better to open two different issues if you think that the two problems you reported are not related.

Could you also confirm if you are using tree-sitter or TextMate?

SoAsEr commented 4 years ago

It is the tree sitter parser that is the issue. When I disable tree sitter in settings, the issue goes away.

Also, I would be surprised if the issues were seperate, they look very connected to me