Skip to content

Commit 7e25cb1

Browse files
committed

12 files changed

+77
-39
lines changed

.vscode/launch.json

+32-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// https://github.com/microsoft/vscode-extension-samples/blob/e1ecdaec8974b938e7a92589faa233e1691d251f/lsp-sample/.vscode/launch.json
13
{
24
"version": "0.2.0",
35
"configurations": [
@@ -9,12 +11,39 @@
911
"args": [
1012
"--extensionDevelopmentPath=${workspaceRoot}/vscode-client"
1113
],
12-
"stopOnEntry": false,
13-
"sourceMaps": true,
1414
"outFiles": [
1515
"${workspaceRoot}/vscode-client/out/**/*.js"
1616
],
17-
"preLaunchTask": "compile"
17+
"preLaunchTask": {
18+
"type": "npm",
19+
"script": "watch"
20+
}
21+
},
22+
{
23+
"type": "node",
24+
"request": "attach",
25+
"name": "Attach to Server",
26+
"port": 6009,
27+
"restart": true,
28+
"outFiles": ["${workspaceRoot}/server/out/**/*.js"]
29+
},
30+
{
31+
"name": "Language Server E2E Test",
32+
"type": "extensionHost",
33+
"request": "launch",
34+
"runtimeExecutable": "${execPath}",
35+
"args": [
36+
"--extensionDevelopmentPath=${workspaceRoot}",
37+
"--extensionTestsPath=${workspaceRoot}/vscode-client/out/test/index",
38+
"${workspaceRoot}/vscode-client/testFixture"
39+
],
40+
"outFiles": ["${workspaceRoot}/vscode-client/out/test/**/*.js"]
41+
}
42+
],
43+
"compounds": [
44+
{
45+
"name": "Client + Server",
46+
"configurations": ["Launch Client", "Attach to Server"]
1847
}
1948
]
2049
}

.vscode/settings.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"files.exclude": {
3-
"vscode-client/out": true,
43
"server/out": true
54
},
65
"search.exclude": {

.vscode/tasks.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "compile",
65
"type": "npm",
7-
"script": "compile",
8-
"group": "build",
6+
"script": "watch",
7+
"problemMatcher": "$tsc-watch",
8+
"isBackground": true,
99
"presentation": {
1010
"panel": "dedicated",
1111
"reveal": "never"
1212
},
13-
"problemMatcher": [
14-
"$tsc"
15-
]
13+
"group": {
14+
"kind": "build",
15+
"isDefault": true
16+
}
1617
}
1718
]
1819
}

docs/development-guide.md

-8
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ View to launch the `Launch Client` task. This will open a new vscode window with
5959
extension loaded. It also looks for changes to your client code and recompiles
6060
it whenever you save your changes.
6161

62-
As the server is embedded into the
63-
6462
### Atom
6563

6664
See the [ide-bash][ide-bash] package for Atom. Due to how Atom packages are
@@ -77,12 +75,6 @@ yarn link-server
7775

7876
After that follow the steps above to work on the client.
7977

80-
If you make any changes to the server, you need to recompile it:
81-
82-
```
83-
yarn compile:server
84-
```
85-
8678

8779
## Working on the server (standalone)
8880

package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
"scripts": {
44
"clean": "rm -rf *.log */*.log */out node_modules vscode-client/node_modules server/node_modules",
55
"postinstall": "cd server && yarn install && cd ../vscode-client && yarn install && cd ..",
6-
"compile": "yarn run compile:server && yarn run compile:client",
7-
"compile:client": "cd vscode-client && yarn run compile",
8-
"compile:server": "cd server && yarn run compile",
6+
"compile": "tsc -b",
7+
"watch": "tsc -b -w",
98
"lint": "yarn lint:bail --fix",
109
"lint:bail": "eslint . --ext js,ts,tsx --cache",
1110
"test": "jest --runInBand",
1211
"test:coverage": "yarn run test --coverage",
1312
"test:watch": "yarn run test --watch",
1413
"verify": "yarn run lint && yarn run compile && yarn run test",
1514
"verify:bail": "yarn run lint:bail && yarn run compile && yarn run test:coverage",
16-
"reinstall-server": "npm uninstall -g bash-language-server && yarn compile:server && npm i -g ./server",
17-
"link-server": "npm uninstall -g bash-language-server && yarn compile:server && yarn unlink bash-language-server && cd server && yarn link && cd ../vscode-client && yarn link bash-language-server"
15+
"reinstall-server": "npm uninstall -g bash-language-server && yarn compile && npm i -g ./server",
16+
"link-server": "npm uninstall -g bash-language-server && yarn compile && yarn unlink bash-language-server && cd server && yarn link && cd ../vscode-client && yarn link bash-language-server"
1817
},
1918
"devDependencies": {
2019
"@types/jest": "^25.1.3",

server/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
"web-tree-sitter": "^0.16.2"
3030
},
3131
"scripts": {
32-
"compile": "rm -rf out && ../node_modules/.bin/tsc -p ./",
33-
"compile:watch": "../node_modules/.bin/tsc -w -p ./",
34-
"prepublishOnly": "yarn run compile"
32+
"prepublishOnly": "cd ../ && yarn run compile"
3533
},
3634
"devDependencies": {
3735
"@types/fuzzy-search": "^2.1.0",

server/tsconfig.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
2-
"extends": "../tsconfig.base.json",
2+
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "out",
5+
"rootDir": "src",
56

67
"lib": [
78
"dom", // Required by @types/turndown
89
"es2016"
910
],
10-
"strict": true,
11-
}
11+
},
12+
"include": ["src"],
13+
"exclude": ["node_modules", "../testing", "src/__tests__"]
1214
}

tsconfig.eslint.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "./tsconfig.base.json",
2+
"extends": "./tsconfig.json",
33
"exclude": [
44
"node_modules"
55
],

tsconfig.base.json renamed to tsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@
1010
"lib": [
1111
"es2016"
1212
],
13+
"rootDir": ".",
1314
"sourceMap": true
1415
},
16+
"include": [
17+
"testing"
18+
],
1519
"exclude": [
1620
"node_modules",
1721
"**/__tests__/*",
22+
"vscode-client/out",
23+
"server/out",
1824
"server/setupJest.ts",
1925
"testing"
26+
],
27+
"references": [
28+
{ "path": "./vscode-client" },
29+
{ "path": "./server" }
2030
]
2131
}

vscode-client/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"activationEvents": [
2626
"onLanguage:shellscript"
2727
],
28-
"main": "./out/src/extension",
28+
"main": "./out/extension",
2929
"contributes": {
3030
"configuration": {
3131
"type": "object",
@@ -50,9 +50,7 @@
5050
}
5151
},
5252
"scripts": {
53-
"vscode:prepublish": "yarn run compile",
54-
"compile": "rm -rf out && ../node_modules/.bin/tsc -p ./",
55-
"compile:watch": "../node_modules/.bin/tsc -w -p ./"
53+
"vscode:prepublish": "cd.. && yarn run compile"
5654
},
5755
"dependencies": {
5856
"bash-language-server": "1.13.0",

vscode-client/src/extension.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,24 @@ export async function activate(context: ExtensionContext) {
2727
}
2828

2929
const serverExecutable = {
30-
module: context.asAbsolutePath(path.join('out', 'src', 'server.js')),
30+
module: context.asAbsolutePath(path.join('out', 'server.js')),
3131
transport: TransportKind.ipc,
3232
options: {
3333
env,
3434
},
3535
}
3636

37+
const debugServerExecutable = {
38+
...serverExecutable,
39+
options: {
40+
...serverExecutable.options,
41+
execArgv: ['--nolazy', '--inspect=6009'],
42+
},
43+
}
44+
3745
const serverOptions: ServerOptions = {
3846
run: serverExecutable,
39-
debug: serverExecutable,
47+
debug: debugServerExecutable,
4048
}
4149

4250
const clientOptions: LanguageClientOptions = {

vscode-client/tsconfig.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"extends": "../tsconfig.base.json",
2+
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "out",
5-
"rootDir": "."
6-
}
5+
"rootDir": "src"
6+
},
7+
"include": ["src"],
8+
"exclude": ["node_modules", "../testing"]
79
}

0 commit comments

Comments
 (0)