Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: highlight broken in some specific scenario #286

Open
2 tasks done
Ask-786 opened this issue Mar 20, 2024 · 0 comments
Open
2 tasks done

bug: highlight broken in some specific scenario #286

Ask-786 opened this issue Mar 20, 2024 · 0 comments
Labels

Comments

@Ask-786
Copy link

Ask-786 commented Mar 20, 2024

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-typescript

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

No response

Describe the bug

Whenever the following line occured inside a class, methods under the line are getting inconsistent highlight. and shows error in playground.

image

selectedColor: (typeof this.colors)[number] = this.colors[0];

(subscript_expression) ; [90:26 - 45]
 object: (member_expression) ; [90:26 - 36]
  object: (this) ; [90:26 - 29]
  property: (property_identifier) ; [90:31 - 36]
 (ERROR) ; [90:37 - 37]
 index: (identifier) ; [90:39 - 44]
(ERROR) ; [90:49 - 63]

Steps To Reproduce/Bad Parse Tree

  1. paste the given line in a class having one or more methods after the line.

Expected Behavior/Parse Tree

Syntax highlight should work well when this line occurs.

Repro

@Component({
  selector: "app-add-credit-card",
  standalone: true,
})
export class AddCreditCardComponent implements OnInit, OnDestroy {
  colors = [
    { color: "green", code: "#E5F8F2" },
    { color: "blue", code: "#E9F3FF" },
    { color: "violet", code: "#EDEBFF" },
    { color: "red", code: "#FAEFF5" },
  ] as const;

  selectedColor: (typeof this.colors)[number] = this.colors[0];

  form = new FormGroup({
    nickName: new FormControl("", Validators.required),
    firstName: new FormControl("", Validators.required),
    lastName: new FormControl("", Validators.required),
  });

  constructor() {
    this.renderer = this.rendererFactory.createRenderer(null, null);
  }

  selectColor(color: typeof this.selectedColor) {
    this.selectedColor = color;
  }
}
@Ask-786 Ask-786 added the bug label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant