[symbol-provider-tree-sitter] Fix icon display via symbol.icon

Specifying the icon via the `(#set! symbol.icon "foo")` predicate was having no effect.
This commit is contained in:
Andrew Dupont 2024-01-14 10:09:21 -08:00
parent 33b4eea80d
commit 58d9a0393e
2 changed files with 5 additions and 3 deletions

View File

@ -179,3 +179,5 @@ If this value is omitted, this provider will still attempt to match certain comm
The `symbol.tag` predicate will set the value of a symbols `tag` property to a fixed string.
The `tag` property is used to supply a word that represents the symbol in some way. For conventional symbols, this will often be something like `class` or `function`.
This provider will attempt to match certain common tag values to icons. This can be overridden by specifying an explicit `symbol.icon` value.

View File

@ -246,11 +246,11 @@ class Name {
}
toSymbol() {
let { name, shortName, position, context, tag } = this;
let symbol = { name, shortName, position };
let { name, shortName, position, context, tag, icon } = this;
let symbol = { name, shortName, position, icon };
if (tag) {
symbol.tag = tag;
symbol.icon = iconForTag(tag);
symbol.icon ??= iconForTag(tag);
}
if (context) symbol.context = context;