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

[cpp] Uppercase classnames in return types get confused for macros #251

Open
takamori opened this issue May 1, 2019 · 1 comment
Open

Comments

@takamori
Copy link
Contributor

takamori commented May 1, 2019

Repros with the following code.

class URL;
class URl;

class Test {
  // Bug 1: This URL is highlighted differently
  URL DoSomething() {
    // Bug 2: Smart indentation from newline is broken (2 spaces too many)
    URL url;
    return url;
  }

  // Bug 3: The std:: is highlighted yet more differently (and default
  // indentation is broken
  // Bug 4: Smart indentation _after_ the DoSomething function is broken even
  // worse. (6 spaces too many)
  std::string doFoo(const std::string& a) {
    return absl::StrCat("something long", a);
  }

  // Correct highlighting and indentation after one function call.
  std::string doFoo2(const std::string& a) {
    return absl::StrCat("something long", a);
  }

  // Correct highlighting of types that are not fully UPPERCASE.
  URl DoSomething2() {
    URL url;
    return url;
  }

  // Also correct.
  std::string doFoo3(const std::string& a) {
    return absl::StrCat("something long", a);
  }
  std::string doFoo4(const std::string& a) {
    return absl::StrCat("something long", a);
  }
}
@marijnh
Copy link
Member

marijnh commented May 2, 2019

See the discussion here. It is not possible to reliably distinguish macro uses from other syntactic constructs, so @mtaran-google asked me to highlight upper case shake case identifier as macros. If you'd like this to work differently, feel free to propose an approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants