Skip to content

Commit 16b7068

Browse files
authored
Merge branch 'main' into main
2 parents 2d19b5d + ba8e6eb commit 16b7068

38 files changed

+4086
-2069
lines changed

.github/workflows/deploy.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313

14-
- uses: pnpm/action-setup@v2
14+
- name: Install shellcheck and shfmt (used for testing)
15+
run: sudo apt-get install -y shellcheck shfmt
16+
17+
- uses: pnpm/action-setup@v4
1518
with:
16-
version: 8
19+
version: 9
1720

1821
- uses: actions/setup-node@v4
1922
with:
2023
node-version: 20
2124
registry-url: https://registry.npmjs.org/
25+
cache: "pnpm"
2226

2327
- run: |
2428
git config --local user.email "kenneth.skovhus@gmail.com"

.github/workflows/upgrade-tree-sitter.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313

14-
- uses: pnpm/action-setup@v2
14+
- uses: pnpm/action-setup@v4
1515
with:
16-
version: 8
16+
version: 9
1717

1818
- uses: actions/setup-node@v4
1919
with:
2020
node-version: 20
2121
cache: "pnpm"
22-
cache-dependency-path: '**/pnpm-lock.yaml'
2322

2423
- run: pnpm install --frozen-lockfile
2524

@@ -36,7 +35,7 @@ jobs:
3635
3736
- name: Create pull request
3837
if: steps.verify-changed-files.outputs.files_changed == 'true'
39-
uses: peter-evans/create-pull-request@v5
38+
uses: peter-evans/create-pull-request@v6
4039
with:
4140
add-paths: server
4241
title: Auto upgrade tree-sitter-bash parser

.github/workflows/verify.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,22 @@ jobs:
99

1010
strategy:
1111
matrix:
12-
node-version: [16.x, 18.x, 20.x]
12+
node-version: [18.x, 20.x]
1313

1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- name: Install shellcheck (used for testing)
18-
run: sudo apt-get install -y shellcheck
17+
- name: Install shellcheck and shfmt (used for testing)
18+
run: sudo apt-get install -y shellcheck shfmt
1919

20-
- uses: pnpm/action-setup@v2
20+
- uses: pnpm/action-setup@v4
2121
with:
22-
version: 8
22+
version: 9
2323

2424
- name: Use Node.js ${{ matrix.node-version }}
2525
uses: actions/setup-node@v4
2626
with:
2727
cache: "pnpm"
28-
cache-dependency-path: '**/pnpm-lock.yaml'
2928
node-version: ${{ matrix.node-version }}
3029

3130
- run: pnpm install --frozen-lockfile
@@ -34,7 +33,7 @@ jobs:
3433
run: pnpm verify:bail
3534

3635
- name: Publish coverage to codecov.io
37-
uses: codecov/codecov-action@v3
36+
uses: codecov/codecov-action@v4
3837
if: success() && matrix.node-version == '20.x'
3938
with:
4039
token: ${{ secrets.CODECOV_TOKEN }}

.tool-versions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 18.19.0
1+
nodejs 18.20.7

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"typescript.tsdk": "./node_modules/typescript/lib",
99
"typescript.tsc.autoDetect": "off",
1010
"editor.codeActionsOnSave": {
11-
"source.fixAll.eslint": true
11+
"source.fixAll.eslint": "explicit"
1212
}
1313
}

README.md

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Bash Language Server
22

3-
Bash language server that brings an IDE-like experience for bash scripts to most editors. This is based on the [Tree Sitter parser][tree-sitter-bash] and supports [explainshell][explainshell] and [shellcheck][shellcheck].
3+
Bash language server that brings an IDE-like experience for bash scripts to most editors. This is based on the [Tree Sitter parser][tree-sitter-bash] and supports [explainshell][explainshell], [shellcheck][shellcheck] and [shfmt][shfmt].
44

55
Documentation around configuration variables can be found in the [config.ts](https://github.com/bash-lsp/bash-language-server/blob/main/server/src/config.ts) file.
66

@@ -15,6 +15,7 @@ Documentation around configuration variables can be found in the [config.ts](htt
1515
- Documentation for symbols on hover
1616
- Workspace symbols
1717
- Rename symbol
18+
- Format document
1819

1920
To be implemented:
2021

@@ -24,7 +25,14 @@ To be implemented:
2425

2526
### Dependencies
2627

27-
As a dependency, we recommend that you first install shellcheck [shellcheck][shellcheck] to enable linting: https://github.com/koalaman/shellcheck#installing . If shellcheck is installed, bash-language-server will automatically call it to provide linting and code analysis each time the file is updated (with debounce time or 500ms).
28+
As a dependency, we recommend that you first install [shellcheck][shellcheck] to enable linting:
29+
https://github.com/koalaman/shellcheck#installing . If `shellcheck` is installed,
30+
bash-language-server will automatically call it to provide linting and code analysis each time the
31+
file is updated (with debounce time of 500ms).
32+
33+
If you want your shell scripts to be formatted consistently, you can install [shfmt][shfmt]. If
34+
`shfmt` is installed then your documents will be formatted whenever you take the 'format document'
35+
action. In most editors this can be configured to happen automatically when files are saved.
2836

2937
### Bash language server
3038

@@ -168,6 +176,34 @@ Add the configuration to your `.emacs.d/init.el`
168176
(sh-mode . lsp))
169177
```
170178

179+
Using the built-in `eglot` lsp mode:
180+
181+
```emacs-lisp
182+
(use-package eglot
183+
:config
184+
(add-to-list 'eglot-server-programs '((sh-mode bash-ts-mode) . ("bash-language-server" "start")))
185+
186+
:hook
187+
(sh-mode . eglot-ensure)
188+
(bash-ts-mode . eglot-ensure))
189+
```
190+
191+
## `shfmt` integration
192+
193+
The indentation used by `shfmt` is whatever has been configured for the current editor session, so
194+
there is no `shfmt`-specific configuration variable for this. If your editor is configured for
195+
two-space indents then that's what it will use. If you're using tabs for indentation then `shfmt`
196+
will use that.
197+
198+
The `shfmt` integration also supports configuration via `.editorconfig`. If any `shfmt`-specific
199+
configuration properties are found in `.editorconfig` then the config in `.editorconfig` will be
200+
used and the language server config will be ignored. This follows `shfmt`'s approach of using either
201+
`.editorconfig` or command line flags, but not both. Note that only `shfmt`-specific configuration
202+
properties are read from `.editorconfig` - indentation preferences are still provided by the editor,
203+
so to format using the indentation specified in `.editorconfig` make sure your editor is also
204+
configured to read `.editorconfig`. It is possible to disable `.editorconfig` support and always use
205+
the language server config by setting the "Ignore Editorconfig" configuration variable.
206+
171207
## Logging
172208

173209
The minimum logging level for the server can be adjusted using the `BASH_IDE_LOG_LEVEL` environment variable
@@ -185,6 +221,7 @@ Please see [docs/development-guide][dev-guide] for more information.
185221
[sublime-text-lsp]: https://packagecontrol.io/packages/LSP-bash
186222
[explainshell]: https://explainshell.com/
187223
[shellcheck]: https://www.shellcheck.net/
224+
[shfmt]: https://github.com/mvdan/sh#shfmt
188225
[languageclient-neovim]: https://github.com/autozimu/LanguageClient-neovim
189226
[nvim-lspconfig]: https://github.com/neovim/nvim-lspconfig
190227
[vim-lsp]: https://github.com/prabirshrestha/vim-lsp

package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,29 @@
1717
"postinstall": "pnpm --dir=vscode-client install --ignore-workspace"
1818
},
1919
"devDependencies": {
20-
"@types/jest": "29.5.12",
21-
"@types/node": "18.19.14",
22-
"@typescript-eslint/eslint-plugin": "5.62.0",
23-
"@typescript-eslint/parser": "5.62.0",
24-
"eslint": "8.56.0",
20+
"@types/jest": "29.5.14",
21+
"@types/node": "18.19.80",
22+
"@typescript-eslint/eslint-plugin": "7.18.0",
23+
"@typescript-eslint/parser": "7.18.0",
24+
"eslint": "8.57.1",
2525
"eslint-config-prettier": "9.1.0",
26-
"eslint-plugin-jest": "27.6.3",
26+
"eslint-plugin-jest": "27.9.0",
2727
"eslint-plugin-prettier": "4.2.1",
28-
"eslint-plugin-simple-import-sort": "10.0.0",
29-
"eslint-plugin-sort-class-members": "1.19.0",
28+
"eslint-plugin-simple-import-sort": "12.1.1",
29+
"eslint-plugin-sort-class-members": "1.21.0",
3030
"jest": "29.7.0",
3131
"prettier": "2.8.8",
32-
"ts-jest": "29.1.2",
33-
"typescript": "5.3.3",
32+
"ts-jest": "29.2.6",
33+
"typescript": "5.6.3",
3434
"vscode-languageserver": "8.0.2",
35-
"vscode-languageserver-textdocument": "1.0.11"
35+
"vscode-languageserver-textdocument": "1.0.12"
3636
},
3737
"resolutions": {
38-
"@types/vscode": "1.86.0"
38+
"@types/vscode": "1.98.0"
3939
},
4040
"engines": {
4141
"node": ">=16",
42-
"pnpm": "8.x"
42+
"pnpm": ">=9.x"
4343
},
4444
"jest": {
4545
"preset": "ts-jest",

0 commit comments

Comments
 (0)