VS Code Development Configuration β
VS Code is a lightweight but powerful code editor, very suitable for Gin-Vue-Admin project development. This guide will detail how to configure VS Code for the best development experience.
π Prerequisites β
Before starting configuration, please ensure you have:
- β Installed VS Code
- β Completed Environment Setup
- β Cloned project code to local
π Quick Start β
1. Open Workspace β
It is recommended to use VS Code's workspace feature to manage the entire project:
# Enter project root directory
cd gin-vue-admin
# Open entire project with VS Code
code .Or open the pre-configured workspace file:

2. Workspace Configuration β
Create .vscode/gin-vue-admin.code-workspace file:
{
"folders": [
{
"name": "π§ Server (Go)",
"path": "./server"
},
{
"name": "π¨ Web (Vue)",
"path": "./web"
},
{
"name": "π Docs",
"path": "./docs"
}
],
"settings": {
"go.gopath": "",
"go.goroot": "",
"go.toolsManagement.autoUpdate": true,
"typescript.preferences.importModuleSpecifier": "relative",
"eslint.workingDirectories": ["web"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"extensions": {
"recommendations": [
"golang.go",
"vue.volar",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"ms-vscode.vscode-typescript-next"
]
}
}π Essential Extensions Installation β
Go Development Extensions β
Go (golang.go)
- Official Go language extension
- Provides syntax highlighting, IntelliSense, debugging, etc.
Go Outliner (766b.go-outliner)
- Shows Go file structure outline
Vue Development Extensions β
Vue Language Features (Volar) (vue.volar)
- Official Vue 3 language support
- Replaces Vetur, provides better TypeScript support
TypeScript Vue Plugin (Volar) (vue.vscode-typescript-vue-plugin)
- TypeScript support for Vue files
General Development Extensions β
Prettier - Code formatter (esbenp.prettier-vscode)
- Code formatting tool
ESLint (dbaeumer.vscode-eslint)
- JavaScript/TypeScript code linting
Tailwind CSS IntelliSense (bradlc.vscode-tailwindcss)
- Tailwind CSS IntelliSense
Auto Rename Tag (formulahendry.auto-rename-tag)
- Auto rename paired HTML/XML tags
Path Intellisense (christian-kohler.path-intellisense)
- File path IntelliSense
Install Extensions β
# Install recommended extensions using command line
code --install-extension golang.go
code --install-extension vue.volar
code --install-extension vue.vscode-typescript-vue-plugin
code --install-extension esbenp.prettier-vscode
code --install-extension dbaeumer.vscode-eslint
code --install-extension bradlc.vscode-tailwindcss
code --install-extension formulahendry.auto-rename-tag
code --install-extension christian-kohler.path-intellisenseπββοΈ Run and Debug Configuration β
1. Create Debug Configuration β
Create .vscode/launch.json file in project root directory:
{
"version": "0.2.0",
"configurations": [
{
"name": "π§ Launch Server (Go)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/server/main.go",
"cwd": "${workspaceFolder}/server",
"env": {
"GIN_MODE": "debug"
},
"args": [],
"showLog": true,
"console": "integratedTerminal"
},
{
"name": "π¨ Launch Web (Node)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/web",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "serve"]
}
],
"compounds": [
{
"name": "π Launch Both (Server + Web)",
"configurations": [
"π§ Launch Server (Go)",
"π¨ Launch Web (Node)"
],
"stopAll": true
}
]
}2. Create Tasks Configuration β
Create .vscode/tasks.json file:
{
"version": "2.0.0",
"tasks": [
{
"label": "π§ Build Server",
"type": "shell",
"command": "go",
"args": ["build", "-o", "gin-vue-admin", "main.go"],
"options": {
"cwd": "${workspaceFolder}/server"
},
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
},
{
"label": "π¨ Build Web",
"type": "shell",
"command": "npm",
"args": ["run", "build"],
"options": {
"cwd": "${workspaceFolder}/web"
},
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
},
{
"label": "π Generate Swagger",
"type": "shell",
"command": "swag",
"args": ["init"],
"options": {
"cwd": "${workspaceFolder}/server"
},
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
}
]
}3. Run Project β
Method 1: Using Debug Panel β
- Press
Ctrl+Shift+D(Windows/Linux) orCmd+Shift+D(macOS) to open debug panel - Select the configuration to run:
- π§ Launch Server (Go): Start backend service only
- π¨ Launch Web (Node): Start frontend application only
- π Launch Both (Server + Web): Start both frontend and backend



Method 2: Using Terminal β
# Start backend (in server directory)
cd server
go run main.go
# Start frontend (in web directory)
cd web
npm run serveMethod 3: Using Tasks β
- Press
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) - Type "Tasks: Run Task"
- Select the task to execute
βοΈ Go Environment Configuration β
1. Configure Go Module Proxy β
To improve dependency download speed, it's recommended to configure Go module proxy:
# Enable Go Modules
go env -w GO111MODULE=on
# Configure module proxy
go env -w GOPROXY=https://goproxy.cn,direct
# Configure checksum database
go env -w GOSUMDB=sum.golang.google.cn2. VS Code Go Extension Configuration β
Add the following configuration in VS Code settings:
{
"go.toolsManagement.autoUpdate": true,
"go.useLanguageServer": true,
"go.gocodeAutoBuild": false,
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.buildOnSave": "package",
"go.testOnSave": false,
"go.coverOnSave": false,
"go.formatTool": "goimports",
"go.gotoSymbol.includeImports": true,
"go.gotoSymbol.includeGoroot": true,
"gopls": {
"experimentalWorkspaceModule": true,
"completeUnimported": true,
"usePlaceholders": true,
"deepCompletion": true
}
}3. Install Go Tools β
In VS Code, press Ctrl+Shift+P, type "Go: Install/Update Tools", select all tools to install.
π¨ Frontend Development Configuration β
1. Prettier Configuration β
Create .prettierrc file in web directory:
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 100,
"bracketSpacing": true,
"arrowParens": "avoid"
}2. ESLint Configuration β
Ensure web directory has correct .eslintrc.js configuration file.
3. VS Code Frontend Settings β
{
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.suggest.autoImports": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.workingDirectories": ["web"],
"vetur.validation.template": false,
"vetur.validation.script": false,
"vetur.validation.style": false
}π§ Practical Tips β
1. Code Snippets β
Create Go code snippets .vscode/go.code-snippets:
{
"Gin Handler": {
"prefix": "ginhandler",
"body": [
"// $1 $2",
"// @Tags $3",
"// @Summary $2",
"// @Security ApiKeyAuth",
"// @accept application/json",
"// @Produce application/json",
"// @Success 200 {object} response.Response \"ζε\"",
"// @Router /$4 [$5]",
"func (a *$6Api) $1(c *gin.Context) {",
"\t$0",
"}"
],
"description": "Create a Gin handler with Swagger annotations"
}
}2. Keyboard Shortcuts Configuration β
Add custom keyboard shortcuts in keybindings.json:
[
{
"key": "ctrl+shift+r",
"command": "workbench.action.tasks.runTask",
"args": "π§ Build Server"
},
{
"key": "ctrl+shift+w",
"command": "workbench.action.tasks.runTask",
"args": "π¨ Build Web"
}
]3. File Associations β
Add file associations in settings:
{
"files.associations": {
"*.vue": "vue",
"*.go": "go",
"*.yaml": "yaml",
"*.yml": "yaml"
}
}π Debugging Tips β
1. Go Debugging β
- Click to the left of line numbers to set breakpoints
- Use
F5to start debugging - Use
F10for step over,F11for step into - View variable values in debug console
2. Frontend Debugging β
- Use browser developer tools
- Install "Debugger for Chrome" extension in VS Code
- Configure browser debugging
3. Log Viewing β
- Use integrated terminal to view application logs
- Configure output panel to display different types of logs
π Performance Optimization β
1. Exclude Files β
Exclude unnecessary files in .vscode/settings.json:
{
"files.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/.git": true,
"**/vendor": true
},
"search.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/vendor": true
}
}2. Disable Unnecessary Extensions β
Disable irrelevant extensions in the workspace to improve performance.


