User-Defined Language | Problem with Code Folding
-
Hi there!
I set up a user defined language for maxscript and so far i have everything working except code folding.
Code example:
--- 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
Open: (
Middle:
Close: )
the folding looks like this:
imageIs 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.
Cheers
Claudia -
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.Cheers
Claudia -
Hi, no that’s not what i mean.
I’d like to have the “mode:” and “updatenested:” colored. Basically every word ending on “:”.Cheers
Lukas -
Quick update as I’m on the run, maybe using a delimiter
Open fn
Close =
and allowing nesting?
Assuming that function name function definition and parameters
are part of keywords, numbers etc…Cheers
Claudia -
Hi Lukas,
I am sharing a User Defined Language setup for Maxscript on my webpage if you want.
I found it on the web a long time ago and use it regularly. It is not perfect though, so I am currently asking for help in order to see the functions in the Functions Lister panel (another thread in this forum).I didn’t found how to set up the folding blocks eithers unfortunately.
Hope this helps,
Werwack
-
Hi Lukas,
This thread about Maxscript may also interest you: https://notepad-plus-plus.org/community/topic/13443/need-help-to-make-maxscript-functions-recognized-by-function-list
Werwack