Skip to content

Commit

Permalink
Added logic to display symbol name together with its type (#509)
Browse files Browse the repository at this point in the history
* Added logic to display symbol name together with its type

* Fixing lint error

* Removing debug logging

* Removed a space I added accidentaly after the separator

Co-authored-by: Henrique <[email protected]>
  • Loading branch information
typoon and Henrique authored Dec 28, 2020
1 parent 9b27de5 commit 2e2b4d1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/inlay_hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ export class HintsUpdater implements Disposable {
if (this.ctx.config.inlayHints.typeHints) {
const sep = this.ctx.config.inlayHints.typeHintsSeparator;
for (const item of decorations.type) {
const chunks: [[string, string]] = [[`${sep}${item.label}`, 'CocRustTypeHint']];
const sn_start = item.range.start.character;
const sn_end = item.range.end.character;
const line = doc.getline(item.range.start.line);
const symbol_name = line.substring(sn_start, sn_end);
const chunks: [[string, string]] = [[`${sep}${symbol_name}: ${item.label}`, 'CocRustTypeHint']];
if (chaining_hints[item.range.end.line] === undefined) {
chaining_hints[item.range.end.line] = chunks;
} else {
Expand Down

0 comments on commit 2e2b4d1

Please sign in to comment.