Reputation: 415
I'm updating some legacy code, because of my unfamiliarity to it, Its very difficult to find structures, especially if I step away for a week for other projects.
To alleviate this problem I've gone back to my old-school roots and started adding ascii text-art as comments above sections of code, using this tool:
http://patorjk.com/software/taag/#p=display&h=3&v=1&f=Big%20Money-ne&t=Reveal%0ACheck
This allows me to see via my MiniMap the titles of functions or sections of code I might need to come back to
The Thought then occured.. well surely someone else has this problem, and since VSCode seems to be written by the community, maybe someone has already written a plugin that would search the code for function titles (like Javadocs?) and display the title in a readable size?
If not, would it be easily coded? i.e. is the minimap just a very shrunk down copy(not easy) or is it structured and can be parsed and tweaked?
Upvotes: 5
Views: 2253
Reputation: 51402
VS Code 1.88 supports this (with a tiny bit of manual effort). See the release notes section "minimap section headers".
TL;DR text trailing the line of an opening region marker (such as /#region
in Python, but each language has their own region markers) will be used as a heading/title in the minimap, and you can also add such headings without region markers by making comments that start with MARK:
. In the February 2025 release, you will be able to define custom tags instead of just "MARK:" (see issue ticket #209904 and PR #210271) using the editor.minimap.sectionHeaderDetectionRegExp
setting.
Note though that VS Code has other features to help with navigating between symbols, such as the Outline View, breadcrumbs, and Go To Symbol.
You may also be interested to keep an eye out for extensions starting to make use of the feature I mention in my answer to How to change font size of specific parts of code in VS Code?.
Upvotes: 3
Reputation: 129
As long as your language plugin supports it, you can use cmd + shift + o
to go to function definition.
All functions should also be listed in the Side Bar under "Outline"
Upvotes: 1