Code snippets
I would like code snippets with highlighting based on code language. And for snippets longer than X lines, a "show more" button (like slack)

This feature request has been completed and is available to the public. Thank you for the suggestion and feedback!
-Warren
128 comments
Comments are closed-
Anonymous commented
Status?
-
Jonathon Wyza commented
Snippets would be good for larger code pastes. (and pasting in general). Not quite a file that needs to be downloaded, but not necessarily something that goes into a full chat message. Though those should be syntax highlighted too.
-
Pieter Van Parys commented
Embedding your own editor (VSCode editor) https://github.com/Microsoft/monaco-editor would be very nice!
-
Anonymous commented
@Ilya, at 200 lines you should be pasting that in a text file instead of a chat message...
IMO, I would much rather see other features implemented before syntax highlighting. With plain code snippets we can get by, but other things such as compact views, meeting integrations, etc should take precedence. However, this would be a very nice feature.
-
Ilya Ratner commented
I think a clone of Slack would be great as far as code snippets are concerned. You should also consider allowing for longer messages. For instance, I tried pasting in a 200 line JSON string, and it said the message was too long. Maybe the longer strings can just apply to code snippets, and maybe they automatically get thrown into a code snipped tab for quick review of all Team, or PM conversations.
-
John Keiser commented
It's worth pointing out the way Github Flavored Markdown does this, as it's pretty widespread: you do three backquotes followed by the language if you want to tell it which language to highlight. https://help.github.com/articles/creating-and-highlighting-code-blocks/
-
David Cheeseman commented
We are currently migrating to Office 365 and this is a huge feature request from our staff already. Hope it's implemented soon!
-
Jon commented
Sorry if this was already mentioned but having option to show line numbers, specified line numbers. Basically being able to reference the line numbers from the code file itself so that the code is displayed like a screenshot.
If possible that would be a nice option. -
Brydon DeWitt commented
Runnable snippets was mentioned and I'd just like to second that - I think it would give you a bit of an edge. Something like StackOverflow's snippets or JSFiddle, but it might also be nice to be able to extend that functionality to non web code too. Maybe via a later feature like plugins/extensions - if that's a possibility.
-
Jim Peluso commented
It should allow for full pasting of code, it should recognize the code being pasted. It should have line numbers and be in a readable format.
-
R. Emre Basar commented
Please keep it simple and just have it with GFM
-
Anonymous commented
Extensibility and customizability matter.
-
matshe@microsoft.com commented
Two things:
(1) Wish that you could just insert a code snippet and then see people's cursors on it, type together and quickly debug a code snippet like you could if it was in Google Docs. Co-coding like this is not ideal for big things, but would be awesome for quick debugs / seeing obvious issues. Build it out like this: https://microsoftteams.uservoice.com/forums/555103-public/suggestions/18720472-enable-3rd-party-interactive-canvases-for-real-ti. Could enable ability to see beginning state from end state and mark as green-check-fixed.
(2) We own Visual Studio: Look at what we could easily internalize into Microsoft Teams with colorization, intellisense, etc. in a lightweight way.
-
Dave Scott commented
another vote for standardization around the GitHub flavor of markdown
-
Will Green commented
Just implement GitHub flavored markdown, complete with the fenced code blocks specifying the language. I'm sure there's more than a couple libraries on multiple platforms out there that do this already.
-
matshe@microsoft.com commented
We own Visual Studio: Be sure to look at what we could easily internalize into Microsoft Teams with colorization, intellisense, etc. in a lightweight way.
Also, though you'd need to make sure to maintain history (problem, solution), snippets are, in my opinion, a rare place where you could actually implement a 'Google Docs' of coding where you could actually show multiple cursors at once. Shoot someone a message and watch as they can fix code right inline in front of you. Show a green check once fixed and make it easy to see the original issue with comments in a module underneath...
Oh, how I wish we'd just go the route of doing cola.io type interactive...it would be so much more powerful than fluffy inserts. :(
-
Nikita commented
Suphatra, it would be great if standard markdown code preformatting could be used, for example:
```html
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
``` -
Jonathon Wyza commented
Follow Github's example: https://help.github.com/articles/creating-and-highlighting-code-blocks/
-
Vishal Seth commented
In-house we often make use of GeSHi - https://en.wikipedia.org/wiki/GeSHi for syntax highlighting in our apps.
-
Jono commented
I'd love to see some sort of integration with VSCode. Perhaps snippets could have an "Open in Code" option, or better yet a configurable editor. Formatting and coloring based on language chosen is a must.