The Studio has a tab where you can add code snippets on your local machine (with a very small amount of code snippets already present).
It would be nice to build a library of code snippets on the community site to perform a variety of tasks like using a Resultset, sending a mail, sending a httpRequest, using try-catch-throw error handling etc.
And this set of code-snippets (approved by the community) could then make it in the Studio (or VsCode) to help new (and old) developers to quickly add code. (With new releases or with an import facility to load them manually)
Thank you for submitting the idea. The status has been changed to "Community Opportunity".
Stay tuned!
This idea is the 🌟 Community award winner of the 1st InterSystems Idea-A-Thon
https://openexchange.intersystems.com/package/oex-vscode-snippets-template implements snippet sharing for VS Code users by leveraging Open Exchange, InterSystems Package Manager, and GitHub templates. It's my entry in the 2023 Grand Prix contest, so please consider giving it one of your votes.
@Danny Wijnschenk, thank you for your idea. VSCode has this feature, and the idea will not be implemented for Studio, because Studio is deprecated.
https://community.intersystems.com/post/intersystems-studio-deprecated-starting-20232
Hi Evegeny,
Code snippets should work also in Studio, a lot of developers are still using it, it is the only editor that ships with Iris and Caché, and so it should be a universal library that can be uploaded in VSCode AND Studio.
On DC, there is no way to discuss code snippets, vote a code snippet as 'best practice', put it in a library for viewing and upload it to VSCode and Studio.
Don't we have it already on the DC?
I think the code snippets library it's a feature of VSCode, no?
It is a great idea, like all other ideas I've heard from Danny W.
The snippets ecosystem could be a section in the developers community where we can add & discuss snippets.
When a snippet is considered a 'best practice', it will make it into a snippet library that can be used on its own (for documentation/viewing/copy-paste purposes), published in VSCode, and appear in Studio via a next release or via an import feature.
By the way, there are a lot of code examples found in documentation that could be integrated in this code snippets ecosystem e.g. https://docs.intersystems.com/irisforhealth20221/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_propstream#GOBJ_propstream_interface_readwrite)
@Danny There are several comments on your idea. Please answer, and this will attract additional attention to your idea.
@Brett There is a question for you below, could you please answer it? Thanks
For example here is a set of one-line snippets that community helped to collect: https://openexchange.intersystems.com/package/isc-one-liners. How can any of this be added as a VSCode snippet? Do we have an example?
I'd like to see a snippets ecosystem grow, perhaps with the most popular / highly-rated ones progressing to built-in ones. See https://code.visualstudio.com/docs/editor/userdefinedsnippets for how users can already write their own and the share them, either as JSON fragments for copy/paste or by publishing their own snippet extensions. There's also the Extension Packs feature which would enable snippet extensions to be bundled.
@Brett, are there any samples of such code snippets?
I'll add to Brett's comment, if anyone wants to create more snippets for the VS Code IDE, I'd be more than happy to help you get started.
This is already possible in VS Code. See the extension's CONTRIBUTING.md for guidance on how to open a pull rquest that adds new snippets.