Visual Studio Code is one of the most popular code editors for web development. Its flexibility, rich plugin ecosystem, and powerful features make it an indispensable tool for developers. In this article, we’ll look at the best plugins, settings, and techniques for maximizing productivity in web development.
Why Proper VS Code Setup Matters
A properly configured VS Code setup can significantly improve developer productivity. A well-configured editor can help you:
- Write code faster
- Improve code quality
- Simplify debugging
- Automate routine tasks
- Ensure code consistency across the team
Essential Plugins for Web Development
JavaScript and TypeScript
ESLint:
// settings.json
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}Prettier:
// settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.singleQuote": true,
"prettier.trailingComma": "es5"
}JavaScript (ES6) code snippets:
// Примеры сниппетов
// clg → console.log()
// clr → console.clear()
// clo → console.log('object :>> ', object)HTML and CSS
HTML CSS Support:
// settings.json
{
"html.autoClosingTags": true,
"html.autoCreateQuotes": true,
"css.validate": true,
"less.validate": true,
"scss.validate": true
}CSS Peek:
- Lets you quickly jump to CSS class definitions
- Shows a preview of styles
- Supports SCSS, LESS, SASS
HTML Snippets:
<!-- Примеры сниппетов -->
<!-- html5 → HTML5 boilerplate -->
<!-- meta → meta tags -->
<!-- link → link tags -->React and Vue.js
ES7+ React/Redux/React-Native snippets:
// Примеры сниппетов для React
// rfc → React Functional Component
// rcc → React Class Component
// rccp → React Class Component with PropTypes
// rccs → React Class Component with StateVetur (for Vue.js):
// settings.json
{
"vetur.validation.template": true,
"vetur.validation.script": true,
"vetur.validation.style": true,
"vetur.format.defaultFormatter.html": "prettier",
"vetur.format.defaultFormatter.js": "prettier"
}Productivity Plugins
Autocomplete and IntelliSense
Tabnine:
- AI-powered code completion
- Supports many programming languages
- Learns from your code
GitHub Copilot:
// Пример использования Copilot
// Напишите комментарий, и Copilot предложит код
// "функция для валидации email"
function validateEmail(email) {
const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return regex.test(email);
}IntelliSense for CSS class names:
// settings.json
{
"css.validate": false,
"less.validate": false,
"scss.validate": false
}Code Navigation
Bracket Pair Colorizer 2:
// settings.json
{
"bracket-pair-colorizer-2.colors": [
"#f44336",
"#2196F3",
"#FF9800",
"#4CAF50"
]
}Path Intellisense:
- Autocompletes file paths
- Supports relative and absolute paths
- Works with various file extensions
Auto Rename Tag:
- Automatically renames paired HTML tags
- Works with JSX and Vue templates
Git Integration
GitLens:
// settings.json
{
"gitlens.codeLens.enabled": true,
"gitlens.hovers.enabled": true,
"gitlens.blame.format": "${author}, ${agoOrDate}"
}Git History:
- View the change history of files
- Compare versions
- Visualize changes
Git Graph:
- Visual representation of the Git graph
- Branch management
- View commits
Debugging Plugins
JavaScript Debugging
Debugger for Chrome:
// launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome against localhost",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}Debugger for Firefox:
// launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Firefox",
"type": "firefox",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}Profiling
Performance Profiler:
- Analyze JavaScript performance
- Identify bottlenecks
- Get optimization recommendations
Testing Plugins
Unit Testing
Jest:
// settings.json
{
"jest.autoRun": {
"watch": false,
"onSave": "test-file"
},
"jest.showCoverageOnLoad": true
}Mocha Test Explorer:
- Run Mocha tests
- View results
- Debug tests
E2E Testing
Cypress Helper:
- Integrates with Cypress
- Run tests from VS Code
- View results
Documentation Plugins
JSDoc
JSDoc Comment:
/**
* Валидирует email адрес
* @param {string} email - Email для валидации
* @returns {boolean} - Результат валидации
*/
function validateEmail(email) {
const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return regex.test(email);
}Document This:
- Automatically generates JSDoc comments
- Supports TypeScript
- Customizable templates
Markdown
Markdown All in One:
// settings.json
{
"markdown.extension.toc.levels": "1..6",
"markdown.extension.toc.orderedList": true,
"markdown.extension.preview.breaks": true
}Markdown Preview Enhanced:
- Enhanced preview
- Supports diagrams
- Export to various formats
Workspace Setup
Workspace Settings
// .vscode/settings.json
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.rulers": [80, 120],
"editor.wordWrap": "bounded",
"editor.minimap.enabled": false,
"editor.suggestSelection": "first",
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.acceptSuggestionOnEnter": "on",
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
}
}Task Configuration
// .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "npm install",
"type": "shell",
"command": "npm install",
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
},
{
"label": "npm run dev",
"type": "shell",
"command": "npm run dev",
"group": "build",
"isBackground": true,
"problemMatcher": {
"pattern": {
"regexp": "^$"
},
"background": {
"activeOnStart": true,
"beginsPattern": "Starting development server",
"endsPattern": "Local:"
}
}
}
]
}Launch Configuration
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
},
{
"name": "Attach to Chrome",
"type": "chrome",
"request": "attach",
"port": 9222,
"webRoot": "${workspaceFolder}/src"
}
]
}Keyboard Shortcuts
Essential Commands
// keybindings.json
[
{
"key": "ctrl+shift+p",
"command": "workbench.action.showCommands"
},
{
"key": "ctrl+p",
"command": "workbench.action.quickOpen"
},
{
"key": "ctrl+shift+f",
"command": "workbench.action.findInFiles"
},
{
"key": "ctrl+shift+o",
"command": "workbench.action.gotoSymbol"
},
{
"key": "f12",
"command": "editor.action.revealDefinition"
},
{
"key": "alt+f12",
"command": "editor.action.peekDefinition"
},
{
"key": "shift+f12",
"command": "editor.action.goToReferences"
}
]Custom Keyboard Shortcuts
// keybindings.json
[
{
"key": "ctrl+alt+c",
"command": "editor.action.commentLine",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+u",
"command": "editor.action.transformToUppercase",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+l",
"command": "editor.action.transformToLowercase",
"when": "editorTextFocus"
}
]Task Automation
Snippets
// snippets/javascript.json
{
"Console log": {
"prefix": "clg",
"body": [
"console.log($1);"
],
"description": "Console log"
},
"Function": {
"prefix": "func",
"body": [
"function ${1:functionName}($2) {",
"\t$3",
"}"
],
"description": "Function declaration"
},
"Arrow function": {
"prefix": "arrow",
"body": [
"const ${1:functionName} = ($2) => {",
"\t$3",
"};"
],
"description": "Arrow function"
}
}User Snippets
// snippets/react.json
{
"React Functional Component": {
"prefix": "rfc",
"body": [
"import React from 'react';",
"",
"const ${1:ComponentName} = () => {",
"\treturn (",
"\t\t<div>",
"\t\t\t$2",
"\t\t</div>",
"\t);",
"};",
"",
"export default ${1:ComponentName};"
],
"description": "React Functional Component"
}
}Advanced Settings
Multi-root Workspaces
// workspace.code-workspace
{
"folders": [
{
"name": "Frontend",
"path": "./frontend"
},
{
"name": "Backend",
"path": "./backend"
},
{
"name": "Shared",
"path": "./shared"
}
],
"settings": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"extensions": {
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-next"
]
}
}Remote Development
// settings.json для Remote SSH
{
"remote.SSH.defaultExtensions": [
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
],
"remote.SSH.configFile": "~/.ssh/config"
}Performance Monitoring
Extension Performance
// settings.json
{
"extensions.autoUpdate": false,
"extensions.autoCheckUpdates": false,
"extensions.ignoreRecommendations": true
}Memory Usage
# Проверка использования памяти
code --statusBest Practices
1. Organizing Plugins
- Group plugins by category
- Disable plugins you don’t use
- Update plugins regularly
2. Workspace Setup
- Use workspace-specific settings
- Configure tasks for automation
- Create custom snippets
3. Keyboard Shortcuts
- Learn the standard keyboard shortcuts
- Create custom key combinations
- Use the Command Palette
4. Debugging
- Configure debuggers for different browsers
- Use breakpoints effectively
- Apply watch expressions
5. Git Integration
- Configure GitLens for better integration
- Use built-in Git commands
- Configure blame and history
Conclusion
A properly configured VS Code setup can significantly improve a web developer’s productivity. Choosing suitable plugins, setting up your workspace, and learning keyboard shortcuts can speed up the development process and improve code quality.
Key points to remember:
- Choose plugins thoughtfully - don’t install everything
- Set up your workspace to suit your needs
- Learn keyboard shortcuts for quick navigation
- Use snippets to automate tasks
- Configure debugging for effective development
- Update plugins and settings regularly
By following these recommendations, you can create a highly effective VS Code development environment tailored to your needs and working style.