Sharing code snippets #298
Replies: 3 comments 2 replies
-
Discord seems better suited for this task. Last week I created a discord server (AnWeber/httpyac#704) => https://discord.gg/eTc4MyRh6P Otherwise, I agree with your opinion that snippets do not necessarily come from the extension, but are best created by the user for their needs. But I already provide some (inital snippets](https://github.com/AnWeber/vscode-httpyac/blob/main/snippets/http.json), but we can improve them. MR are welcome. |
Beta Was this translation helpful? Give feedback.
-
I noticed these. I'd like to do a MR, but I'd need to make sure I do not have coding mistakes (I validated the snippet functionality, i.e. tabbing, selections, etc.), but I'm not sure my selection options are all valid. |
Beta Was this translation helpful? Give feedback.
-
On second thought, I should probably keep this one private because it has code that may not be generic enough. My idea was to try to force people to think about standards and do their APIs in the standard and consistent manner, but I am testing a third party REST API as I write this, and you would not belive how non-sensical some of the APIs from "industry leaders" can be (e.g. using POST to get or update records). But for internal work, I want to standardize: use appropriate method, meaningful HTTP response codes, standar-based errors, etc, so I have more in my snippets than a general user may want to have. It's fine for project-based snippets, since you can fine tune them for the project requirements, but as a global collection, I would probably pass. Could be a good option for sharing on Discord, though. |
Beta Was this translation helpful? Give feedback.
-
I am helping my team migrate to httpYac and one thing I found useful is code snippets. Since we're moving from Postman, where you just fill out form properties for a request and here you need to type in everything by hand (which is a plus IMHO, but some people need to get used to it), having available code snippets at their fingertips is a must. It would be nice if there were some sort of community exchange place where people could share the things they find useful (if not on GitHub, maybe at Discord? I haven't thought it through, but it would be nice to help user help each other on some platform).
Anyway, here is my first attempt (and I'm not an expert at this point, so there may be some errors, if something does not work or can be improved, please let me know, and feel free to share yours):
This is a file I add to the
.vscode
folder of the project. I named the filehttp.code-snippets
but it can be named anything, just keep the .code-snippets
extension. Also, make sure it's not ignored in the.gitignore
settings, so it can be checked into a repo and shared with everyone working on the project. To invoke a code snippet, type###
or??
followed byCTRL+SPACE
, then select the snippet from the pop-up menu.Beta Was this translation helpful? Give feedback.
All reactions