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

$TM_SELECTED_TEXT overtyping not functioning as expected in snippets for latex files #170588

Closed
Walker-Xin opened this issue Jan 4, 2023 · 6 comments · Fixed by #171981
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders languages-basic Basic language support issues snippets verified Verification succeeded
Milestone

Comments

@Walker-Xin
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • Version: 1.74.2 (user setup)
  • Commit: e8a3071
  • Date: 2022-12-20T10:29:14.590Z
  • Electron: 19.1.8
  • Chromium: 102.0.5005.167
  • Node.js: 16.14.2
  • V8: 10.2.154.15-electron.0
  • OS: Windows_NT x64 10.0.22621
  • Sandboxed: No

Steps to Reproduce:

  1. Create a snippet for latex that uses $TM_SELECTED_TEXT. The following is an example that wraps selected text in auto-sized brackets:
"big ()": {
   	"prefix": ["lr"],
   	"body": [
   		"\\left( $TM_SELECTED_TEXT \\right)",
   	],
   	"description": "Begin auto-sized braket"
 },
  1. Type 'lr' over a selected text and hit TAB. The selected text is not included in the output.

Animation

  1. Using F1 + Insert Snippet, however, produces the desired output.

I have only encountered the problem in latex environment, including inline math in markdown files.

The issue was raised in #167364 and was fixed in 1.73 update via #165871 (I think). But came back in 1.74.

@Walker-Xin Walker-Xin changed the title $TM_SELECTED_TEXT overtyping not functioning as expected in latex files $TM_SELECTED_TEXT overtyping not functioning as expected in snippets for latex files Jan 4, 2023
@jrieken jrieken added the bug Issue identified by VS Code Team member as probable bug label Jan 20, 2023
@jrieken jrieken added the languages-basic Basic language support issues label Jan 20, 2023
@jrieken
Copy link
Member

jrieken commented Jan 20, 2023

The problem is the latex word definition which requires two characters to be typed... This is what happens

  • overtyping happens, we capture the overtyped text, and "await" the next suggest session to start
  • this doesn't happen because suggest only auto starts at word ends and a single character is no word
  • the next character is typed, erasing the overtyped, captured value
  • suggest starts because the 2nd character makes this a word

@alexr00 looping you in here and wonder if you know why such a word definition was chosen and if it can be changed

@alexr00
Copy link
Member

alexr00 commented Jan 23, 2023

I don't know why the definition specifies 2 characters. I'm not familiar enough with latex to know if there's a reason for it. Given that no other language does this I would be fine to remove it.

@jrieken
Copy link
Member

jrieken commented Jan 23, 2023

+1 for changing the word definition. FYO @jlelong who originally added this via 0e52a75

jrieken added a commit that referenced this issue Jan 23, 2023
@vscodenpa vscodenpa added the unreleased Patch has not yet been released in VS Code Insiders label Jan 23, 2023
@vscodenpa vscodenpa added this to the January 2023 milestone Jan 23, 2023
jrieken added a commit that referenced this issue Jan 23, 2023
@jrieken jrieken added the author-verification-requested Issues potentially verifiable by issue author label Jan 23, 2023
@jlelong
Copy link
Contributor

jlelong commented Jan 24, 2023

I confirm that changing the word definition to 1 character is fine.

@vscodenpa vscodenpa added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jan 24, 2023
@vscodenpa
Copy link

This bug has been fixed in the latest release of VS Code Insiders!

@Walker-Xin, you can help us out by commenting /verified if things are now working as expected.

If things still don't seem right, please ensure you're on version 0a6c277 of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

Happy Coding!

jlelong added a commit to jlelong/vscode-latex-basics that referenced this issue Jan 24, 2023
jlelong added a commit to James-Yu/LaTeX-Workshop that referenced this issue Jan 24, 2023
@mjbvz mjbvz added verified Verification succeeded and removed verified Verification succeeded labels Jan 25, 2023
@Walker-Xin
Copy link
Author

Walker-Xin commented Jan 26, 2023

/verified

@vscodenpa vscodenpa added verified Verification succeeded and removed author-verification-requested Issues potentially verifiable by issue author labels Jan 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders languages-basic Basic language support issues snippets verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants