Skip to content

Commit aa11135

Browse files
committed
add CONTRIBUTING.MD and new start script
1 parent 5b5a4e9 commit aa11135

File tree

3 files changed

+297
-37
lines changed

3 files changed

+297
-37
lines changed

CONTRIBUTING.MD

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md -->
2+
# TypeScript Essential Plugins Contributing Guide
3+
4+
Hi! Thank you so much for contributing to TypeScript Essential Plugins VS Code extension! We are really excited to bring high quality features and stability and we really appreciate any interest in it!
5+
Let us give you some high-level overview for you.
6+
7+
## Repo Setup
8+
9+
> Quick Tip: You can use [ni](https://github.com/antfu/ni) to help switching between repos using different package managers.
10+
> `ni` is equivalent to `pnpm install` and `nr script` is equivalent to `pnpm script`
11+
12+
### Start in Development
13+
14+
To start the VS Code plugin extension locally for developing:
15+
16+
0. Ensure you have pnpm installed (minimum v6): `npm i -g pnpm`
17+
18+
1. Run `pnpm install` in root folder
19+
20+
2. Run `pnpm start` to build extension and typescript plugin in watch mode. After initial build you can open VS Code window in development by pressing F5 to **start debugging session** (or by running `> Debug: Select and Start Debugging` and selecting *Extension + TS Plugin*).
21+
22+
- Note, that window will *be reloaded after each change in `src/*` automatically*. Note that each development window reload most probably cause erase of unsaved files/data. Also if you frequently change files in `src/*` you can uncomment `--disable-extensions` in launch.json for faster window reloads.
23+
24+
### Files Structure Overview
25+
26+
- `src/*` - VS Code extension code, that is specific to VS Code extension API only. Most probably you don't need to change it. (For now there is a limitation from vscode-framework so folder name cannot be changed to something like `extension` or `vscode`.)
27+
- `src/configurationType.ts` - Extension configuration live here. Add / change settings here. It is used to generate `out/package.json`'s `contributes.configuration`.
28+
- `typescript/*` - TypeScript plugin code, that integrates into TypeScript language service. After you change code in it, you need run to `> TypeScript: Restart TS server` to see changes (or `> Volar: Restart Vue server` for Vue files). Thats why it is useful to bind it to a shortcut.
29+
30+
### Running Tests
31+
32+
#### Unit Tests
33+
34+
They are in `typescript/test` and using vitest, so they faster than integration. Feel free to add new tests here. But note that most of tests are completion tests, but I do hope to add more types tests in the future.
35+
36+
To launch them run `pnpm test-plugin`.
37+
38+
#### Integration Tests
39+
40+
They are in `integration`. This type of tests launches VSCode. For now I don't recommend either running or adding new tests here, use unit tests.
41+
> Note that while running this script, you must also keep `pnpm start` running in the background. However, changing a file in `src/`, won't relaunch integration tests. If this is your case, you should edit the script.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@
9494
"onLanguage:vue"
9595
],
9696
"scripts": {
97-
"start": "vscode-framework start --skip-launching",
97+
"start": "run-p watch-extension watch-plugin",
98+
"watch-extension": "vscode-framework start --skip-launching",
99+
"watch-plugin": "node buildTsPlugin.mjs --watch",
98100
"build": "tsc && tsc -p typescript --noEmit && vscode-framework build && pnpm build-plugin",
99101
"build-plugin": "node buildTsPlugin.mjs && node buildTsPlugin.mjs --browser",
100-
"watch-plugin": "node buildTsPlugin.mjs --watch",
101102
"lint": "eslint src/**",
102103
"test": "pnpm test-plugin --run && pnpm integration-test",
103104
"test-plugin": "vitest --globals --dir typescript/test/ --environment ts-plugin",
@@ -153,6 +154,7 @@
153154
"lodash.throttle": "^4.1.1",
154155
"mocha": "^10.0.0",
155156
"modify-json-file": "^1.2.2",
157+
"npm-run-all": "^4.1.5",
156158
"path-browserify": "^1.0.1",
157159
"pluralize": "github:plurals/pluralize#36f03cd2d573fa6d23e12e1529fa4627e2af74b4",
158160
"rambda": "^7.2.1",

0 commit comments

Comments
 (0)