# Configuración Completa de Visual Studio Code ## Instalación y Setup Inicial ### Descarga e Instalación 1. Descargar desde [code.visualstudio.com](https://code.visualstudio.com/) 2. Elegir versión estable o Insiders (para features experimentales) 3. Durante instalación: marcar "Add to PATH" y "Add context menu" ### Primera Configuración ```json // settings.json (Ctrl+Shift+P → "Preferences: Open Settings JSON") { "editor.fontSize": 14, "editor.fontFamily": "'JetBrains Mono', 'Fira Code', Consolas, monospace", "editor.fontLigatures": true, "editor.tabSize": 2, "editor.insertSpaces": true, "editor.wordWrap": "on", "editor.lineNumbers": "on", "editor.minimap.enabled": true, "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll": true, "source.organizeImports": true } } ``` ## Extensiones Esenciales ### Productividad General - **GitHub Copilot**: Asistente AI para código - **GitLens**: Supercharge Git capabilities - **Auto Rename Tag**: Sincroniza tags HTML - **Bracket Pair Colorizer**: Colores para brackets - **Path Intellisense**: Autocompletado de rutas - **TODO Highlight**: Resalta TODOs y FIXMEs ### Desarrollo Web - **Live Server**: Servidor local con auto-reload - **REST Client**: Testing de APIs dentro de VS Code - **Debugger for Chrome**: Debug de JavaScript en Chrome - **HTML CSS Support**: Mejor soporte CSS en HTML - **Auto Close Tag**: Cierra tags HTML automáticamente ### Lenguajes Específicos #### JavaScript/TypeScript - **ES7+ React/Redux Snippets**: Snippets para React - **TypeScript Hero**: Organización de imports - **JavaScript (ES6) Snippets**: Snippets ES6+ - **Quokka.js**: Live JavaScript scratchpad #### Python - **Python**: Extensión oficial de Microsoft - **Pylance**: Language server rápido para Python - **Python Docstring Generator**: Genera docstrings automáticamente - **autoDocstring**: Documentación automática #### Java - **Extension Pack for Java**: Pack completo de Microsoft - **Spring Boot Tools**: Soporte para Spring Boot - **Lombok Annotations**: Soporte para Project Lombok - **Gradle for Java**: Soporte para Gradle #### C#/.NET - **C#**: Extensión oficial de Microsoft - **C# Extensions**: Snippets y utilidades adicionales - **Auto-Using**: Imports automáticos - **NuGet Package Manager**: Gestión de paquetes NuGet ## Configuraciones por Lenguaje ### JavaScript/TypeScript ```json { "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.tabSize": 2, "editor.insertSpaces": true }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.tabSize": 2, "editor.insertSpaces": true }, "typescript.suggest.autoImports": true, "javascript.suggest.autoImports": true } ``` ### Python ```json { "[python]": { "editor.defaultFormatter": "ms-python.black-formatter", "editor.tabSize": 4, "editor.insertSpaces": true }, "python.defaultInterpreterPath": "./venv/bin/python", "python.linting.enabled": true, "python.linting.pylintEnabled": true, "python.formatting.provider": "black" } ``` ### Java ```json { "[java]": { "editor.tabSize": 4, "editor.insertSpaces": true, "editor.defaultFormatter": "redhat.java" }, "java.home": "/usr/lib/jvm/java-17-openjdk", "java.configuration.runtimes": [ { "name": "JavaSE-17", "path": "/usr/lib/jvm/java-17-openjdk" } ] } ``` ## Snippets Personalizados ### JavaScript Snippets ```json // javascript.json (Ctrl+Shift+P → "Preferences: Configure User Snippets") { "Console Log": { "prefix": "cl", "body": ["console.log($1);"], "description": "Console log" }, "Arrow Function": { "prefix": "af", "body": ["const $1 = ($2) => {", " $3", "};"], "description": "Arrow function" }, "Try Catch": { "prefix": "tc", "body": [ "try {", " $1", "} catch (error) {", " console.error(error);", "}" ], "description": "Try catch block" } } ``` ### Python Snippets ```json { "Function with docstring": { "prefix": "def", "body": [ "def $1($2):", " \"\"\"$3", " ", " Args:", " $4", " ", " Returns:", " $5", " \"\"\"", " $6" ], "description": "Function with docstring" } } ``` ## Shortcuts Esenciales ### Navegación | Acción | Windows/Linux | macOS | |--------|---------------|-------| | Command Palette | `Ctrl+Shift+P` | `Cmd+Shift+P` | | Quick Open | `Ctrl+P` | `Cmd+P` | | Go to Line | `Ctrl+G` | `Cmd+G` | | Go to Symbol | `Ctrl+Shift+O` | `Cmd+Shift+O` | | Search in Files | `Ctrl+Shift+F` | `Cmd+Shift+F` | ### Edición | Acción | Windows/Linux | macOS | |--------|---------------|-------| | Multi-cursor | `Ctrl+D` | `Cmd+D` | | Select All Occurrences | `Ctrl+Shift+L` | `Cmd+Shift+L` | | Move Line Up/Down | `Alt+↑/↓` | `Option+↑/↓` | | Copy Line Up/Down | `Shift+Alt+↑/↓` | `Shift+Option+↑/↓` | | Comment Toggle | `Ctrl+/` | `Cmd+/` | ### Terminal | Acción | Windows/Linux | macOS | |--------|---------------|-------| | Toggle Terminal | `Ctrl+`` | `Cmd+`` | | New Terminal | `Ctrl+Shift+`` | `Cmd+Shift+`` | | Split Terminal | `Ctrl+\` | `Cmd+\` | ## Configuración de Git ### Git Integration ```json { "git.enableSmartCommit": true, "git.confirmSync": false, "git.autofetch": true, "git.defaultCloneDirectory": "~/projects", "gitlens.hovers.currentLine.over": "line", "gitlens.currentLine.enabled": true, "gitlens.codeLens.enabled": true } ``` ### Configuración de Merge ```json { "merge-conflict.autoNavigateNextConflict.enabled": true, "diffEditor.ignoreTrimWhitespace": false, "git.mergeEditor": true } ``` ## Debugging ### Launch Configuration (launch.json) ```json { "version": "0.2.0", "configurations": [ { "name": "Launch Node.js", "type": "node", "request": "launch", "program": "${workspaceFolder}/app.js", "console": "integratedTerminal" }, { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal" }, { "name": "Java: Current File", "type": "java", "request": "launch", "mainClass": "${file}" } ] } ``` ## Workspace Configuration ### Multi-root Workspace ```json // workspace.code-workspace { "folders": [ { "name": "Frontend", "path": "./frontend" }, { "name": "Backend", "path": "./backend" } ], "settings": { "editor.tabSize": 2 }, "extensions": { "recommendations": [ "esbenp.prettier-vscode", "ms-python.python" ] } } ``` ## Tasks Automation ### tasks.json ```json { "version": "2.0.0", "tasks": [ { "label": "npm install", "type": "shell", "command": "npm install", "group": "build", "presentation": { "echo": true, "reveal": "always", "panel": "new" } }, { "label": "Run Tests", "type": "shell", "command": "npm test", "group": "test", "presentation": { "echo": true, "reveal": "always", "panel": "new" } } ] } ``` ## Themes y Personalización ### Themes Populares - **Dracula Official**: Theme oscuro popular - **One Dark Pro**: Basado en Atom's One Dark - **Material Theme**: Material Design para VS Code - **Night Owl**: Optimizado para developers nocturnos - **Monokai Pro**: Versión mejorada del clásico Monokai ### Icon Themes - **Material Icon Theme**: Icons based on Material Design - **VSCode Icons**: Comprehensive icon theme - **File Icons**: Simple file icons ## Performance Optimization ### Settings para mejor performance ```json { "files.watcherExclude": { "**/node_modules/**": true, "**/.git/**": true, "**/dist/**": true, "**/build/**": true }, "search.exclude": { "**/node_modules": true, "**/bower_components": true, "**/*.code-search": true }, "files.exclude": { "**/.git": true, "**/.DS_Store": true, "**/node_modules": true } } ``` ## Docker Integration ### Docker Extension - **Docker**: Extensión oficial para contenedores - **Remote - Containers**: Desarrollo en contenedores - **Remote - SSH**: Desarrollo remoto via SSH ### Dockerfile Snippets ```dockerfile # Multi-stage build FROM node:16 as builder WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html EXPOSE 80 ``` ## Remote Development ### SSH Configuration ```json { "remote.SSH.remotePlatform": { "myserver": "linux" }, "remote.SSH.configFile": "~/.ssh/config" } ``` ### Dev Containers ```json // .devcontainer/devcontainer.json { "name": "Node.js & TypeScript", "image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:16", "features": { "docker-in-docker": "latest", "git": "os-provided" }, "customizations": { "vscode": { "extensions": [ "esbenp.prettier-vscode", "ms-vscode.vscode-typescript-next" ] } } } ```