Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code formatting] Support option to exclude sections of code when using Format Document #1197

Open
ShuguangSun opened this issue Sep 10, 2024 · 3 comments
Labels
feature request New feature or request

Comments

@ShuguangSun
Copy link
Contributor

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
Copy link
Contributor Author

This is an extended feature request of #989 .

@scnwwu scnwwu added the feature request New feature or request label Sep 10, 2024
@Snoopy1866
Copy link

I wonder if there are any protocol about formatting conventions in SAS, similar PEP8 in Python. @scnwwu

@Snoopy1866
Copy link

If that a protocol exist, we can write a standalone VSCode extension purely for formatting, just like the black, flake8 or autopep8 did.

@snlwih snlwih changed the title Region not to be formated [Code formatting] Support option to exclude sections of code when using Format Document Nov 29, 2024
@snlwih snlwih changed the title [Code formatting] Support option to exclude sections of code when using Format Document [Format Document] Support option to exclude sections of code when using Format Document Nov 29, 2024
@snlwih snlwih changed the title [Format Document] Support option to exclude sections of code when using Format Document [Code formatting] Support option to exclude sections of code when using Format Document Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants