mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +01:00
fix: send user preferences to TS server even without visible editor
When ensureConfigurationForDocument is called and no visible text editor is found for the document, getFormattingOptions returns undefined and the method returns early without sending any configuration including user preferences like preferTypeOnlyAutoImports to the TS server. This causes source.addMissingImports to ignore the user's preferTypeOnlyAutoImports setting. Fix by falling back to undefined formatting options when no visible editor is found, ensuring user preferences are always sent. Closes #272479
This commit is contained in:
@@ -53,10 +53,9 @@ export default class FileConfigurationManager extends Disposable {
|
||||
document: vscode.TextDocument,
|
||||
token: vscode.CancellationToken
|
||||
): Promise<void> {
|
||||
const formattingOptions = this.getFormattingOptions(document);
|
||||
if (formattingOptions) {
|
||||
return this.ensureConfigurationOptions(document, formattingOptions, token);
|
||||
}
|
||||
const formattingOptions = this.getFormattingOptions(document)
|
||||
?? { tabSize: undefined, insertSpaces: undefined };
|
||||
return this.ensureConfigurationOptions(document, formattingOptions, token);
|
||||
}
|
||||
|
||||
private getFormattingOptions(document: vscode.TextDocument): FormattingOptions | undefined {
|
||||
|
||||
Reference in New Issue
Block a user