diff --git a/lib/index.js b/lib/index.js index 2ee6be9..cd9dfd7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -577,6 +577,23 @@ class RustLanguageClient extends AutoLanguageClient { throw new Error("failed to start server: " + e) } } + + // Extends the outline provider by filtering the type variable, which is s + // only used for local variables by RLS. This makes the outline view + // cleaner and more useful. + provideOutlines() { + let provide = super.provideOutlines() + let superOutline = provide.getOutline + + provide.getOutline = async (...args) => { + let outline = await superOutline.apply(this, args) + outline.outlineTrees = outline.outlineTrees + .filter(o => o.icon !== "type-variable") + return outline + } + + return provide + } } module.exports = new RustLanguageClient()