Author Topic: external formatter  (Read 1520 times)

mzel

  • Community Member
  • Posts: 29
  • Hero Points: 0
external formatter
« on: April 05, 2021, 06:05:50 PM »
How can I setup VS to reformat(beautify) the code in the text tab using an external formatter e.g. .exe or a Python script?

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: external formatter
« Reply #1 on: April 06, 2021, 04:08:15 AM »
I use this macro for clang-format:

Code: [Select]
_command void reformat_buffer() name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_MARK)
{
   // https://community.slickedit.com/index.php/topic,15729.msg67625.html#msg67625
   typeless saved;
   save_pos(saved);
   select_all();
   auto cmd = 'clang-format --assume-filename=' p_buf_name ' --style=file';
   filter_command(cmd);
   restore_pos(saved);
}

See: https://community.slickedit.com/index.php/topic,15729.msg67625.html#msg67625
« Last Edit: April 06, 2021, 04:10:18 AM by rowbearto »

mzel

  • Community Member
  • Posts: 29
  • Hero Points: 0
Re: external formatter
« Reply #2 on: April 06, 2021, 07:44:54 PM »
Thanks, let me try this