Skip to content

Introduce VSCode rust debug type. #5369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions editors/code/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

227 changes: 225 additions & 2 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Programming Languages"
],
"engines": {
"vscode": "^1.44.1"
"vscode": "^1.46.0"
},
"enableProposedApi": true,
"scripts": {
Expand All @@ -45,7 +45,7 @@
"@types/mocha": "^7.0.2",
"@types/node": "~12.7.0",
"@types/node-fetch": "^2.5.7",
"@types/vscode": "^1.44.1",
"@types/vscode": "^1.46",
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"eslint": "^7.3.1",
Expand All @@ -63,10 +63,233 @@
"onCommand:rust-analyzer.analyzerStatus",
"onCommand:rust-analyzer.memoryUsage",
"onCommand:rust-analyzer.reloadWorkspace",
"onDebugInitialConfigurations",
"onDebugDynamicConfigurations:rust",
"onDebugResolve:rust",
"workspaceContains:**/Cargo.toml"
],
"main": "./out/src/main",
"contributes": {
"breakpoints": [
{
"language": "rust"
}
],
"debuggers": [
{
"type": "rust",
"label": "Rust (preview)",
"languages": [
"rust"
],
"configurationAttributes": {
"launch": {
"properties": {
"oneOf": [
{
"required": [
"program"
]
},
{
"required": [
"cargo"
]
}
],
"cargo": {
"description": "Cargo options.",
"command": {
"enum": [
"run",
"test",
"bench"
],
"default": "run"
},
"args": {
"type": "array",
"items": {
"type": "string"
},
"default": []
},
"env": {
"description": "Environment variables to add to the environment for the cargo only. Example: { \"VAR\": \"VALUE\" }.",
"type": "object",
"patternProperties": {
".*": {
"type": "string"
}
},
"default": {}
},
"required": [
"command"
]
},
"program": {
"type": "string",
"description": "Full path to program executable."
},
"args": {
"type": "array",
"description": "Command line arguments passed to the program. In case of `cargo` launch this is the arguments after `--`.",
"items": {
"type": "string"
},
"default": []
},
"cwd": {
"type": "string",
"description": "The working directory of the target.",
"default": "${workspaceFolder}"
},
"env": {
"description": "Environment variables to add to the environment for the program. Example: { \"VAR\": \"VALUE\" }.",
"type": "object",
"patternProperties": {
".*": {
"type": "string"
}
},
"default": {}
},
"envFile": {
"type": "string",
"description": "Absolute path to a file containing environment variable definitions. This file has JSON with key value pairs and optional mask.",
"default": "${workspaceFolder}/.vscode/env.json"
},
"debugEngineSettings": {
"type": "object",
"default": {},
"description": "Optional settings passed to the underlying debug engine. E.g. { \"cppvsdbg\": { \"logging\":{ \"moduleLoad\": false } } } }"
}
}
}
},
"configurationSnippets": [
{
"label": "Rust: Main binary",
"body": {
"type": "rust",
"request": "launch",
"name": "${1:Run main binary}",
"cargo": {
"command": "run"
}
}
},
{
"label": "Rust: All tests",
"body": {
"type": "rust",
"request": "launch",
"name": "${1:Run all tests}",
"cargo": {
"command": "test"
}
}
},
{
"label": "Rust: Example",
"body": {
"type": "rust",
"request": "launch",
"name": "${2:Run example}",
"cargo": {
"command": "run",
"args": [
"--example",
"${1:Example name}"
]
}
}
},
{
"label": "Rust: Specified binary",
"body": {
"type": "rust",
"request": "launch",
"name": "${2:Run binary}",
"cargo": {
"command": "run",
"args": [
"--bin",
"${1:Binary name}"
]
}
}
},
{
"label": "Rust: Library unit tests",
"body": {
"type": "rust",
"request": "launch",
"name": "${1:Run unit tests}",
"cargo": {
"command": "test",
"args": [
"--lib"
]
}
}
},
{
"label": "Rust: Specified binary tests",
"body": {
"type": "rust",
"request": "launch",
"name": "${2:Run binary tests}",
"cargo": {
"command": "test",
"args": [
"--bin",
"${1:Binary name}"
]
}
}
},
{
"label": "Rust: Specified library unit test",
"body": {
"type": "rust",
"request": "launch",
"name": "${2:Run unit test}",
"cargo": {
"command": "test",
"args": [
"--lib"
]
},
"args": [
"${1:Test name}",
"--nocapture"
]
}
},
{
"label": "Rust: Specified integration test",
"body": {
"type": "rust",
"request": "launch",
"name": "${3:Run integration test}",
"cargo": {
"command": "test",
"args": [
"--bin",
"${1:Binary name}"
]
},
"args": [
"${2:Test name}",
"--nocapture"
]
}
}
]
}
],
"taskDefinitions": [
{
"type": "cargo",
Expand Down
Loading