DEV Community

Cover image for My Visual Studio Code Setup
Ali Spittel
Ali Spittel

Posted on • Updated on • Originally published at zen-of-programming.com

My Visual Studio Code Setup

I love the text editor setup I've been using for the past year and a half, so I want to show off my setup! Visual Studio Code has far surpassed my experiences with Atom, Spyder, Sublime Text, Emacs, and Idle (the built-in Python editor) which I used for the years before it. I thought I would do a quick write up on my setup and the extensions I love!

Theme

Since I teach people how to code professionally and give a lot of talks on programming, having a readable theme is super important to me. I also love to have a theme that I enjoy aesthetically, so usually something with a lot of girly colors.

Those criteria being set, my two absolute favorite themes are Fairy Floss and Dracula.

Fairy Floss

Fairy Floss

Dracula

Dracula

Font

I am a long-term FiraCode loyalist (pre-dating VS Code!); I like the ligatures that make my code more readable at a glance. It's pretty easy to set up too, which is really nice!

The Fira Code Font

Save Configuration

Another key piece of my setup is my save configuration. The first thing that I love is autosave, which you can turn on via the file drop-down. I have it further configured so that whenever I pause when writing code, my code is saved automatically without me doing anything. I cannot explain how helpful this is for live coding and for beginners.

// in settings.json
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 100,
Enter fullscreen mode Exit fullscreen mode

In the same vein, I have Prettier set up to format my code on cmd + s. Ideally, this would run automatically as well, but it is close enough for now. I used StandardJS to do the same for a while, before moving over to a pro-semi-colon client.

// in settings.json
"editor.formatOnSave": true,
Enter fullscreen mode Exit fullscreen mode

I use two spaces for most language indentation, the only exception is Python, where I use four spaces by default.

// in settings.json
"[python]": {
    "editor.insertSpaces": true,
    "editor.tabSize": 4
},
Enter fullscreen mode Exit fullscreen mode

Emmet

I am incredibly reliant on Emmet, so I love that it is built in for VS Code. I also have it set up to work in more than just my html files:

// in settings.json
"emmet.includeLanguages": {
  "html": "html",
  "erb": "erb",
  "javascript": "javascriptreact",
  "vue": "html",
  "ejs": "html"
},
Enter fullscreen mode Exit fullscreen mode

Integrated Terminal

I use iTerm with Zsh on my Mac, and so I have VS Code's integrated terminal set up to use that setup.

// in settings.json
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "zsh",
Enter fullscreen mode Exit fullscreen mode

Extensions

I have a lot of language and framework-specific extensions built-in, which are boring and very dependent on the developer, so I will skip over those in order to discuss some of my favorite all-purpose extensions.

  1. VS Live Share - this extension is straight up magical, and I truly believe it will change code education and pair programming in the near future. It allows developers to Google Doc-style collaborate on the same file on different computers. You can even open up access to your localhost ports across machines and share terminal sessions. There are some bugs, especially on Windows machines, but it's so cool that it doesn't even matter!

  2. Code Spell Checker - I write a lot of Markdown and page content directly in my text editor, and I definitely have some spelling issues. I love this extension for underlining my mistakes and offering suggestions, even when I'm offline.

  3. Import Cost - this one is more a "nice to have" rather than a necessary, but it shows the size of the npm packages I am importing in my projects.

  4. HTMLHint - I use this for live HTML validation directly in my editor. No more having to run the W3C validator on every change!

  5. GitLens - GitLens shows Git blame annotations and author highlighting within documents. Its really helpful for working on multi-author projects!

  6. CodeRunner - this extension allows you to press a play button to run your code directly within VSCode with no terminal interaction needed! Especially helpful for new programmers.

  7. EmojiSense - I love Slack's emoji-autofill post : feature, and this extension allows you to do the same in VSCode!

Conclusion

I am really happy with my setup -- I have no complaints! Feel free to tweet me any questions about my setup, and also send me your favorite tips and tricks!

If you like setup posts, I also wrote about my Zsh + iTerm2 setup.

If you liked this article, check out my full blog or subscribe to my Friday weekly wrap up!

Top comments (61)

Collapse
 
lexlohr profile image
Alex Lohr

There are 3 other essentials for me:

  • Bracket Pair Colorizer (never search longer than a few seconds for a missing bracket again)
  • EditorConfig for VS Code
  • Git History + Git Tags (which means that VS Code + console git are my default git client)

Otherwise, nice article and solid setup.

Collapse
 
curiouslychase profile image
Chase Adams

Good list of extensions (and some good additions)β€” the extension that I've found essential when working with other people is the "Open in Github" extension. It works for any VCS backed website (like gitlab, bitbucket, etc) and makes it really easy to copy/pasta the line number so someone can check out what I'm talking about in the browser.

Collapse
 
aspittel profile image
Ali Spittel

Ah awesome! I had Bracket Pair Colorizer at one point, and I recommend it to my students, but the colors are a bit off from my themes which annoys me haha.

Collapse
 
lexlohr profile image
Alex Lohr

You can define the colors matching your theme using the bracketPairColorizer.consecutivePairColors configuration. The default is

"bracketPairColorizer.consecutivePairColors": [
    "()",
    "[]",
    "{}",
    [
      "Gold",
      "Orchid",
      "LightSkyBlue"
    ],
    "Red"
  ]

which matches very few themes :)

Collapse
 
walkhard13 profile image
Phillip Smith

+1 for EditorConfig

Collapse
 
droidmakk profile image
Afroze Kabeer Khan. M • Edited

Fira Code + Font Litigatures enabled 😎😎.
Use settings sync and bracket colorizer. Also material icon theme πŸ€—

Collapse
 
blint profile image
Ibrohim Hanafi

Same, i also use them.

Collapse
 
jhossyd3v profile image
Jhossymar Contreras

I went to install those ones too, I love these kind of posts

Collapse
 
dance2die profile image
Sung M. Kim • Edited

That's a nice setup. I like Fairy Floss particularly much πŸ‘.

And a tip if you use CodeSandBox.
You can use your own VS code Theme in CodeSandBox.

cs

I was able to get Wes Bos's Cobalt2 theme working there 😎

Collapse
 
dance2die profile image
Sung M. Kim • Edited

I loved the theme so much that I wanted it on CodeSandBox.
So wrote a post about how to do it 😎

Collapse
 
kayis profile image
K

This is pretty awesome!

I'll definitly use the Dracula theme :D

Also, some of the extensions are pretty rad.

If you're using Python, you may be interested in indent-rainbow

indent-rainbow

Collapse
 
tuanlv5490 profile image
Tuan Luu • Edited

Thanks! indent-rainbow for Python so cool :D

Collapse
 
angieg0nzalez profile image
Angelica Gonzalez

Love your setup! Those are my two favorite themes too, I switch back and forth depending on my mood/time of day. Definitely going to be adding spellchecker and html hint to my setup. Thanks for the recs!

Collapse
 
sheafitzek profile image
Shea Fitzek

You might be interested in the Save and Run extension, which is a fork of Run on Save, to auto run Prettier for you. It allows you to configure multiple commands that run when a file is saved based on a regexp. One of my favorite uses for it is to run a bash script that auto-generates a TOC for my README at every autosave.

Collapse
 
aspittel profile image
Ali Spittel

So cool!

Collapse
 
toby profile image
toby

Nice setup!I have some of those and a few more:
'Better comments' is good for improving syntax colours with most themes. 'Overtype' makes the insert key work correctly. 'Settings sync' allows you to sync your settings and plugins across instances using a private GitHub gist - this is AWESOME!

Also, setting 'window.titleBarStyle' to "custom" in the latest version gives you a bit cleaner interface on Windows.

Further, instead or reaching settings by ctrl+shift+p then Preferences: open settings, replace that last bit with Preferences: open settings (Preview) for a nicer settings interface :)

Collapse
 
jaydeepkarena profile image
Jaydeep Karena

window.titleBarStyle is beautiful, just loved it. I always want big space for my code.

Collapse
 
maciekchmura profile image
Maciek Chmura

I love Dracula too. Check out quokkajs.com/ for quick testing code snippets :D

Collapse
 
aspittel profile image
Ali Spittel

That is so cool!

Collapse
 
bmanthejedi profile image
B.Manchester

Hi! Thanks for sharing, I'm excited to try some of the extensions I read about in your post and in the comments. To add to the list, I use an extension called Settings Sync that I find super useful to keep my settings, extensions, and key maps across multiple machines...well, in sync.

marketplace.visualstudio.com/items...

Collapse
 
randyhudson profile image
randyhudson

Regarding indenting with two spaces, is that so others can’t customize the indentation for a wider monitor, or because you like pressing backspace twice instead of once? Do you also double space your code? I prefer to use the Medium Mathematical Space character for indents, which is easy to type using ALT+205F

Collapse
 
sloan profile image
Sloan the DEV Moderator

Hey, we consider this comment to be unproductive. Please consider a more constructive and considerate approach next time. You can consult the code of conduct for further clarification.

Collapse
 
mindlace profile image
Ethan Fremen

Wait, you prefer to use something that is neither a tab nor a space for indentation? And you consider typing 4 characters to be simpler than typing space twice (or tab once, if you have vscode set up right)?

I find it challenging to believe this is your actual practice.

Collapse
 
dominicduffin1 profile image
Dominic Duffin

I think that is an unnecessarily dismissive comment.

Collapse
 
aspittel profile image
Ali Spittel

I actually type in tabs, but use my text editor to convert to spaces!

Collapse
 
shreyasminocha profile image
Shreyas Minocha

There's a preference to enable tabstops. It removes indentation with a single backspace.