[PATCH] D65637: [clangd] [WIP] Semantic highlighting prototype for the vscode extension.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 2 05:28:15 PDT 2019

hokein added inline comments.

Comment at: clang-tools-extra/clangd/clients/clangd-vscode/src/TextMate.ts:20
+            const split = scope.split('.');
+            while(split.length > 0) {
+                split.splice(-1)
jvikstrom wrote:
> I'm pretty sure this matching logic is wrong. An example of the scopes for variables in the Light+ theme:
> ```
> variable.css
> variable.scss
> variable.other.less
> variable.language.wildcard.java
> variable.language
> storage.type.variable.cs
> variable
> meta.definition.variable.name
> support.variable
> entity.name.variable
> ```
> With this kind of matching we have now this means that `variable.other.less` will match `variable.other` and `variable.other.less`.
> As there is no perfect match for `variable.other.field` it will try to match `variable.other` and find the color for less.
> What should probably be done is remove the divided map. The query function should still be the same but  query on this.colors instead of this.divided.
The suffix of textmate indicates the language it belongs to (e.g. java), I think we can ignore non-C++ textmates, and merely find the longest-prefix match in all `c++` textmates?

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list