Skip to content

Commit

Permalink
Merge pull request #1133 from chrisgrieser/dev
Browse files Browse the repository at this point in the history
fix: do not overwrite user-provided shellcheck `--shell` (#1064)
  • Loading branch information
skovhus authored Jan 2, 2025
2 parents 179a285 + 5164c63 commit ada88bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Bash Language Server

## 5.4.3

- Do not overwrite user-provided shellcheck `--shell` argument https://github.com/bash-lsp/bash-language-server/pull/1133

## 5.4.2

- Fix wrong pnpm engine version
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A language server for Bash",
"author": "Mads Hartmann",
"license": "MIT",
"version": "5.4.2",
"version": "5.4.3",
"main": "./out/server.js",
"typings": "./out/server.d.ts",
"bin": {
Expand Down
8 changes: 7 additions & 1 deletion server/src/shellcheck/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,19 @@ export class Linter {
.map((folderName) => `--source-path=${folderName}`)

const args = [
`--shell=${shellName}`,
'--format=json1',
'--external-sources',
...sourcePathsArgs,
...additionalArgs,
]

// only add `--shell` argument if non is provided by the user in their
// config. This allows to the user to override the shell. See #1064.
const userArgs = additionalArgs.join(' ')
if (!(userArgs.includes('--shell') || userArgs.includes('-s '))) {
args.unshift(`--shell=${shellName}`)
}

logger.debug(`ShellCheck: running "${this.executablePath} ${args.join(' ')}"`)

let out = ''
Expand Down

0 comments on commit ada88bb

Please sign in to comment.