Skip to content
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

fix: do not overwrite user-provided shellcheck --shell (#1064) #1133

Merged
merged 4 commits into from
Jan 2, 2025
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
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
Loading