Added documentation for building and debugging.

This commit is contained in:
Eric Traut 2019-03-27 23:17:44 -07:00
parent 76cf9dc476
commit fe3b7069cf
2 changed files with 30 additions and 15 deletions

View File

@ -39,6 +39,7 @@ Pyright offers the following language service features:
* [Command-line Options](/docs/command-line.md)
* [Configuration](/docs/configuration.md)
* [Getting Started](/docs/getting-started.md)
* [Building & Debugging](/docs/build-debug.md)
* [Pyright Internals](/docs/internals.md)
@ -69,21 +70,6 @@ To run the command-line tool:
`npx pyright <options>`
## Build Instructions
To build the project:
1. Install [nodejs](https://nodejs.org/en/)
2. Open terminal window in main directory of cloned source
3. Execute `npm run install:all` to install dependencies
4. Execute `npm run build`
To build the VS Code extension package:
Same as above, plus
1. Execute `npm run package`
The resulting package (pyright-X.Y.Z.vsix) can be found in the client directory.
To install in VS Code, go to the extensions panel and choose “Install from VSIX...” from the menu, then select the package.
## Code Structure
* client/src/extension.ts: Language Server Protocol (LSP) client entry point for VS Code extension.

29
docs/build-debug.md Normal file
View File

@ -0,0 +1,29 @@
## Building Pyright
To build the project:
1. Install [nodejs](https://nodejs.org/en/)
2. Open terminal window in main directory of cloned source
3. Execute `npm run install:all` to install dependencies
4. Execute `npm run build`
To build the VS Code extension package:
Same as above, plus
1. Execute `npm run package`
The resulting package (pyright-X.Y.Z.vsix) can be found in the client directory.
To install in VS Code, go to the extensions panel and choose “Install from VSIX...” from the menu, then select the package.
## Running Pyright Locally
Once built, you can run the command-line tool directly from the built sources by executing the following:
`node ./index.js`
## 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 the VS Code extension, select “Pyright Language Client” 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 Language 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.