Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 14c5dab

Browse files
aldonogueiraalexheretic
authored andcommitted
Filter outline variable type (#65)
* Test code provided by alexheretic to filter variable type * Explanation to the filtering of local variables
1 parent 67d4c52 commit 14c5dab

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,23 @@ class RustLanguageClient extends AutoLanguageClient {
591591
throw new Error("failed to start server: " + e)
592592
}
593593
}
594+
595+
// Extends the outline provider by filtering the type variable, which is s
596+
// only used for local variables by RLS. This makes the outline view
597+
// cleaner and more useful.
598+
provideOutlines() {
599+
let provide = super.provideOutlines()
600+
let superOutline = provide.getOutline
601+
602+
provide.getOutline = async (...args) => {
603+
let outline = await superOutline.apply(this, args)
604+
outline.outlineTrees = outline.outlineTrees
605+
.filter(o => o.icon !== "type-variable")
606+
return outline
607+
}
608+
609+
return provide
610+
}
594611
}
595612

596613
module.exports = new RustLanguageClient()

0 commit comments

Comments
 (0)