-
Notifications
You must be signed in to change notification settings - Fork 48
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
feat: recursive Folding Block #555
Conversation
I noticed 2 issues with below code.
|
@scnwwu Fixed all. |
Acceptance Criteria: 1.Make sure there are no regression issues |
Type the code below, no outline for the customized region and data block.
|
Type code below and click the first line or the second, open context menu to execute 'Run region'. It will direct to "proc means" block instead of the whole macro block.
|
Perform 'Run region' action on the code below. If click the first line and execute 'Run region', the whole customized block should be ran. And now it will run data block only.
|
@Zhirong2022 Other issues are all fixed~ |
server/src/sas/LexerEx.ts
Outdated
@@ -225,7 +231,7 @@ export class LexerEx { | |||
i++; | |||
block = blocks[i]; | |||
} while (block && !this._isBefore(pos, this._startPos(block))); // |[] | |||
return --i; | |||
return block ? --i : -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, may I know the reason for this change? If there's not a i+1
block, the i
block is still valid.
There's a problem with current implementation. With code
data a;
a;
run;
data b;
b;
run;
If I put cursor at the start of the line data b
(line 4 col 1), click Run Region
from context menu, the data b
is not run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scnwwu In the recursive senario, if a user clicks the firstline "*region", and run region, it will search the block recursively. First it finds the *region block, then it will check every children blocks [data, proc]. If I let "i block" is still valid when there is not a i-1 block, it will then match the data block instead of the outer *region block. This is a fault.
*region;
data _null_;
run;
proc print data=sashelp.cars;
run;
*endregion;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jingjiajie,
There's another problem. With below code, put cursor at line 3 col 1, run region will run *region
which is wrong.
*region;
proc print data=sashelp.class;
run;proc print data=sashelp.cars;
*endregion;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
The outline is not proper for some code blocks. Please type the code below to take a look. '%filenaming;' is not a block in such scenario.
|
Fixed. |
The outline is not correct for the code below. The most outer block '%*region' is not shown as expected.
|
@jingjiajie, thank you for trying this but there's a problem for this approach. |
@scnwwu Yes, I reproduced this problem. I think we could just run the open code instead of disabling the menu item, if there's no better solution. |
Agreed |
done. |
client/src/node/extension.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks unnecessary to change this file now
There's a problem. With below code
Put cursor at line 6 (start of %mend;), run region, it run whole file. But it should run only the macro region. |
Fixed. |
Type code below, click line 5 and execute 'Run region' through context menu. It should run filename statement only. And now it will run all the code.
|
Fixed. |
All issues have been fixed. |
Summary
Added support for recursive Folding Blocks:
Data in Macro
Proc in Macro
/*region*/ in Data
/*region*/ in Proc
/*region*/ in Macro
Data in /*region*/
Proc in /*region*/
Macro in /*region*/
/*region*/ in /*region*/
Testing
How did you test this change?
Every block shows a folding icon.