-
Notifications
You must be signed in to change notification settings - Fork 47
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 crashes for clients that don't support "workspace/configuration" requests #667
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,14 +230,18 @@ export class LanguageServer { | |
/** | ||
* Ask the client for the list of `files.exclude` patterns. Useful when determining if we should process a file | ||
*/ | ||
private async getWorkspaceExcludeGlobs(workspaceFolder: string) { | ||
//get any `files.exclude` globs to use to filter | ||
let config = await this.connection.workspace.getConfiguration({ | ||
scopeUri: workspaceFolder, | ||
section: 'files' | ||
}) as { | ||
exclude: Record<string, boolean>; | ||
private async getWorkspaceExcludeGlobs(workspaceFolder: string): Promise<string[]> { | ||
let config = { | ||
exclude: {} as Record<string, boolean> | ||
}; | ||
//if supported, ask vscode for the `files.exclude` configuration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this comment use the generic "client" instead of specifically mentioning "vscode"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's true that the specific configuration options are not part of the standard. Although there are other clients such as Theia that model their settings after VS Code. |
||
if (this.hasConfigurationCapability) { | ||
//get any `files.exclude` globs to use to filter | ||
config = await this.connection.workspace.getConfiguration({ | ||
scopeUri: workspaceFolder, | ||
section: 'files' | ||
}); | ||
} | ||
return Object | ||
.keys(config?.exclude ?? {}) | ||
.filter(x => config?.exclude?.[x]) | ||
|
@@ -444,11 +448,16 @@ export class LanguageServer { | |
} else { | ||
scopeUri = URI.file(workspacePath).toString(); | ||
} | ||
//look for config group called "brightscript" | ||
let config = await this.connection.workspace.getConfiguration({ | ||
scopeUri: scopeUri, | ||
section: 'brightscript' | ||
}); | ||
let config = { | ||
configFile: undefined | ||
}; | ||
//if the client supports configuration, look for config group called "brightscript" | ||
if (this.hasConfigurationCapability) { | ||
await this.connection.workspace.getConfiguration({ | ||
scopeUri: scopeUri, | ||
section: 'brightscript' | ||
}); | ||
} | ||
let configFilePath: string; | ||
|
||
//if there's a setting, we need to find the file or show error if it can't be found | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted this totally duplicate unit test