Skip to content

Commit

Permalink
Restructure and fix dependencies
Browse files Browse the repository at this point in the history
Publish the bash-language-server package separately as it's own npm
package and move the tree-sitter and tree-sitter-bash dependencies to
the client so they'll be compiled during installation on the users
machine. This should fix #5 - I hope.

I also bumped the version of tree-sitter-bash.
  • Loading branch information
mads-hartmann committed Mar 2, 2018
1 parent 5dcfdcb commit 534424f
Show file tree
Hide file tree
Showing 16 changed files with 268 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**/node_modules

vscode-client/out
vscode-client/server
server/out
11 changes: 0 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@
"${workspaceRoot}/vscode-client/out/**/*.js"
],
"preLaunchTask": "watch:client"
},
{
"name": "Attach to Server",
"type": "node",
"request": "attach",
"port": 6009,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/vscode-client/server/**/*.js"
],
"preLaunchTask": "watch:server"
}
]
}
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"files.exclude": {
"vscode-client/out": true,
"vscode-client/server": true
"server/out": true
},
"search.exclude": {
"out": true,
"vscode-client/server": true
"out": true
},
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.tsc.autoDetect": "off"
Expand Down
158 changes: 79 additions & 79 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
{
"version": "2.0.0",
"tasks": [
{
"taskName": "compile",
"dependsOn": [
"compile:client",
"compile:server"
],
"problemMatcher": []
},
{
"label": "compile:client",
"type": "npm",
"script": "compile:client",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"label": "compile:server",
"type": "npm",
"script": "compile:server",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"taskName": "watch",
"dependsOn": [
"watch:client",
"watch:server"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "watch:client",
"type": "npm",
"script": "watch:client",
"isBackground": true,
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
},
{
"label": "watch:server",
"type": "npm",
"script": "watch:server",
"isBackground": true,
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"taskName": "compile",
"dependsOn": [
"compile:client",
"compile:server"
],
"problemMatcher": []
},
{
"label": "compile:client",
"type": "npm",
"script": "compile:client",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"label": "compile:server",
"type": "npm",
"script": "compile:server",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"taskName": "watch",
"dependsOn": [
"watch:client",
"watch:server"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "watch:client",
"type": "npm",
"script": "watch:client",
"isBackground": true,
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
},
{
"label": "watch:server",
"type": "npm",
"script": "watch:server",
"isBackground": true,
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
}
]
}
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
clean:
rm -rf node_modules server/node_modules vscode-client/node_modules vscode-client/server vscode-client/out

build: install
npm run compile

install: package.json server/package.json vscode-client/package.json
npm install
22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,17 @@ Bash language server implementation based on [Tree Sitter][tree-sitter] and its
## Installation

Currently the client has only been implemented for Visual Studio Code. You can
install it from the marketplace (It's called [Bash IDE][vscode-marketplace]).
install it from the marketplace - It's called [Bash IDE][vscode-marketplace].

## Development guide

**prerequisite:** The extension is using [node-gyp][node-gyp] to build the bash
**prerequisite:** The extension is using [node-gyp][node-gyp] to build the Bash
tree-sitter parser. See node-gyps [system requirements][node-gyp-installation].

Install the dependencies:

npm install

Compile the server and vscode extension

npm run compile

Continuously compile the server using

npm run watch:server
## Development Guide

Launch the extension using `Launch Client` from within vscode.
Please see [docs/development-guide][dev-guide] for more information.

[tree-sitter]: https://github.com/tree-sitter/tree-sitter
[tree-sitter-bash]: https://github.com/tree-sitter/tree-sitter-bash
[vscode-marketplace]: https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode
[node-gyp]: https://github.com/nodejs/node-gyp
[dev-guide]: https://github.com/mads-hartmann/bash-language-server/blob/master/docs/development-guide.md
[node-gyp-installation]: https://github.com/nodejs/node-gyp#installation
45 changes: 45 additions & 0 deletions docs/development-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Development guide

This guide will help you set up your local development environment.

There are two moving parts.

- **Server**: A node server written in Typescript that implements the
[Language Server Protocol (LSP)][lsp].
- **Client**: A super tiny vscode extension which basically just tells vscode
how to launch the LSP server.

The project has a root `package.json` file which is really just there for
convenience - it proxies to the `package.json` files in the `vscode-client` and
`server` folders.

To **install all the required dependencies** run

```
npm install
```

This uses the `postinstall` hook to install the dependencies in each of the
sub-projects as well as using [npm link][npm-link] to get your local client to
use your local version of the server.

To **compile everything** run

```
npm run compile
```

Now, as most of the interesting things are happening in the server you'll probably want to
re-compile it whenever you make a change to any of the source files:

```
npm run watch:server
```

Finally Launch the extension using `Launch Client` task from within vscode. For
now you'll have to re-launch the extension whenever you've made any changes to
the source.

[lsp]: https://microsoft.github.io/language-server-protocol/
[node-gyp]: https://github.com/nodejs/node-gyp
[npm-link]: https://docs.npmjs.com/cli/link
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"url": "https://github.com/mads-hartmann/bash-language-server"
},
"scripts": {
"postinstall": "cd server && npm install && cd ../vscode-client && npm install && cd ..",
"compile": "tsc -p vscode-client/tsconfig.json && cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json",
"compile:client": "tsc -p vscode-client/tsconfig.json",
"watch:client": "tsc -w -p vscode-client/tsconfig.json",
"compile:server": "cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json",
"watch:server": "cd server && npm run installServer && cd .. && tsc -w -p server/tsconfig.json"
"postinstall": "cd server && npm install && npm link && cd ../vscode-client && npm install && npm link bash-language-server && cd ..",
"compile": "cd server && npm run compile && cd ../vscode-client && npm run compile && cd ..",
"compile:client": "cd vscode-client && npm run compile && cd ..",
"watch:client": "cd vscode-client && npm run compile:watch && cd ..",
"compile:server": "cd server && npm run compile && cd ..",
"watch:server": "cd server && npm run compile:watch && cd .."
},
"devDependencies": {
"@types/node": "^9.4.6",
Expand Down
7 changes: 7 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bash Language Server

Bash language server implementation based on [Tree Sitter][tree-sitter] and its
[grammar for Bash][tree-sitter-bash].

[tree-sitter]: https://github.com/tree-sitter/tree-sitter
[tree-sitter-bash]: https://github.com/tree-sitter/tree-sitter-bash
11 changes: 7 additions & 4 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 534424f

Please sign in to comment.