Collapsible code segments do not collapse if they're comment blocks

In studio, it would be really nice (for documentation) if these collapsible arrows would interact with the comment blocks. Instead, they collapse but without change to the format. This makes it difficult to navigate through code which is heavily documented (as exampled in the image)


--[[
	@function PullUserGroupsAndCompareToDepartments
	@author unix_system
	@date 14/03/2019
	@params: 
		(integer) userId [The user Id of the person you want to pull groups on]
	@returns:
		([string]) UserGroups [The groups (tuple) available to the user. Format:
			{[GroupId] = {Name = "123",...}}
	@purpose:
		This function will pull all the user's groups, and compare that list to the list of Department Applications.
		It's designed to cut down the number of GetRankInGroup requests by just doing a lump check at the start. 
		N.B. This probably caches. So assume heavy yield.
	@usage: local GroupTable = PullUserGroupsAndCompareToDepartments(Player.userId)
--]]

Repro ^

1 Like

The last two collapsible arrows don’t actually appear as a comment minimiser/expander; they appear because of your inclusion of the word “function” in your comment. The arrow is added as the editor is attempting to allow to you minimise the contents of the ‘function’ (when there isn’t really any function at all).

It wouldn’t be expected for these arrows to change the comment format in any way. In fact, it’d be nice for comments to, instead of providing a dummy arrow, ignore keywords like this altogether—possibly worth filing a bug report for this issue itself.

1 Like

This seems to work - but I would not count on it being reliable.

--[[ Coments Section
-- Main section of comments
-- This is a place for thought about the code
--{Group1
--	
--	
--		}
--{Group2
--
--
--		}
]]--

Revised:
Wasn’t sure if the original method was even proper comment syntax, this seems a little safer to use.

Aye - I’m happy with either, though I’d obviously like to be able to collapse blocks.

Interesting - I’m guessing it just ignores the fact it’s a code block and assumes it’s a string block.

Studio’s script IDE has a lot of bugs when it comes to collapsing code blocks and I’m not entirely sure why. Even with normal code, it’ll sometimes not collapse them even though it should. I think this bug is more or less related to code collapsing itself, rather than being exclusive to comment blocks.

1 Like

Yea exactly. Seems like it picks up on keywords and certain syntax. It still treats code like it would normally, regardless of commenting. So whatever works in code to collapse will work in comments too.

Howdy!
A few days ago I have noticed this problem on multiple places of mine:


Notice how not all folds are collapsing when the button is pressed. I have to say that it worked well before.

For better video quality open it in a new tab.