Skip to content

Commit 8260949

Browse files
authored
Add CONTRIBUTING.md in vscode extension and top-level install commands (#753)
1 parent 8f99af7 commit 8260949

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Here is where you can find the source code for various parts of the Quarto syste
1313

1414
## Development
1515

16+
### VS Code Extension
17+
1618
To develop the Quarto VS Code extension, clone this repo, run `yarn`, then run the `yarn dev-vscode` command:
1719

1820
```bash
@@ -22,5 +24,4 @@ yarn dev-vscode # run development/debug version of extension
2224

2325
Use the VS Code **Run and Debug** pane in the activity bar to run a version of VS Code with the development build of the extension.
2426

25-
26-
27+
See our [`CONTRIBUTING`]((https://github.com/quarto-dev/quarto/blob/main/apps/vscode/CONTRIBUTING.md)) file for more information

apps/vscode/CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Building the extension
2+
3+
To develop the Quarto VS Code extension, clone the quarto mono-repo, run `yarn` at top level, then run the `yarn dev-vscode` command:
4+
5+
```sh
6+
yarn # install dependencies
7+
yarn dev-vscode # run development/debug version of extension
8+
```
9+
10+
Install the dev version of the extension in VS Code or Positron with:
11+
12+
```sh
13+
yarn install-vscode
14+
yarn install-positron
15+
```
16+
17+
18+
# Debugging the extension
19+
20+
The extension must have been built in dev mode (see the build section). The `dev` build flag is essential for debugging:
21+
22+
- It disables minifying and generates source maps from generated JS files to source TS files. The source maps allow you to set breakpoints in our TS files and step through them.
23+
24+
- It causes the LSP node process to be spawned in debug mode. This allows VS Code or another debugger to connect to the LSP via a special port.
25+
26+
Here is the process:
27+
28+
- Let `yarn dev-vscode` run in the background somewhere.
29+
30+
- Open the `apps/vscode` folder in VS Code or Positron and go to the `Run and debug` pane.
31+
32+
- Run the `Run VS Code Extension` to open the dev version of the extension in a new window.
33+
34+
- If you need to set breakpoints in the LSP, you'll have to select the launch configuration `Attach to VS Code LSP server` and run that as well. You should see your LSP breakpoints bind (go from grayed out to red dots) as soon as the debugger is attached to the LSP.
35+
36+
Note that if you close the dev window and stop the extension debugging session, you'll have to manually close the LSP debugging session.

apps/vscode/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,8 @@
14081408
},
14091409
"scripts": {
14101410
"vscode:prepublish": "rm -rf ./out/markdownit && cd ../.. && turbo run build --force --filter quarto...",
1411+
"install-vscode": "rm -rf *.vsix && vsce package && code --install-extension *.vsix",
1412+
"install-positron": "rm -rf *.vsix && vsce package && positron --install-extension *.vsix",
14111413
"build": "tsx build.ts",
14121414
"dev": "yarn run build dev",
14131415
"lint": "eslint src --ext ts",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"build": "turbo run build",
1212
"dev-writer": "turbo run dev --filter writer*",
1313
"dev-vscode": "turbo run dev --filter quarto...",
14+
"install-vscode": "cd apps/vscode && yarn install-vscode",
15+
"install-positron": "cd apps/vscode && yarn install-positron",
1416
"lint": "turbo run lint",
1517
"format": "prettier --write \"**/*.{ts,tsx}\"",
1618
"watch": "concurrently 'tsc --watch --noEmit --project apps/writer/tsconfig.json' 'tsc --watch --noEmit --project packages/writer-server/tsconfig.json'"

0 commit comments

Comments
 (0)