VirtusO
VirtusO

Reputation: 161

How do I collapse SQL in VS Code?

I checked the documentation for code collapsing, many languages have a marker defined but SQL doesn't.

SQL Server Management Studio recognizes begin and end as a region, allowing for folding, but VS Code doesn't.

Any suggestions are very appreciated.

Upvotes: 11

Views: 3874

Answers (2)

Maciej Czapiewski
Maciej Czapiewski

Reputation: 153

For anyone coming here for the answer.
Region markers for SQL have been added to VS CODE in 2019 and you can now use them as:

--#region [name region if you like]
part of code you want to fold/collapse
--#endregion

Then use Ctrl + Shift + P or View -> Command Palette... and choose Fold All Regions.

Upvotes: 14

Daniel M. Oliveira
Daniel M. Oliveira

Reputation: 31

use tab for group common code. For example: BEGIN YOU SQL CODE END

the region between BEGIN will be collapsed

Upvotes: 0

Related Questions