Skip to content

Commit

Permalink
services: fix config check in process start (#1882)
Browse files Browse the repository at this point in the history
LanguageServerConfig.enable was mistyped and the linter got it wrong.
There's a chance this is happening in other places, I'd recommend
reviewing all changes from `!== false` or `=== false` to simple truthy
checks.

Related to #1881.

Co-authored-by: francisco souza <fsouza@users.noreply.github.com>
  • Loading branch information
fsouza and fsouza authored May 10, 2020
1 parent 4d7d5e2 commit ed722a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ export class ServiceManager extends EventEmitter implements Disposable {
if (!created) {
if (typeof name == 'string' && !client) {
let config: LanguageServerConfig = workspace.getConfiguration().get<{ key: LanguageServerConfig }>('languageserver', {} as any)[name]
if (!config || !config.enable) return
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
if (!config || config.enable === false) return
let opts = getLanguageServerOptions(id, name, config)
if (!opts) return
client = new LanguageClient(id, name, opts[1], opts[0])
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export interface LanguageServerConfig {
disableDiagnostics?: boolean
filetypes: string[]
additionalSchemes: string[]
enable: boolean
enable?: boolean
args?: string[]
cwd?: string
env?: any
Expand Down

0 comments on commit ed722a1

Please sign in to comment.