SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: mzel on April 05, 2021, 06:05:50 pm

Title: external formatter
Post by: mzel 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?
Title: Re: external formatter
Post by: rowbearto 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
Title: Re: external formatter
Post by: mzel on April 06, 2021, 07:44:54 pm
Thanks, let me try this