Skip to content

Commit f9ee30a

Browse files
committed
Allow disabling ShellCheck while running
1 parent 8ce7903 commit f9ee30a

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

server/src/server.ts

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,18 @@ export default class BashServer {
132132
* register capabilities. The initialized notification may only be sent once.
133133
*/
134134
connection.onInitialized(async () => {
135-
const { config: newConfig, environmentVariablesUsed } =
135+
const { config: environmentConfig, environmentVariablesUsed } =
136136
config.getConfigFromEnvironmentVariables()
137-
this.config = newConfig
138-
139-
if (environmentVariablesUsed.length > 0) {
140-
connection.console.warn(
141-
`Environment variable configuration is being deprecated, please use workspace configuration. The following environment variables were used: ${environmentVariablesUsed.join(
142-
', ',
143-
)}`,
144-
)
137+
if (environmentConfig) {
138+
this.updateConfiguration(environmentConfig)
139+
140+
if (environmentVariablesUsed.length > 0) {
141+
connection.console.warn(
142+
`Environment variable configuration is being deprecated, please use workspace configuration. The following environment variables were used: ${environmentVariablesUsed.join(
143+
', ',
144+
)}`,
145+
)
146+
}
145147
}
146148

147149
if (hasConfigurationCapability) {
@@ -158,16 +160,6 @@ export default class BashServer {
158160
this.connection.console.log('Configuration loaded from client')
159161
}
160162

161-
const { shellcheckPath } = this.config
162-
if (!shellcheckPath) {
163-
connection.console.info('ShellCheck linting is disabled.')
164-
} else {
165-
this.linter = new Linter({
166-
console: connection.console,
167-
executablePath: shellcheckPath,
168-
})
169-
}
170-
171163
initialized = true
172164
if (currentDocument) {
173165
// If we already have a document, analyze it now that we're initialized
@@ -212,6 +204,20 @@ export default class BashServer {
212204

213205
if (!isDeepStrictEqual(this.config, newConfig)) {
214206
this.config = newConfig
207+
208+
const { shellcheckPath } = this.config
209+
if (!shellcheckPath) {
210+
this.connection.console.log(
211+
'ShellCheck linting is disabled as "shellcheckPath" was not set',
212+
)
213+
this.linter = undefined
214+
} else {
215+
this.linter = new Linter({
216+
console: this.connection.console,
217+
executablePath: shellcheckPath,
218+
})
219+
}
220+
215221
return true
216222
}
217223
} catch (err) {

0 commit comments

Comments
 (0)