mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-03 19:37:39 +03:00
Debugging (#7332)
* launch.json CLI debug that bypasses webpack I got a bit irritated in my edit-build-debug inner loop with the time to run webpack. This commit adds a new launch target called "Pyright CLI (pyright-internal)" which bypasses webpack and just runs the package straight from the packages/pyright-internal/out directory where tsc has built it. * fix outFiles directive The VSCode docs say about outFiles: > By default, VS Code will search your entire workspace, excluding node_modules, for sourcemaps. In large workspaces, this search might be slow. You can configure the locations where VS Code will search for source maps by setting the outFiles attribute in your launch.json. I guess this is the right change to make? it didn't make any difference in VSCode debugger's ability to hit breakpoints, though. --------- Co-authored-by: Eric Traut <eric@traut.com>
This commit is contained in:
parent
f7e37d51b9
commit
c0fbb93ee4
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
@ -16,6 +16,21 @@
|
|||||||
"${workspaceRoot}/packages/pyright/dist/**/*.js"
|
"${workspaceRoot}/packages/pyright/dist/**/*.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Pyright CLI (pyright-internal)",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/packages/pyright-internal/debug.js",
|
||||||
|
"args": [
|
||||||
|
"--typeshedpath",
|
||||||
|
"${workspaceRoot}/packages/pyright-internal/typeshed-fallback",
|
||||||
|
"--version",
|
||||||
|
],
|
||||||
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceRoot}/packages/pyright-internal/out/**/*.js"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Pyright tests",
|
"name": "Pyright tests",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
|
@ -32,7 +32,7 @@ To install in VS Code, go to the extensions panel and choose “Install from VSI
|
|||||||
|
|
||||||
## Debugging Pyright
|
## Debugging Pyright
|
||||||
|
|
||||||
To debug pyright, open the root source directory within VS Code. Open the debug sub-panel and choose “Pyright CLI” from the debug target menu. Click on the green “run” icon or press F5 to build and launch the command-line version in the VS Code debugger.
|
To debug pyright, open the root source directory within VS Code. Open the debug sub-panel and choose “Pyright CLI” from the debug target menu. Click on the green “run” icon or press F5 to build and launch the command-line version in the VS Code debugger. There's also a similar option that provides a slightly faster build/debug loop: make sure you've built the pyright-internal project e.g. with Terminal > Run Build Task > tsc: watch, then choose “Pyright CLI (pyright-internal)”.
|
||||||
|
|
||||||
To debug the VS Code extension, select “Pyright extension” from the debug target menu. Click on the green “run” icon or press F5 to build and launch a second copy of VS Code with the extension. Within the second VS Code instance, open a python source file so the pyright extension is loaded. Return to the first instance of VS Code and select “Pyright extension attach server” from the debug target menu and click the green “run” icon. This will attach the debugger to the process that hosts the type checker. You can now set breakpoints, etc.
|
To debug the VS Code extension, select “Pyright extension” from the debug target menu. Click on the green “run” icon or press F5 to build and launch a second copy of VS Code with the extension. Within the second VS Code instance, open a python source file so the pyright extension is loaded. Return to the first instance of VS Code and select “Pyright extension attach server” from the debug target menu and click the green “run” icon. This will attach the debugger to the process that hosts the type checker. You can now set breakpoints, etc.
|
||||||
|
|
||||||
|
2
packages/pyright-internal/debug.js
Normal file
2
packages/pyright-internal/debug.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// This is an entry-point for debugging the pyright CLI
|
||||||
|
require('./out/packages/pyright-internal/src/pyright').main();
|
@ -8,11 +8,13 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"src/**/*",
|
"src/**/*",
|
||||||
"src/localization/*.json",
|
"src/localization/*.json",
|
||||||
"**/*.js"
|
"**/*.js",
|
||||||
|
"package.json",
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"dist",
|
"dist",
|
||||||
"out"
|
"out",
|
||||||
|
"debug.js",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user