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,044 votes
Sign in
(thinking…)
Password icon
Signed in as (Sign out)

We’ll send you updates on this idea

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

128 comments

Comments are closed
  • 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.

  • Michael Safro commented  ·   ·  Flag as inappropriate

    This is a priority for our team, as there were requests by few of the members of the team. Please implement!

  • 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:

    ```javascript
    $(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:

    ```csharp
    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.

  • Jamie Thomson commented  ·   ·  Flag as inappropriate

    Anonymous, you're right. Improvements are required to their markdown support. I take back my earlier comment.

  • 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?

  • Anonymous commented  ·   ·  Flag as inappropriate

    @Tim Friesen I'm sorry but that's not good enough. This has been here for 4 months now and it is one of the most requested features at yet it's still not in progress? This is ridiculous.

Feedback and Knowledge Base