Skip to content

Modernize build setup #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// https://github.com/microsoft/vscode-extension-samples/blob/e1ecdaec8974b938e7a92589faa233e1691d251f/lsp-sample/.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
Expand All @@ -9,12 +11,39 @@
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/vscode-client"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/vscode-client/out/**/*.js"
],
"preLaunchTask": "compile"
"preLaunchTask": {
"type": "npm",
"script": "watch"
}
},
{
"type": "node",
"request": "attach",
"name": "Attach to Server",
"port": 6009,
"restart": true,
"outFiles": ["${workspaceRoot}/server/out/**/*.js"]
},
{
"name": "Language Server E2E Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/vscode-client/out/test/index",
"${workspaceRoot}/vscode-client/testFixture"
],
"outFiles": ["${workspaceRoot}/vscode-client/out/test/**/*.js"]
}
],
"compounds": [
{
"name": "Client + Server",
"configurations": ["Launch Client", "Attach to Server"]
}
]
}
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"files.exclude": {
"vscode-client/out": true,
"server/out": true
},
"search.exclude": {
Expand Down
13 changes: 7 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
"version": "2.0.0",
"tasks": [
{
"label": "compile",
"type": "npm",
"script": "compile",
"group": "build",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
8 changes: 0 additions & 8 deletions docs/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ View to launch the `Launch Client` task. This will open a new vscode window with
extension loaded. It also looks for changes to your client code and recompiles
it whenever you save your changes.

As the server is embedded into the

### Atom

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

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

If you make any changes to the server, you need to recompile it:

```
yarn compile:server
```


## Working on the server (standalone)

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
"scripts": {
"clean": "rm -rf *.log */*.log */out node_modules vscode-client/node_modules server/node_modules",
"postinstall": "cd server && yarn install && cd ../vscode-client && yarn install && cd ..",
"compile": "yarn run compile:server && yarn run compile:client",
"compile:client": "cd vscode-client && yarn run compile",
"compile:server": "cd server && yarn run compile",
"compile": "tsc -b",
"watch": "tsc -b -w",
"lint": "yarn lint:bail --fix",
"lint:bail": "eslint . --ext js,ts,tsx --cache",
"test": "jest --runInBand",
"test:coverage": "yarn run test --coverage",
"test:watch": "yarn run test --watch",
"verify": "yarn run lint && yarn run compile && yarn run test",
"verify:bail": "yarn run lint:bail && yarn run compile && yarn run test:coverage",
"reinstall-server": "npm uninstall -g bash-language-server && yarn compile:server && npm i -g ./server",
"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"
"reinstall-server": "npm uninstall -g bash-language-server && yarn compile && npm i -g ./server",
"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"
},
"devDependencies": {
"@types/jest": "^25.1.3",
Expand Down
4 changes: 1 addition & 3 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
"web-tree-sitter": "^0.16.2"
},
"scripts": {
"compile": "rm -rf out && ../node_modules/.bin/tsc -p ./",
"compile:watch": "../node_modules/.bin/tsc -w -p ./",
"prepublishOnly": "yarn run compile"
"prepublishOnly": "cd ../ && yarn run compile"
},
"devDependencies": {
"@types/fuzzy-search": "^2.1.0",
Expand Down
8 changes: 5 additions & 3 deletions server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"extends": "../tsconfig.base.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",

"lib": [
"dom", // Required by @types/turndown
"es2016"
],
"strict": true,
}
},
"include": ["src"],
"exclude": ["node_modules", "../testing", "src/__tests__"]
}
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.base.json",
"extends": "./tsconfig.json",
"exclude": [
"node_modules"
],
Expand Down
10 changes: 10 additions & 0 deletions tsconfig.base.json → tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@
"lib": [
"es2016"
],
"rootDir": ".",
"sourceMap": true
},
"include": [
"testing"
],
"exclude": [
"node_modules",
"**/__tests__/*",
"vscode-client/out",
"server/out",
"server/setupJest.ts",
"testing"
],
"references": [
{ "path": "./vscode-client" },
{ "path": "./server" }
]
}
6 changes: 2 additions & 4 deletions vscode-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"activationEvents": [
"onLanguage:shellscript"
],
"main": "./out/src/extension",
"main": "./out/extension",
"contributes": {
"configuration": {
"type": "object",
Expand All @@ -50,9 +50,7 @@
}
},
"scripts": {
"vscode:prepublish": "yarn run compile",
"compile": "rm -rf out && ../node_modules/.bin/tsc -p ./",
"compile:watch": "../node_modules/.bin/tsc -w -p ./"
"vscode:prepublish": "cd.. && yarn run compile"
},
"dependencies": {
"bash-language-server": "1.13.0",
Expand Down
12 changes: 10 additions & 2 deletions vscode-client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,24 @@ export async function activate(context: ExtensionContext) {
}

const serverExecutable = {
module: context.asAbsolutePath(path.join('out', 'src', 'server.js')),
module: context.asAbsolutePath(path.join('out', 'server.js')),
transport: TransportKind.ipc,
options: {
env,
},
}

const debugServerExecutable = {
...serverExecutable,
options: {
...serverExecutable.options,
execArgv: ['--nolazy', '--inspect=6009'],
},
}

const serverOptions: ServerOptions = {
run: serverExecutable,
debug: serverExecutable,
debug: debugServerExecutable,
}

const clientOptions: LanguageClientOptions = {
Expand Down
8 changes: 5 additions & 3 deletions vscode-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "../tsconfig.base.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "."
}
"rootDir": "src"
},
"include": ["src"],
"exclude": ["node_modules", "../testing"]
}