Skip to content
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

Fixed Live Snippet Cursor Steps out of Parentheses #385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

josiahnross
Copy link

Closes #384

I don't know what the purpose of the removed lines was. It seems like they were there to compensate for the additional characters added by the replacement however I found that vscode handled the cursor placement fine on its own. So instead of fixing a problem, these lines were creating an issue by moving the cursor forward after the snippet has been inserted. This often led to the cursor being moved outside of parentheses and even the math mode entirely which was quite annoying to deal with

@leoleoasd
Copy link
Collaborator

Can you make sure that this works with other snippets? As I'm not the one who wrote this, it would take me a while to figure out what this does either.

@josiahnross
Copy link
Author

It works with all snippets I have tested it on which include the following (these work in a variety of math modes (inline, align environment, etc):

  • auto subscript
  • whitespace before operators
  • whitespace after operators
  • ...
  • implies
  • fractions
  • not equal
  • aligned equal
  • approx
  • greater than or equal to
  • times
  • cdot
  • pi
  • overline
  • hat
  • partial derivative
  • sqrt
  • exists
  • definite integral
  • plus minus

Copy link

@grepgrok grepgrok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell from the API, editBuilder.replace above simply deletes whatever text is in the range and then inserts the string. This doesn't seem to affect the positioning of the cursor; that is to say, the cursor maintains its position relative to the rest of the text. Since the cursor isn't really moving, there should be no need to manually move it. So, these lines should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Live Snippet Cursor stepts out of paranthesis
3 participants