This blog is part of a series on Teams. For more articles, check back often.
Written: 17/08/2019 | Updated: N/A
For anyone that doesn’t know what a snippet is – a snippet is a programming term for a small region of re-usable source code, machine code, or text. It looks like this
A developer or another member of the Team may want to periodically share snippets for review, to pass them on for others to use or to articulate examples of the solutions they have used previously. However, in Teams snippets can’t simply be cut and pasted into the conversation bar as they do not render correctly. Typing them out manually is one solution which works – but in most cases like needing to share multiple snippets or a large snippet this turns out to be rather impractical and time consuming.
Is there an easy way to achieve this?
WHY WOULD WE DO IT?
- To share code snippets with the Team
The following is required
- Teams Licence
Usually within a Microsoft 365 subscription. A user does not need to be an owner.
2.) In Teams, go to the Channel you want to add the snippet to, then to the conversations Tab. Select the formatting icon below the conversation bar which looks like an A with a brush beside it
3.) Select Code Snippet (</>)
4.) Paste the code in, set the code type in the upper right hand box and give the code a title in the upper left. Once done, select insert
5.) Give the message a title, add anything else you need such as instructions or commentary and then select Send (Arrow) in the bottom right
6.) Our job here is done. Our code snippet has been shared with the rest of the Team
Will Microsoft release simple cut and paste of code into the conversation tab which will render correctly in the future?
The answer is – maybe! Other apps do this when cut and pasted. If you feel strongly that this is something you would like to see, then an option is to raise for the functionality via Teams Uservoice (https://microsoftteams.uservoice.com/forums/555103-public). Another is to feed back directly via the Teams client which was a feature introduced recently. This may have already been raised to the Teams development Team. Whilst, in my personal opinion, the above took all of thirty seconds to achieve and there are probably more pressing features to work on, I would also say that I’m not a developer or work with code snippets every day so others would be better placed than I am to judge the urgency of it.