Josh Silveous
Josh Silveous

Reputation: 763

VSCode - Hide TypeScript interfaces/types feature?

When I'm just glancing through my code, I don't need to see all of my type and interface declarations, or the type definitions

const sometext: string = "blahblah"

string being what I mean by definitions. I don't know the proper term.

I understand the importance of being able to view this information, but it's not always needed and can make it more confusing to skim through code with all the clutter.

I'd like to be able to use a hotkey to hide/show all TypeScript-related stuff in my code, so I can focus on the pure JS when needed.

I found this GitHub post suggesting the same idea, but they just shot down the idea.

I just want to be able to quickly fold/unfold all types/interfaces, and being able to hide (or discolor) the definitions would be nice too. It can be helpful when the code is fresh in your mind, and you name your variables well. Being able to flip between typing and just viewing the JS logic would be nice.

Is there a plugin/feature that accomplishes this?

Upvotes: 1

Views: 686

Answers (1)

Adam Thompson
Adam Thompson

Reputation: 146

This folds types based on the TypeScript AST:

https://marketplace.visualstudio.com/items?itemName=SuncappedGames.typescript-fold

The technique is forked from another repo. It uses textDecoration to just hide the text.

enter image description here

Upvotes: 1

Related Questions