How can we make Microsoft Teams better?

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)

3,043 votes
Sign in
Sign in with: Facebook Google
Signed in as (Sign out)

We’ll send you updates on this idea

Nils Ree shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Comments are closed
  • Jono commented  ·   ·  Flag as inappropriate

    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.

  • Max Bigras commented  ·   ·  Flag as inappropriate

    Snippets is the only feature I can see on a glance Slack has that teams doesn't but it's also very important for the developer workflow. If you get snippets it will be much easier for me to sell it to people on my team

  • Manuel Marhold commented  ·   ·  Flag as inappropriate

    Support for code snippets for different languages like c#, xml and SQL. And it would be great to have this in the OneNote documents as well.

  • Richard Song commented  ·   ·  Flag as inappropriate

    @Suphatra - Thank you so much for accelerating the prioritization of this feature! It would be great if this feature could automatically format the syntax to make the code snippets more readable. Furthermore, it would be even more beneficial to have some sort of syntax highlighting, especially for languages related to Microsoft (C# && F#).

    We often write and share code so that other humans can read it. I think it would provide tremendous value if you could shave a few seconds off each copy and paste by correctly formatting the code snippets and highlighting definitions. I think a great example is the "Peek definition" feature in Visual Studio 2017. I would love it if we could directly copy and paste the highlighting and formatting of that "peek definition" into Teams.

  • Emil Gerth commented  ·   ·  Flag as inappropriate

    Just make this work like a normal markdown editor: three ticks and an optional language to start, three ticks at the end to close.

    Existing code snippet functionality is counter-intuitive. Don't give me a new sub-editor, let me type my message. I still haven't figured out how to get out of that sub-editor, since typing another 3 ticks (as you would in actual Markdown) doesn't work.

  • Caleb Meyer commented  ·   ·  Flag as inappropriate

    In github flavored markdown, you can specify which syntax the snippet is with a name after the opening three backticks:

    $(function() {
    alert('document is ready');
    for example would be highlighted as javascript.

    Note also that a lot of the current markdown formatting happens on the fly, and that leads to weird edge cases (like if you go back to edit a code block you can't then add anything after the code block). It would be nice if this was not highlighted until after the message was sent.

  • Phil Britton commented  ·   ·  Flag as inappropriate

    Markdown supports three back ticks, so if that works like GitHub this should be fine. Love the idea of runnable code, but not necessary.

  • Anonymous commented  ·   ·  Flag as inappropriate

    I work at a 5,000 employee software company and this is the only thing that is preventing us from using Teams rather than Hipchat.

  • Zane commented  ·   ·  Flag as inappropriate

    Hello! Currently working on a matrix comparing Teams to Slack. When is the ETA for this capability?

  • Jon commented  ·   ·  Flag as inappropriate

    This really should have been in the product from day 1. Hope it's coming really soon otherwise we won't be using it.

  • Jonathon Wyza commented  ·   ·  Flag as inappropriate

    Ideally this should support the standard methods like:

    public class Test {
    public string ARealString { get;set;}

    And then you end up with a nicely syntax highlighted code block. Slack, Discord, Github, and pretty much every other markdown client in the world handles this just fine. Teams should too.

  • Jamie Thomson commented  ·   ·  Flag as inappropriate

    As an aside, I've noticed that pasting from an IDE (PyCharm in my case) preserves formatting. Not as good as what this uservoice submission is asking for, but its better than nothing.

  • Anonymous commented  ·   ·  Flag as inappropriate

    @Jamie Thomson, you lose all the nice syntax colors if you use three back ticks. slack and hip chat handle this much nicer

  • Jamie Thomson commented  ·   ·  Flag as inappropriate

    We now have Markdown, which supports code snippets (I just tried it - three back ticks - works great). So this can be closed, right?

Feedback and Knowledge Base

You are about to visit the UserVoice site for Microsoft Teams

We have partnered with UserVoice, a 3rd party service providing public discussion forums for product-specific feedback.

By clicking "Continue to UserVoice" you agree to UserVoice's Privacy Policy and Terms of Use.