add maximum hover length

This commit is contained in:
Gabriela Araujo Britto
2025-05-05 13:57:09 -07:00
parent 7bf23c3316
commit 7a1d5016f8
3 changed files with 25 additions and 0 deletions

View File

@@ -208,6 +208,8 @@ export default class FileConfigurationManager extends Disposable {
includeCompletionsForModuleExports: config.get<boolean>('suggest.autoImports'),
...getInlayHintsPreferences(config),
...this.getOrganizeImportsPreferences(preferencesConfig),
// @ts-expect-error until TS 5.9
maximumHoverLength: this.getMaximumHoverLength(config),
};
return preferences;
@@ -257,6 +259,16 @@ export default class FileConfigurationManager extends Disposable {
} : {}),
};
}
private getMaximumHoverLength(configuration: vscode.WorkspaceConfiguration): number {
const defaultMaxLength = 500;
const maximumHoverLength = configuration.get<number>('maximumHoverLength', defaultMaxLength);
if (!Number.isSafeInteger(maximumHoverLength) || maximumHoverLength <= 0) {
return defaultMaxLength;
}
return maximumHoverLength;
}
}
function withDefaultAsUndefined<T, O extends T>(value: T, def: O): Exclude<T, O> | undefined {