clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
594 stars 97 forks source link

Struct function member tokens colorized as functions for C #549

Closed cursedcrafts closed 8 months ago

cursedcrafts commented 8 months ago

Currently struct function pointers gets colored with property semantic token type. Having function colorization would help quite a lot spotting those from the code.

struct {
  void (*func)(void);
  int var;
} test;

int main(void) {
  // func has same color as var currently
  test.func();
  test.var = 2;
}
i-ky commented 8 months ago

Wouldn't function coloring be confusing when func is assigned to? Also in C++ struct can have "true" function members and coloring data members as function may be confusing as well.

cursedcrafts commented 8 months ago

That I didn't even think of. Yes, that would be indeed confusing as well. In that case I think the better option is for me to instead find a method of overriding semantic token type with textmate scopes as that would recognize the member as entity.name.function.member.c when the parenthesis are used.