-
Notifications
You must be signed in to change notification settings - Fork 11
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
[bug] ask_format() eats a line #87
Comments
Indeed, looks like the range of the returned formatting response includes the next line as well: {
newText = 'print("this should be formatted")\n',
range = {
["end"] = {
character = 0,
line = 11
},
start = {
character = 0,
line = 9
}
}
} The root cause is that the treesitter node that contains the code chunk content appears to always include the next line as well, e.g. |
The above linked commit / PR fixes this by simply decrementing the end_row of the node range and I have not encountered any issues so far. |
* fix: decrement end line number of code content node range by 1 (#88) fix: decrement end line number of code content node range by 1. fix #87. testing: add R chunk to qmd example testing: add norg example testing: add ts example testing: document debug-example script * feat: handle leading whitespace * fix: rename, backward invert logic * everything works, but it's a little messy * fix: add nil check * add more language support and informative error * small things --------- Co-authored-by: Jannik Buhr <17450586+jmbuhr@users.noreply.github.com>
When formatting code in a markdown cell with the Lua language server like:
The result is:
I also see this in
norg
files where the@end
that delimits the end of a code cell is removed.The text was updated successfully, but these errors were encountered: