-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Language server agnostic snippets #4611
Comments
One example use-case is authoring HTML embedded in a string/template within another language. By default, Sublime maps Ctrl+W to an 'insert tag' snippet which makes this very easy and provides a consistent workflow across languages. |
Hi, when will this happen? |
Is there any ongoing work on this feature? Would be happy to join/support here |
is this implement? how to add custom snippets in zed like we in vscode javascript.json? |
+1 for requesting this feature. It's a huge time saver! |
A very important feature for me is |
I want to switch fully to Zed for Go projects and this feature prevents me from switching. |
Heads up everybody, we're most likely going to deprecate snippets extension and bring it directly into core Zed editor. That way they'll work with all languages out of the box and extensions will be able to provide their own snippets. |
Thank you! Can you make sure snippets work with Plain Text files too. I have a shortcut I like to use with Markdown and Plain Text but as of right now I can only use it in .md files because .txt files don’t seem to work with agnostic snippets. |
Mmm was anything dropped in the last update? My snippets - that were working - now won't work anymore. 🤔 Files are saved with a syntax selected where it was already working but now it doesn't. Am I insane? |
@osiewicz Thanks! Works like a charm on the latest preview release
But it's a bit unclear how to name the snippet file especially when there is whitespace in the language name. For example,
|
Plaintext using agnostic snippets now works in the latest Preview! This is awesome. Thanks team! |
I tried using the snippets but the dont work at all |
I created a pretty small document for getting started with configuring snippets here. Ill add documentation on how to bundle snippets via an extension soon. I think we likely have a bit more work to do to make snippets discoverable and easily editable, but the core is all in place, so I think I will close out this issue. Feel free to open up new issues for feature requests about snippets. If you need help building something out, please do so in our Q&A Discussions section |
Thank you. This is a perfect start. I’m loving Snippets in Zed. |
Same here, I have javascript.json and typescript.json saved on the zed/snippets folder, and it doesn't work. I must say I'm using the example snippets from the doc https://zed.dev/docs/snippets#snippets |
as this code , you need write |
I imagine you already have a file called markdown.json stored in zed/snippets. In my case, I´m trying to get snippets for .ts and .tsx files doing the same. I have a typescript.json and typescriptreact.json files in that folder. Then, when I write the prefix on a file with the extension .ts or .tsx, nothing happens. The autocomplete menu doesn´t offer me the snippet. What I´m doing wrong? |
lol, why? then, i donot know, lol. |
I can confirm that it is working for javascript & typescript files using the (javascript.json,typescript.json) files. Still doesn't work for React Native files with the typescriptreact.json |
then you can use snippets.json, that will works in all files |
I think this small question might just help me climb to the top of the hit list, lol. Is there a way to set the order of the items in the snippet pop-up? edit: |
That's my main problem too right now. My snippets don't end up first and I can't get it there. At first I thought if I repeatedly used them, there would be a "preference" ranking, but to no avail. |
Thanks @huhu415, this works like a charm!!! |
Is this possible now in zed latest version? |
can we use filename as variable when defining snippets. for example: in vscode I used to type "slr" and it created a component with the filename. |
I copied a snippet from VS code containing this that didn't work in zed. It would be nice if this was supported too.
|
Tried adding a |
This would be great! Any info on whether extensions can also have theur own settings.json that has precedence on the global one in case there is a clashy? (priority should be: global lowest, extension hogher, then project highest) |
For me, there were no snippets available due to syntax errors. Zed just fails silently. Via command prompt, open "zed: open log". There should be some kind of Snippet error. |
anyone misunderstood the ~/.config like i do? a simpler way to target the correct directory is CMD + shift + p, then type |
Lol I just pasted a vscode snippet for Golang in And when I command CMD + shift + p and select snippets and select Golang I'm moved in the snippet file: But Zed doesn't see new snippets :( OS: arch linuxZed: 0.171.6What do you think, guys? |
Check for existing issues
Describe the feature
Other editors have the ability to define snippet without setting up in the LSP. For example, one can still define snippets for editing plain text files and that does not require user to setup initialization options of a LSP. (And we don't generally have a LSP for plain text files.)
Also some snippets might shared across different file types/LSPs.
If applicable, add mockups / screenshots to help present your vision of the feature
The text was updated successfully, but these errors were encountered: