sassoftware / vscode-sas-extension

This SAS Extension for Visual Studio Code provides support for the SAS language, including features such as SAS syntax highlighting, code completion, hover help, code folding, outline, SAS code snippets and run SAS code.
https://sassoftware.github.io/vscode-sas-extension/
Apache License 2.0
117 stars 47 forks source link

Region not to be formated #1197

Open ShuguangSun opened 2 weeks ago

ShuguangSun commented 2 weeks ago

Is your feature request related to a problem? Please describe. I'd like it is not to be formated in the PROC FORMAT or PROC SQL, or other special situations. For example, if I format the code below

proc format;
  value range
    40000-high='High'
    26000-< 40000='Medium'
    other ='Low';

  invalue evaluation
    'O'=4
    'S'=3
    'E'=2
    'C'=1
    'N'=0;
run;

It becomes

proc format;
  value range 40000-high='High' 26000-< 40000='Medium' other='Low';

  invalue evaluation 'O'=4 'S'=3 'E'=2 'C'=1 'N'=0;
run;

I'd like to keep the format of the first one.

For PROC SQL, it is similar. Usually I'll make a separate sql script file to format code and then paste it back, however, sas extension's format will make it flat again.

Describe the solution you'd like I'd like to suggest add some thing like REGION. For example,

proc format;
  /* sas-format-disable */
  value range
    40000-high='High'
    26000-< 40000='Medium'
    other ='Low';

  invalue evaluation
    'O'=4
    'S'=3
    'E'=2
    'C'=1
    'N'=0;
  /* sas-format-enable */
run;

proc sql;
  * sas-format-disable;
  select
    momage,
    (weight * 0.01) as newweight
  from
    outdata
  where
    calculated newweight > 5;
  * sas-format-enable ;
run;

Environment SAS version 9.4

ShuguangSun commented 2 weeks ago

This is an extended feature request of https://github.com/sassoftware/vscode-sas-extension/issues/989 .