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

C++ bracket mistmatch with literal character #342

Open
yangrq1018 opened this issue Mar 20, 2024 · 0 comments
Open

C++ bracket mistmatch with literal character #342

yangrq1018 opened this issue Mar 20, 2024 · 0 comments
Labels

Comments

@yangrq1018
Copy link

Explain the issue

void foo() { // this bracket
  int a = 3;
  if (a == '}') { // matches the literal '}' here
  }
}

void bar() {
  char *b = "hello";
  if (b == "}") {
  }
}

In this example, in the first function the brackets enclosing the function is mismatched with a literal '}'.
In the second function I confirm that only character '{' is matched, strings like "{" are not.

  1. What vim version are you using? If using neovim, Are you using
    tree-sitter or classic matching?
    NVIM v0.10.0-dev-2063+ga767c046f
    I have treesitter integration by setting
require("nvim-treesitter.configs").setup {
  matchup = {
    enable = true,
  },
}

But I can confirm that with or without TS integrated the bug is the same.
2. Steps to reproduce
Simply create a C/C++ header or source file and paste in the code above. The wrong pair of brackets are highlighted.
4. Expected behavior
String or character literals should not be mismatched.
6. Observed behavior

@yangrq1018 yangrq1018 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