For those of you that doesn't know what region is:
Code: Select all
#region Let's hide our super fun code here
// Totally cool and legit code right here
#endregion
So does that kind of solution exist?
Code: Select all
#region Let's hide our super fun code here
// Totally cool and legit code right here
#endregion
but if there's code inside the function that I want to group?
well you're partly true, right now I'm trying to get back to LÖVE after not using it for approx. 2 years and I've left some code in my current project as a reminder for another time like this:
Code: Select all
-- What happens reach a certain threshold
--[[
if moveX < 700 then
moveX = moveX + 100 * dt
end
]]
-- Here we're playing around with true/false
-- You can use "if moving == true" but that's overflow
-- For a false statement use "not" after "if".
--[[
if not moving then
moveX = moveX + 100 * dt
end
moveX = moveX + 10 * dt
-- moveY = moveY + 10 * dt
]]
Things like this are usually not part of any languages, rather it's dependant on the code editor one uses; for example, sublime text 2 can hide blocks, but it's horribly simplistic (it can't hide the closing ends unless i indent them as well).#region lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor. In longer code files, it is convenient to be able to collapse or hide one or more regions so that you can focus on the part of the file that you are currently working on.
Well I like them :C but seriously there were in one project where I used it every where and it looked bad after extensive use, so I set as a rule for myself that I should only use it if I have to.zorg wrote: ↑Mon Feb 27, 2017 7:38 pm I really think that embedding such functionalities in a language itself is just meaningless; it's equivalent (from a code perspective) to comments; also see this: http://softwareengineering.stackexchang ... code-smell
That's just my opinion though.
When you say it, I realize you're right.
Code: Select all
--[==[
...other comments here...
--]==]
Hey thanks for pointing it out but the only downside I see with this is that it ain't pretty..airstruck wrote: ↑Mon Feb 27, 2017 7:48 pm Hmm, so really you want to fold up a bunch of comments? You could wrap the whole thing in a multiline comment, like this:
The thing with the equals signs is a special syntax for block comments that happen to contain ]] (or ]=], or ]==], etc.). Just make sure you use the same number of equals signs at the beginning and end.Code: Select all
--[==[ ...other comments here... --]==]
With some luck your editor can figure out what's going on here and do the folding properly.
Users browsing this forum: Bing [Bot] and 2 guests