Skip to content

Commit 513aa8f

Browse files
authored
Merge branch 'main' into dev
2 parents ea8cef3 + 4353aab commit 513aa8f

38 files changed

+1556
-191
lines changed

Diff for: .github/workflows/deploy.yml

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

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

Diff for: .github/workflows/upgrade-tree-sitter.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
3737
- name: Create pull request
3838
if: steps.verify-changed-files.outputs.files_changed == 'true'
39-
uses: peter-evans/create-pull-request@v5
39+
uses: peter-evans/create-pull-request@v6
4040
with:
4141
add-paths: server
4242
title: Auto upgrade tree-sitter-bash parser

Diff for: .github/workflows/verify.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
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

2020
- uses: pnpm/action-setup@v2
2121
with:
@@ -34,7 +34,7 @@ jobs:
3434
run: pnpm verify:bail
3535

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

Diff for: .tool-versions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 18.20.0
1+
nodejs 18.20.1

Diff for: .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
}

Diff for: README.md

+27-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

@@ -180,6 +188,22 @@ Using the built-in `eglot` lsp mode:
180188
(bash-ts-mode . eglot-ensure))
181189
```
182190

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+
183207
## Logging
184208

185209
The minimum logging level for the server can be adjusted using the `BASH_IDE_LOG_LEVEL` environment variable
@@ -197,6 +221,7 @@ Please see [docs/development-guide][dev-guide] for more information.
197221
[sublime-text-lsp]: https://packagecontrol.io/packages/LSP-bash
198222
[explainshell]: https://explainshell.com/
199223
[shellcheck]: https://www.shellcheck.net/
224+
[shfmt]: https://github.com/mvdan/sh#shfmt
200225
[languageclient-neovim]: https://github.com/autozimu/LanguageClient-neovim
201226
[nvim-lspconfig]: https://github.com/neovim/nvim-lspconfig
202227
[vim-lsp]: https://github.com/prabirshrestha/vim-lsp

Diff for: package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
},
1919
"devDependencies": {
2020
"@types/jest": "29.5.12",
21-
"@types/node": "18.19.28",
22-
"@typescript-eslint/eslint-plugin": "7.4.0",
23-
"@typescript-eslint/parser": "7.4.0",
21+
"@types/node": "18.19.30",
22+
"@typescript-eslint/eslint-plugin": "7.5.0",
23+
"@typescript-eslint/parser": "7.5.0",
2424
"eslint": "8.57.0",
2525
"eslint-config-prettier": "9.1.0",
2626
"eslint-plugin-jest": "27.9.0",
@@ -30,16 +30,16 @@
3030
"jest": "29.7.0",
3131
"prettier": "2.8.8",
3232
"ts-jest": "29.1.2",
33-
"typescript": "5.4.3",
33+
"typescript": "5.4.4",
3434
"vscode-languageserver": "8.0.2",
3535
"vscode-languageserver-textdocument": "1.0.11"
3636
},
3737
"resolutions": {
38-
"@types/vscode": "1.87.0"
38+
"@types/vscode": "1.88.0"
3939
},
4040
"engines": {
4141
"node": ">=16",
42-
"pnpm": "8.x"
42+
"pnpm": ">=8.x"
4343
},
4444
"jest": {
4545
"preset": "ts-jest",

0 commit comments

Comments
 (0)