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

Support non-alphanumeric characters in snippet prefixes #16740

Open
1 task done
bitfield opened this issue Aug 23, 2024 · 0 comments
Open
1 task done

Support non-alphanumeric characters in snippet prefixes #16740

bitfield opened this issue Aug 23, 2024 · 0 comments
Labels
enhancement [core label] popovers Feedback for tooltips, syntax hints, info popups, toasts, etc snippets

Comments

@bitfield
Copy link

Check for existing issues

  • Completed

Describe the feature

I'd like to be able to define snippets whose prefixes include non-alphanumeric characters. This is supported by VS Code, and I use it to define a "smart quotes" snippet, for example:

 {
  "smart quotes": {
    "prefix": "\"\"",
    "body": ["“$1”"]
  },
}

Thus, typing two " characters in the buffer inserts a pair of matched curly quotes, and leaves the cursor inside them to enter some quoted text.

A little experimentation with Zed suggests that, while prefixes can contain non-alphanumeric characters, as soon as you type that character in the editor, the suggested completion disappears. For example, if you define this snippet:

{
  "test snippet": {
    "prefix": "a@",
    "body": "this is the snippet"
  },
}

and you type a in the editor, the suggested a@ completion is displayed, and you can complete it with Tab/Enter, but if you instead type @, the completion disappears and is no longer available. That means you can't complete a snippet whose prefix begins with a non-alphanumeric character, for example.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@bitfield bitfield added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Aug 23, 2024
@notpeter notpeter added popovers Feedback for tooltips, syntax hints, info popups, toasts, etc snippets and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] popovers Feedback for tooltips, syntax hints, info popups, toasts, etc snippets
Projects
None yet
Development

No branches or pull requests

2 participants