添加构建调试
This commit is contained in:
		@@ -1,31 +1,57 @@
 | 
				
			|||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
 | 
					 | 
				
			||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	"name": "Rust",
 | 
						"name": "Rust",
 | 
				
			||||||
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
 | 
					 | 
				
			||||||
	"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
 | 
						"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Features to add to the dev container. More info: https://containers.dev/features.
 | 
						// 先构建项目,但不自动运行
 | 
				
			||||||
	// "features": {},
 | 
						"postStartCommand": "cargo build && clear",
 | 
				
			||||||
	"postStartCommand": "cargo run",
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Configure tool-specific properties.
 | 
					 | 
				
			||||||
	"customizations": {
 | 
						"customizations": {
 | 
				
			||||||
		// Configure properties specific to VS Code.
 | 
					 | 
				
			||||||
		"vscode": {
 | 
							"vscode": {
 | 
				
			||||||
			"settings": {},
 | 
								"settings": {},
 | 
				
			||||||
			"extensions": [
 | 
								"extensions": [
 | 
				
			||||||
				"streetsidesoftware.code-spell-checker"
 | 
									"streetsidesoftware.code-spell-checker",
 | 
				
			||||||
 | 
									"rust-lang.rust-analyzer",  // 添加 Rust 语言支持
 | 
				
			||||||
 | 
									"vadimcn.vscode-lldb"       // 添加 LLDB 调试器支持
 | 
				
			||||||
 | 
								],
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								// 添加调试配置
 | 
				
			||||||
 | 
								"debug": {
 | 
				
			||||||
 | 
									"configurations": [
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											"type": "lldb",
 | 
				
			||||||
 | 
											"request": "launch",
 | 
				
			||||||
 | 
											"name": "Debug Rust Application",
 | 
				
			||||||
 | 
											"program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}",
 | 
				
			||||||
 | 
											"args": [],
 | 
				
			||||||
 | 
											"cwd": "${workspaceFolder}",
 | 
				
			||||||
 | 
											"preLaunchTask": "cargo-build"
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									]
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								// 添加构建任务
 | 
				
			||||||
 | 
								"tasks": {
 | 
				
			||||||
 | 
									"tasks": [
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											"type": "cargo",
 | 
				
			||||||
 | 
											"command": "build",
 | 
				
			||||||
 | 
											"problemMatcher": [
 | 
				
			||||||
 | 
												"$rustc"
 | 
				
			||||||
 | 
											],
 | 
				
			||||||
 | 
											"group": "build",
 | 
				
			||||||
 | 
											"label": "cargo-build"
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				]
 | 
									]
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
						// 转发应用端口(根据你的实际端口修改)
 | 
				
			||||||
	// "forwardPorts": [],
 | 
						"forwardPorts": [8080],
 | 
				
			||||||
 | 
						"portsAttributes": {
 | 
				
			||||||
	// Use 'postCreateCommand' to run commands after the container is created.
 | 
							"8080": {
 | 
				
			||||||
	// "postCreateCommand": "rustc --version",
 | 
								"label": "Rust Application",
 | 
				
			||||||
 | 
								"onAutoForward": "notify"
 | 
				
			||||||
	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
 | 
							}
 | 
				
			||||||
	// "remoteUser": "root"
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										7
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,3 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    "version": "0.2.0",
 | 
					    "version": "0.2.0",
 | 
				
			||||||
    "configurations": [
 | 
					    "configurations": [
 | 
				
			||||||
@@ -17,7 +16,11 @@
 | 
				
			|||||||
                    "kind": "bin"
 | 
					                    "kind": "bin"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "args": []
 | 
					            "args": [],
 | 
				
			||||||
 | 
					            // 添加环境变量解决文件锁问题
 | 
				
			||||||
 | 
					            "env": {
 | 
				
			||||||
 | 
					                "CARGO_REGISTRIES_CRATES_IO_PROTOCOL": "sparse"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								.vscode/task.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								.vscode/task.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "version": "2.0.0",
 | 
				
			||||||
 | 
					    "tasks": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "label": "cargo-clean-build",
 | 
				
			||||||
 | 
					            "type": "process",
 | 
				
			||||||
 | 
					            "command": "cargo",
 | 
				
			||||||
 | 
					            "args": [
 | 
				
			||||||
 | 
					                "build",
 | 
				
			||||||
 | 
					                "--bin=hello_remote_world",
 | 
				
			||||||
 | 
					                "--package=hello_remote_world"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "group": "build",
 | 
				
			||||||
 | 
					            "problemMatcher": ["$rustc"],
 | 
				
			||||||
 | 
					            "presentation": {
 | 
				
			||||||
 | 
					                "echo": true,
 | 
				
			||||||
 | 
					                "reveal": "always",
 | 
				
			||||||
 | 
					                "focus": false,
 | 
				
			||||||
 | 
					                "panel": "shared",
 | 
				
			||||||
 | 
					                "showReuseMessage": true,
 | 
				
			||||||
 | 
					                "clear": false
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
[package]
 | 
					[package]
 | 
				
			||||||
name = "hello_remote_world"
 | 
					name = "hello_remote_world"
 | 
				
			||||||
version = "0.1.0"
 | 
					version = "0.1.0"
 | 
				
			||||||
authors = ["VS Code <vscode@microsoft.com>"]
 | 
					edition = "2021"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[lib]
 | 
					[lib]
 | 
				
			||||||
path ="./src/lib/lib.rs"
 | 
					path ="./src/lib/lib.rs"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user