Skip to content

Commit

Permalink
fix: proc python auto-indent
Browse files Browse the repository at this point in the history
  • Loading branch information
scnwwu committed Jan 24, 2025
1 parent f2d06d3 commit fdfedae
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions server/src/sas/FormatOnTypeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,32 @@ export class FormatOnTypeProvider {
curToken.style === Lexer.TOKEN_TYPES.MKEYWORD ||
curToken.style === Lexer.TOKEN_TYPES.MSKEYWORD
) {
if (
curToken.style === Lexer.TOKEN_TYPES.KEYWORD &&
curTokenText.toUpperCase() === "SUBMIT"
) {
const block = this.syntaxProvider.getFoldingBlock(
curLine,
curIndex,
true,
true,
true,
);
if (block) {
const tokens = this.syntaxProvider.getSyntax(block.startLine);
const procName = this.model.getText({
start: { line: block.startLine, column: tokens[2].start },
end: { line: block.startLine, column: tokens[3].start },
});
if (
tokens[2].style === Lexer.TOKEN_TYPES.PROCNAME &&
procName.toUpperCase() === "PYTHON"
) {
// python code must start from the first column
return -curIndent;
}
}
}
if (
curTokenText.toUpperCase() === "DATA" ||
curTokenText.toUpperCase() === "PROC" ||
Expand Down

0 comments on commit fdfedae

Please sign in to comment.