How to collapse comments in VScode? Topic is solved

Scripting and setups with Visual Studio Code (vscode) and AutoHotkey.
Kawaki
Posts: 25
Joined: 29 Jun 2021, 21:33

How to collapse comments in VScode?

Post by Kawaki » 03 Jul 2021, 04:27

Hi,

New to AHK and VScode, I don't code either. Something is bothering me while i'm watching tutos for AHK, i can't collapse comments like i see they do in scite4autohotkey. I got a few AHK addons for VScode already, doesn't change anything.

https://imgur.com/a/FlBYano

Thank you, sorry for noob question.
Last edited by Kawaki on 03 Jul 2021, 06:17, edited 1 time in total.

User avatar
Xeo786
Posts: 759
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: How to collapse comments in VScode?

Post by Xeo786 » 03 Jul 2021, 06:01

I don't know much about VS because AHK is my first programming language

You can mentioned comments in your code and comment will starts with ;

Code: Select all

NTNdata := INI2Array(NTNini)		; this will translated ini into array
for Sec, Seclines in NTNdata		; using for loop to put data from ini into tree view
	for k, v in Seclines
		TV_Add(Sec " : " v )		
You can disable multiple lines using /* and it will disable all line below unless you close it with *\

Code: Select all

/*
; following code will make ongoing month selected as default for dropdownlist
months := ["Jan","Feb","March","April","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
for k, v in months
{
	if (v = A_MMM )
		Monthlist .=  v "||"
	else
		Monthlist .=  v "|"
}
*/
Gui MState:Add, DropDownList, x237 y235 w120 vEMonth, % Monthlist
I just know these two ways
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

Kawaki
Posts: 25
Joined: 29 Jun 2021, 21:33

Re: How to collapse comments in VScode?

Post by Kawaki » 03 Jul 2021, 06:11

Yeah, i learned those ways too. I wanted to use VScode since it seems an all around good editor with many possibilities, even though i'm also starting to learn AHK as my first language. It's just that if comments do work, I can't seem to find the option to collapse/fold them like in scite4autohotkey. I know i'm gonna have to use it at some point and it's frustrating not to be able to do it.

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: How to collapse comments in VScode?  Topic is solved

Post by boiler » 03 Jul 2021, 06:14

At least with the AHK extension I use in VS Code, the lines in between the opening comment line and the closing comment line need to be indented by at least a space for the collapse feature to appear in the margin. It seems to be based almost (or totally) solely on the indentation rather than the existence of the comment symbols.

Kawaki
Posts: 25
Joined: 29 Jun 2021, 21:33

Re: How to collapse comments in VScode?

Post by Kawaki » 03 Jul 2021, 06:23

@boiler
What do you use as extension? There are so many of them, and so many forks from the same main one. I figured it could come from an extension but i've tried many, doesn't seem to change anything.
Also, i noticed that TypeScript (in VS code) uses same comment format and collapse does work perfectly! So even weirder.

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: How to collapse comments in VScode?

Post by boiler » 03 Jul 2021, 06:32

I'm currently using AutoHotkey Plus Plus by Mark Wiemer, which was forked from cweijan's AutoHotkey Plus.

Kawaki
Posts: 25
Joined: 29 Jun 2021, 21:33

Re: How to collapse comments in VScode?

Post by Kawaki » 03 Jul 2021, 06:33

boiler wrote:
03 Jul 2021, 06:14
At least with the AHK extension I use in VS Code, the lines in between the opening comment line and the closing comment line need to be indented by at least a space for the collapse feature to appear in the margin. It seems to be based almost (or totally) solely on the indentation rather than the existence of the comment symbols.

Ooh, i tried to use a space before. It works now. It's exactly as you said, the collapse option is entirely based on the space rather than the comment symbol. So we have to create a space before EVERY line of comment when using VS code for AHK, that's very weird and probably the only thing worse and less functional compared to using scite4autohotkey. Never mind, we only need to use space once, then it automatically remembers it until we close comment. Perfect.

Anyway, thanks a lot!

Post Reply

Return to “Visual Studio Code”