Visual Studio Code (VSCode) is a lightweight but powerful source code editor that runs on your desktop. It comes with built-in support for JavaScript, TypeScript, and Node.js and has a rich ecosystem of extensions for other languages and tools.
Table of Contents
- InstallationFirst Launch and Interface OverviewEssential SettingsExtensionsWorkspace SetupKeyboard ShortcutsIntegrated TerminalSource Control IntegrationDebuggingAdditional Resources
Installation
Windows
- Visit the VSCode download pageClick on the Windows download buttonRun the installer (.exe file)Follow the installation wizardCheck the options to:
- Create a desktop iconAdd “Open with Code” to Windows Explorer context menuRegister Code as an editor for supported file types
macOS
- Visit the VSCode download pageClick on the Mac download buttonOpen the downloaded .zip fileDrag Visual Studio Code.app to the Applications folderOptional: Add VSCode to your Dock
Linux
- Visit the VSCode download pageChoose the appropriate package for your distribution (.deb, .rpm, etc.)For Debian/Ubuntu:
- For Red Hat/Fedora:
First Launch and Interface Overview
When you first open VSCode, you’ll see:
- Welcome Page: Contains quick links to common commands and recent projectsActivity Bar: Left sidebar with icons for different views:
- Explorer: File browserSearch: Find and replaceSource Control: Git integrationRun and Debug: Debug panelExtensions: Manage extensions
Essential Settings
Access settings by:
- Windows/Linux: File > Preferences > SettingsmacOS: Code > Preferences > Settings
Recommended settings to consider:
- Theme:
- File > Preferences > Color Theme (or Ctrl+K Ctrl+T)Popular choices: Dark+, Light+, Monokai, Solarized
- Auto Save:
- Tab Size:
- Formatting:
Extensions
VSCode’s power comes from its extensions. To install extensions:
- Click the Extensions icon in the Activity Bar (or press Ctrl+Shift+X)Search for extensions by nameClick Install
Essential extensions by category:
General
- Prettier – Code formatter: Consistent code formatting
- ESLint: JavaScript linting
- EditorConfig: Maintain consistent coding styles
Languages
- Python: Full Python support
- C/C++: C and C++ intellisense, debugging
- Java Extension Pack: Java development tools
- JavaScript (ES6) code snippets: Snippets for JavaScript
Themes
- Material Theme: Popular theme pack
- One Dark Pro: Atom’s iconic theme
Productivity
- GitLens: Supercharge Git capabilities
- Live Share: Collaborative editing
- Path Intellisense: Autocomplete filenames
Workspace Setup
A workspace in VSCode represents one or more folders that are opened in an editor window.
- Open a folder: File > Open Folder (Ctrl+K Ctrl+O)Save workspace: File > Save Workspace As…
- Workspace settings: Create a .vscode folder in your project with:
- settings.json: Project-specific settingslaunch.json: Debugging configurationstasks.json: Build task configurationsextensions.json: Recommended extensions
Example settings.json for a JavaScript project:
Keyboard Shortcuts
VSCode has many keyboard shortcuts. Here are the most essential ones:
- Ctrl+P: Quick Open, Go to FileCtrl+Shift+P: Show Command PaletteCtrl+Space: Trigger suggestionF12: Go to DefinitionAlt+F12: Peek DefinitionShift+Alt+F: Format documentF5: Start debuggingCtrl+`: Toggle terminalCtrl+B: Toggle sidebarCtrl+/: Toggle line commentCtrl+K Ctrl+C: Add line commentCtrl+K Ctrl+U: Remove line comment
Integrated Terminal
VSCode includes an integrated terminal:
- Open terminal: View > TerminalMultiple terminals: Click the plus iconSwitch terminals: Use the dropdown
Source Control Integration
VSCode has built-in Git support:
- Initialize repository: Click the Source Control icon and “Initialize Repository”Stage changes: Click the + next to modified filesCommit changes: Enter a message and press Ctrl+EnterPush/Pull: Use the ellipsis menu (…) for additional Git commandsVisual diff: Click on a modified file to see changes
Debugging
Set up debugging for your project:
- Create a launch configuration:
- Click the Run and Debug iconClick “create a launch.json file”Select your environment
Additional Resources
- Official DocumentationVSCode Tips and TricksVSCode YouTube ChannelVSCode Keyboard Shortcuts Reference
The post Visual Studio Code Setup Guide appeared first on MarkTechPost.