Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 418
Josh Silveous Avatar asked Oct 23 '25 00:10

Josh Silveous


1 Answers

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

like image 96
Adam Thompson Avatar answered Oct 24 '25 15:10

Adam Thompson