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
		(integer) userId [The user Id of the person you want to pull groups on]
		([string]) UserGroups [The groups (tuple) available to the user. Format:
			{[GroupId] = {Name = "123",...}}
		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 ^


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.


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
--		}
--		}

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.


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.