Closed bdm-k closed 3 months ago
Implementation looks fine to me!
I am not sure if this is necessary, but perhaps we should clear all tabstops when this effect is triggered.
Do you mean calling removeAllTabstops
, which is defined in "tabstops_state_field.ts"?
Yeah, exactly.
Could you tell me specifically what other changes I should make?
I'm happy to merge after this is done:
- making this feature toggleable
- organizing the code into a new file
I'm having second thoughts. Isn't it a bit excessive to create a new file since there are only a few lines of code?
Actually, can we check whether context.mode.inlineMath
is true
instead of looking for $
symbols? This would be more semantic as well as robust.
I'm having second thoughts. Isn't it a bit excessive to create a new file since there are only a few lines of code?
That's true; it would be nice for consistency with the other functions/features though. I'll leave it up to you.
Actually, can we check whether
context.mode.inlineMath
istrue
instead of looking for$
symbols? This would be more semantic as well as robust.
In the case of $|$
, context.mode.inlineMath
will be false
. So, we can't determine whether the cursor is inside an empty inline math or entirely outside of an inline math.
Oh, that sounds like unintended behaviour - I'll try to look into it.
When the text is $$
, the syntax tree will be:
Document [1:0..1:2]
└─ formatting_formatting-math_formatting-math-begin_keyword_math_math-block [1:0..1:2]: "$$"
On the other hand, when the text is $x$
, the syntax tree will be:
Document [1:0..1:3]
├─ formatting_formatting-math_formatting-math-begin_keyword_math [1:0..1:1]: "$"
├─ math_variable-2 [1:1..1:2]: "x"
└─ formatting_formatting-math_formatting-math-end_keyword_math_math- [1:2..1:3]: "$"
In the first case, no node contains "math-end" in its name, so context.mode.inlineMath
will be false
. Therefore, we must directly look for $
symbols.
Okay, I'll go ahead and merge this then. Thank you!
Closes #266
If the implementation looks good, I'd like to proceed with the next steps, such as: