You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rule:
kind: keyword_argumentregex: (?i)(?:\{id\}|\{.+_id\}|\{.+\.id\})inside:
pattern: ObjectName.increment_counter($$$)stopBy: end
π Actual behavior
The start and end lines for all json output are off by one. I am using a VS Code task with a problem matcher to display squiggly lines when ast-grep finds an error, but the squiggly lines currently show up on the wrong line because of this.
β ast-grep scan shows the correct start line and column (3:3)
β ast-grep scan --format github shows the correct start and end lines (line=3,endLine=5)
β ast-grep scan --json=stream lines off by one ({start: {line: 2}, end: {line:4}})
β ast-grep scan --json=pretty lines off by one ({start: {line: 2}, end: {line:4}})
β ast-grep scan --json=compact lines off by one ({start: {line: 2}, end: {line:4}})
π Expected behavior
I expect the start and end lines in the json output to be the same as those from other output formats.
β ast-grep scan --json=stream should show ({start: {line: 3}, end: {line:5}})
β ast-grep scan --json=pretty should show ({start: {line: 3}, end: {line:5}})
β ast-grep scan --json=compact should show ({start: {line: 3}, end: {line:5}})
The text was updated successfully, but these errors were encountered:
okay that's fair, we were trying this because the vs code extension doesn't work on my teams codebase right now. but, that's unrelated to this repo, so I'll just open an issue on the vs code extension repo
β― Playground Link
Playground link with relevant code
π» Code
Code:
Pattern:
π Actual behavior
The start and end lines for all json output are off by one. I am using a VS Code task with a problem matcher to display squiggly lines when ast-grep finds an error, but the squiggly lines currently show up on the wrong line because of this.
ast-grep scan
shows the correct start line and column (3:3)ast-grep scan --format github
shows the correct start and end lines (line=3,endLine=5)ast-grep scan --json=stream
lines off by one ({start: {line: 2}, end: {line:4}}
)ast-grep scan --json=pretty
lines off by one ({start: {line: 2}, end: {line:4}}
)ast-grep scan --json=compact
lines off by one ({start: {line: 2}, end: {line:4}}
)π Expected behavior
I expect the start and end lines in the json output to be the same as those from other output formats.
ast-grep scan --json=stream
should show ({start: {line: 3}, end: {line:5}}
)ast-grep scan --json=pretty
should show ({start: {line: 3}, end: {line:5}}
)ast-grep scan --json=compact
should show ({start: {line: 3}, end: {line:5}}
)The text was updated successfully, but these errors were encountered: