question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code Snippet enhancements

See original GitHub issue

Detailed description

Describe in detail the issue you’re having. Is this a feature request (new component, new icon), a bug, or a general issue?

Feature request.

Is this issue related to a specific component?

Code Snippet.

What did you expect to happen? What happened instead? What would you like to see changed?

Feedback from Adam Lankford & Co.

  • Would be nice to fix the scroll bar on the terminal snippet (horizontal scroll, can it be vertical)?
  • Some teams are interested in using the “light” code snippet, but have the sizing be similar to the Terminal snippet. Can we remove the max-height on the light code block?

What offering/product do you work on? Any pressing ship or release dates we should be aware of?

Containers / Kubernetes.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:38 (38 by maintainers)

github_iconTop GitHub Comments

3reactions
tay-aitkencommented, Apr 11, 2018

Final Designs

The final designs for the code snippet revamp include:

  • Terminal Snippet (single line)
  • Code Snippet (multi-line)
  • Inline code

All of the following designs should use Plex Mono

Terminal Snippet

Functions the same as the previous terminal snippet (can only scroll horizontally), just getting a visual update.

height:56px; width: 600px border: solid 1px #DFE3E6 (ui-03) background-color: #fff (ui-01)

terminal-snippet

Code Snippet

  • Once the user clicks the ‘show more’ ghost button the hight of the code snippet expands to show all content contained within the code snippet
  • Can only scroll horizontally, vertical scroll is not needed since component expands to full content size
  • Added a ‘show more’ and ‘show less’ button
  • visual updates, color and sizing

height:56px; width: 250px border: solid 1px #DFE3E6 (ui-03) background-color: #fff (ui-01) code-snippet

Inline Code (new)

  • the text size for the snippet will vary based off the body copy size it is in. If this is not possible let me know and we can revaluate.

height: 22px; width: varies based on content background-color: F4F7FB; corner-radius: 4px; padding: 0 4px;

inline-code

Important Notes

  • Line numbers and syntax highlighting
    • will be in the documentation and will not be included in the actual code of the component
    • will point to open source versions for numbers and highlighting
    • CodePen will be used as an example to show how the numbers and highlighting will be applied; will be linked in the documentation
    • line numbers will look like this

line-numbers

  • In a future, for next breaking change release, we want to change the names of the components as follows:
    • terminal snippet > single line snippet
    • code snippet > multi-line snippet
1reaction
joshblackcommented, Apr 10, 2018

Could we do a percentage for the text size since there are different text sizes used across the platform?

Percentage is definitely possible, and it would be relative to the parent element’s font size 👍

What are the best practices for a code snippet?

  • is it bad to break a line? (worried about having both horizontal and vertical scrolling)

Honestly the only two requirements I look for are:

  1. Easy to copy
  2. Has syntax highlighting for the language I’m viewing

For the line break stuff, it’s definitely not bad to break a line. Typically editors support this as an option in their editor. If someone has the line wrap option on, then some character on screen represents that the line has wrapped.

For example the carriage return character (might have to open it up to view the character):

screen shot 2018-04-10 at 3 29 58 pm

Which of the options above do you prefer?

Option 4 for inline 👍 Really only because the blocks don’t touch when the line above or below has a code snippet as well, and visually it seems like the smaller font is more inline than the larger ones.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Snippets - MadCap Flare's Online Help
You can create and insert code into documentation in dozens of languages. The syntax is automatically highlighted according to the language, similar to...
Read more >
Rush Snippets - Key Features and New Enhancements ...
Rush Snippets adds missing dependent imports to the top of the file, if needed, to support the code in the expanding code snippet....
Read more >
Using Source Editor Enhancements in Visual Studio*
Code snippet insertion lets you insert a prototype construct (such as DO , WHILE , or MODULE ) from a list. Use the...
Read more >
Enhancements to your code review workflow
Enhancements to your code review workflow ... They also now support Markdown and rich content, like code snippets.
Read more >
Feature enhancement for snippets: copy existing snippet
This can be helpful when you want to use an existing snippet as a starting point for a new one, or when you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found