Skip to content

Commit d210c24

Browse files
committed
Ensure linter is configured for default config
1 parent 1e419a0 commit d210c24

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

server/src/server.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ export default class BashServer {
5252
}) {
5353
this.analyzer = analyzer
5454
this.clientCapabilities = capabilities
55-
this.config = config.getDefaultConfiguration()
5655
this.connection = connection
5756
this.executables = executables
5857
this.linter = linter
5958
this.workspaceFolder = workspaceFolder
59+
this.config = {} as any // NOTE: configured in updateConfiguration
60+
this.updateConfiguration(config.getDefaultConfiguration())
6061
}
6162
/**
6263
* Initialize the server based on a connection to the client and the protocols
@@ -134,16 +135,14 @@ export default class BashServer {
134135
connection.onInitialized(async () => {
135136
const { config: environmentConfig, environmentVariablesUsed } =
136137
config.getConfigFromEnvironmentVariables()
137-
if (environmentConfig) {
138-
this.updateConfiguration(environmentConfig)
139138

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-
}
139+
if (environmentVariablesUsed.length > 0) {
140+
this.updateConfiguration(environmentConfig)
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+
)
147146
}
148147

149148
if (hasConfigurationCapability) {
@@ -208,6 +207,10 @@ export default class BashServer {
208207
if (!isDeepStrictEqual(this.config, newConfig)) {
209208
this.config = newConfig
210209

210+
// NOTE: I don't really like this... An alternative would be to pass in the
211+
// shellcheck executable path when linting. We would need to handle
212+
// resetting the canLint flag though.
213+
211214
const { shellcheckPath } = this.config
212215
if (!shellcheckPath) {
213216
this.connection.console.log(

0 commit comments

Comments
 (0)