Author Topic: Formatting style per workspace...?  (Read 159 times)

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Formatting style per workspace...?
« 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 :) )

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1092
  • Hero Points: 100
Re: Formatting style per workspace...?
« Reply #1 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...". 

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4794
  • Hero Points: 388
Re: Formatting style per workspace...?
« Reply #2 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.

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #3 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)
« Last Edit: September 13, 2019, 06:14:25 pm by joecar »

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #4 on: September 13, 2019, 06:41:40 pm »
Can the .seeditorconfig.xml file pathname be specified in the .vpw file...?

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #5 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.

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #6 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).

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #7 on: September 13, 2019, 07:04:38 pm »
see attached pics for options and .xml locations.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4794
  • Hero Points: 388
Re: Formatting style per workspace...?
« Reply #8 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.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4794
  • Hero Points: 388
Re: Formatting style per workspace...?
« Reply #9 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).

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #10 on: September 13, 2019, 09:25:05 pm »
Ok, I got it working, thanks.

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #11 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.

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #12 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.

joecar

  • Senior Community Member
  • Posts: 235
  • Hero Points: 8
  • engineer/gearhead
Re: Formatting style per workspace...?
« Reply #13 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.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4794
  • Hero Points: 388
Re: Formatting style per workspace...?
« Reply #14 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.