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
This form trips up the statement range provider when the cursor is on 3 + 3, as it causes the cursor to jump down to 4 + 4, thinking that that is the next line of code to execute. The sequence of events is something like:
We find 3 + 3 and use that as our code to execute
The statement range provider code in Positron moves down 1 line to the newline still within the chunk, and executes the statement range provider again to find where to put the cursor
Because we are still in an R chunk, quarto gives us the R virtual doc and we jump down to 4 + 4 as the next line to execute
Notably, if you remove the newline after 3 + 3 this problem doesn't occur, because in the 2nd bullet from above when we move down 1 line we step out of the R chunk, so on the quarto side we aren't in an R virtual doc anymore, and Ark doesn't even get a chance to provide a statement range. That ends up putting us on the triple backtick line of the chunk, which is actually good behavior.
To fix the problem of jumping the cursor from one chunk to the next, I think Quarto's virtual docs should have an option to request that the virtual doc ONLY contain the current chunk, rather than all of them for that language. That would look like this
Opening this in Positron, because we will likely make the PR to Quarto's vs code extension.
See also quarto-dev/quarto#436
Currently, Quarto's virtual docs include all of that language's chunks in the document. For example, with a Quarto doc like this:
The virtual doc when your cursor is in the first chunk looks like this
This form trips up the statement range provider when the cursor is on
3 + 3
, as it causes the cursor to jump down to4 + 4
, thinking that that is the next line of code to execute. The sequence of events is something like:3 + 3
and use that as our code to execute4 + 4
as the next line to executeNotably, if you remove the newline after
3 + 3
this problem doesn't occur, because in the 2nd bullet from above when we move down 1 line we step out of the R chunk, so on the quarto side we aren't in an R virtual doc anymore, and Ark doesn't even get a chance to provide a statement range. That ends up putting us on the triple backtick line of the chunk, which is actually good behavior.To fix the problem of jumping the cursor from one chunk to the next, I think Quarto's virtual docs should have an option to request that the virtual doc ONLY contain the current chunk, rather than all of them for that language. That would look like this
So now at
3 + 3
we'd move to the newline, but we'd see that there is no code to execute after that and we'd just stay on that line.I imagine there may be other language features that could also benefit from tightly scoping the virtual doc to just the current chunk.
The text was updated successfully, but these errors were encountered: