Author Topic: external formatter  (Read 217 times)

mzel

  • Community Member
  • Posts: 26
  • 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: 1875
  • Hero Points: 122
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: 26
  • Hero Points: 0
Re: external formatter
« Reply #2 on: April 06, 2021, 07:44:54 pm »
Thanks, let me try this