User-Defined Language | Problem with Code Folding
I set up a user defined language for maxscript and so far i have everything working except code folding.
--- loop each state for thestate in allstates do ( --- restores a scenestate by name sceneStateMgr.RestoreAllParts thestate -- what values are saved in it? statebitarray = sceneStateMgr.GetParts thestate --- set layer status to hidden or not myLayer = LayerManager.getLayerFromName layername myLayer.on = theswitch if updatenested then ( -- handle children layerRT = mylayer.layerAsRefTarg for a=1 to layerRT.getNumChildren() do ( childlayer = layerRT.getChild a childlayer.on = mylayer.on ) ) -- save scene state with the same name sceneStateMgr.Capture thestate statebitarray )
What i would like to achieve is code folding the nested brackets. If i set up the UDL for folding with
the folding looks like this:
Is there a way to fix this?
Folding by intendation would also be fine, although when researching it, it kinda seemed to me like that’s a python exclusive thing.
Your example works for me.
By any chance do you use non-windows eol?
Recently one reported an issue when using unix eols.
Yes, you are right, UDL cannot use indention for folding.
Okay thank you. I tried changing the eol but it didn’t help.
I figured it out by myself. Problem causing my issue was i set the Close on line comments to ((EOL)).
Somehow that caused code folding on some line comments.
Now that i have that working i have one more question.
Functions are defined like this:
fn updatelayertoscenestates layername mode:1 updatenested:true = (return true)
Is it possible to style the optional parameters (The ones followed by “:”)?
Cheers and thank you for helping me
I understand that, from your example, you want to have the 1 and the word true colored.
No, I don’t think it is possible using the current udl version.
Hi, no that’s not what i mean.
I’d like to have the “mode:” and “updatenested:” colored. Basically every word ending on “:”.
Quick update as I’m on the run, maybe using a delimiter
and allowing nesting?
Assuming that function name function definition and parameters
are part of keywords, numbers etc…