Hi!
I'm editing many Photoshop script files. Those files have JSX extension. I have added this file extension already to javascript.uew wordfile. That's OK.
Because I have to handle files with thousand of lines, and I need to move and copy many blocks with similar lines. I thought about customizing the code folding feature to hide/show some blocks.
I tried to use Hide/Show Selection feature, but it would be far better if the JSX file would open with code folding already working, with [+][-] icons appearing to expand and collapse lines.
I already checked Brace match in comments in Editor - Braces / strings because the code folding I want to do is not part of the code itself and must be inside a comment.
I think an example would explain better.
This is part of my file:
I need to folding from line 2 to 20, because it means the same action and no need to show them.
So, I put "{" at the final of line 1 and "}" at the beginning of file 21, both inside a comment.
The result of this customization would be the following:
When I could customize that UEW file, I would not use javascript.uew anymore. I would have a new file and use a different name for it, like PhotoshopScript.uew to open and format JSX extension files.
Or is there any another solution for that issue? Please let me know.
Two and a half hours later:
After making some tests I realized that selection folding is kept after closing UltraEdit. Because it seems to be a temporary selection/folding, I expected that those folding had gone after starting a new session. But no. All selection foldings I had made were still there. I searched uedit64u.ini file to look for that saved state, but could get no track of it.
Anyone has the answers?
But if I could have a customized wordfile just for this kind of situation, i.e. code folding across comment lines as previous described, it would be great.
Five minutes later:
Looking more carefully, now I see where such settings are stored: [Hidden Lines] entry of uedit64u.ini file.
Six and a quarter hours later:
Playing a little more with that code, I realized that the closing brace would be a line before, like this:
This way, I can use CTRL-B to select to matching brace and CTRL-Subtract to hide/show selection.
And the result is:
But I'm still trying to find a way to have a wordfile to show indents and code folding automatically, without selection action, based only on "{" and "}" characters to open and close blocks.
It's not mandatory that open and close characters are "{" and "}".
It would be anything else like "$" and "&", or "!" and "#", or even "[" and "]" also possible if they don't conflict with reserved ones.
I'm editing many Photoshop script files. Those files have JSX extension. I have added this file extension already to javascript.uew wordfile. That's OK.
Because I have to handle files with thousand of lines, and I need to move and copy many blocks with similar lines. I thought about customizing the code folding feature to hide/show some blocks.
I tried to use Hide/Show Selection feature, but it would be far better if the JSX file would open with code folding already working, with [+][-] icons appearing to expand and collapse lines.
I already checked Brace match in comments in Editor - Braces / strings because the code folding I want to do is not part of the code itself and must be inside a comment.
I think an example would explain better.
This is part of my file:
Code: Select all
// ================ Copia Layer =========================={
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// }=============== Seleciona "Cima" ====================={
var idsetd = charIDToTypeID( "setd" );
var desc4 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref3 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref3.putProperty( idChnl, idfsel );
desc4.putReference( idnull, ref3 );
var idT = charIDToTypeID( "T " );
var ref4 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
ref4.putName( idChnl, "Cima" );
desc4.putReference( idT, ref4 );
executeAction( idsetd, desc4, DialogModes.NO );
// }=============== Esconde Layer corrente ==============={
var idHd = charIDToTypeID( "Hd " );
var desc5 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var list3 = new ActionList();
var ref5 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref5.putEnumerated( idLyr, idOrdn, idTrgt );
list3.putReference( ref5 );
desc5.putList( idnull, list3 );
executeAction( idHd, desc5, DialogModes.NO );
// }
So, I put "{" at the final of line 1 and "}" at the beginning of file 21, both inside a comment.
The result of this customization would be the following:
Code: Select all
[+]// ================ Copia Layer =========================={
[+]// }=============== Seleciona "Cima" ====================={
[+]// }=============== Esconde Layer corrente ==============={
Or is there any another solution for that issue? Please let me know.
Two and a half hours later:
After making some tests I realized that selection folding is kept after closing UltraEdit. Because it seems to be a temporary selection/folding, I expected that those folding had gone after starting a new session. But no. All selection foldings I had made were still there. I searched uedit64u.ini file to look for that saved state, but could get no track of it.
Anyone has the answers?
But if I could have a customized wordfile just for this kind of situation, i.e. code folding across comment lines as previous described, it would be great.
Five minutes later:
Looking more carefully, now I see where such settings are stored: [Hidden Lines] entry of uedit64u.ini file.
Six and a quarter hours later:
Playing a little more with that code, I realized that the closing brace would be a line before, like this:
Code: Select all
// ================ Copia Layer =========================={
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// =======================================================
var idCpTL = charIDToTypeID( "CpTL" );
executeAction( idCpTL, undefined, DialogModes.NO );
// }
// ================ Seleciona "Cima" ====================={
var idsetd = charIDToTypeID( "setd" );
var desc4 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref3 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref3.putProperty( idChnl, idfsel );
desc4.putReference( idnull, ref3 );
var idT = charIDToTypeID( "T " );
var ref4 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
ref4.putName( idChnl, "Cima" );
desc4.putReference( idT, ref4 );
executeAction( idsetd, desc4, DialogModes.NO );
// }
// ================ Esconde Layer corrente ==============={
var idHd = charIDToTypeID( "Hd " );
var desc5 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var list3 = new ActionList();
var ref5 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref5.putEnumerated( idLyr, idOrdn, idTrgt );
list3.putReference( ref5 );
desc5.putList( idnull, list3 );
executeAction( idHd, desc5, DialogModes.NO );
// }
And the result is:
Code: Select all
[+]// ================ Copia Layer =========================={
[+]// ================ Seleciona "Cima" ====================={
[+]// ================ Esconde Layer corrente ==============={
It's not mandatory that open and close characters are "{" and "}".
It would be anything else like "$" and "&", or "!" and "#", or even "[" and "]" also possible if they don't conflict with reserved ones.