SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: joecar on September 10, 2019, 10:42:50 PM

Title: Formatting style per workspace...?
Post by: joecar on September 10, 2019, 10:42:50 PM
Is it possible to set formatting style per project or workspace...?

( this is a undisguised feature request :) )
Title: Re: Formatting style per workspace...?
Post by: patrick on September 10, 2019, 11:07:50 PM
There isn't a workspace setting for it. But if you can add an XML file to your workspaces, for v23 and later you can use the .seeditorconfig.xml file support to do it.

To use that, you have to enable the support in Tools -> Options -> General -> "Apply .editorconfig, .seeditorconfig.xml settings" first, and then you can create the override file using Tools -> Beautifier -> "Beautifier Profile Overrides...". 
Title: Re: Formatting style per workspace...?
Post by: Clark on September 10, 2019, 11:46:33 PM
If you have a tree of source, create the Beautifier Profile Override and the root of the source tree. That way it's applied to all the source files beneath it.
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 06:10:04 PM
Thanks, let me try that...


I'm running SlickEdit Pro 2019 (v24.0.0.4 64-bit)
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 06:41:40 PM
Can the .seeditorconfig.xml file pathname be specified in the .vpw file...?
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 06:57:30 PM
I can't seem to get it to work correctly...

When I goto a differnt workspace the formatting does not override...

Attached pics are of workspace #1... you can see format is "QNX_Workspace" for override and actual.
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 06:59:13 PM
Attached are pics for workspace #2... you can see that the actual does not follow the override (instead, it followed workspace #1).
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 07:04:38 PM
see attached pics for options and .xml locations.
Title: Re: Formatting style per workspace...?
Post by: Clark on September 13, 2019, 08:35:43 PM
If things are working, you can verify the override is occurring. See picture.

In my test case, f:\test\ has a .seeditorconfig.xml. The file I'm editing is f:\test\subdir1\myfile.cpp.

It looks like you've set this up correctly. I've attached a zip file of my test case. I haven't posted my simple user.cfg.xml. You'll have to manually add the Workspace-Test1 C++ formatting profile if you want to try it out.
Title: Re: Formatting style per workspace...?
Post by: Clark on September 13, 2019, 08:45:27 PM
I did get a little tripped up. I already had myfile.cpp open when I configured my beautifier override profile. I had to close and reopen myfile.cpp to get the correct beautifier settings. I copied the "Google Coding Style" profile which has an indent of 2 (totally different than my typical settings).
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 09:25:05 PM
Ok, I got it working, thanks.
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 09:27:11 PM
Can the .seeditorconfig.xml file pathname be specified in the .vpw file...?
If .seeditorconfig.xml could be specified in the .vpw then it would have having to copy it to various places.
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 09:40:50 PM
Can the .seeditorconfig.xml file pathname be specified in the .vpw file...?
If .seeditorconfig.xml could be specified in the .vpw then it would have having to copy it to various places.

Nevermind... I see now that the .xml can be located in an upper directory, and the Beautify Profile Override can specify that path.
Title: Re: Formatting style per workspace...?
Post by: joecar on September 13, 2019, 10:28:22 PM
Thanks for all your help.

Being able to automatically override indent styles among workspaces/projects is a HUGE time saver  :) :) :) :)

Thanks.
Title: Re: Formatting style per workspace...?
Post by: Clark on September 14, 2019, 03:20:25 PM
Configuring by directory is a bit better than configuring per workspace.  The current method will give you the correct beautifier settings even if you access a file that is not in the current workspace you have open. The downside is that if your files have very poor structure like files in same directory having different beautifier settings, then the current algorithm doesn't support that. Hopefully, nobody needs that. The current override method could be extended to support a filename and/or wildcard. Not trivial but doable.
Title: Re: Formatting style per workspace...?
Post by: joecar on September 16, 2019, 04:31:46 PM
Thanks.

How would I configure formatting for this "double-indent" style (where braces are indented, and then block inside braces is further indented):

Code: [Select]
{
for(int i=0;i<LastView;i++)
{
if(UserList[i].svcsView==view)
{
SetSVCSInfo(i);
break;
}
}
}


 
Title: Re: Formatting style per workspace...?
Post by: Clark on September 16, 2019, 08:15:05 PM
SlickEdit doesn't support this style yet.