mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Support TS's includeInlayVariableTypeHintsWhenTypeMatchesName setting (#150489)
From https://github.com/microsoft/TypeScript/pull/48529 Let users control is variable type inlay hints are suppresed if the variable name matches the type name, such as: ```ts const range = new Range(); ```
This commit is contained in:
@@ -210,6 +210,7 @@ export class InlayHintSettingNames {
|
||||
static readonly parameterNamesSuppressWhenArgumentMatchesName = 'inlayHints.parameterNames.suppressWhenArgumentMatchesName';
|
||||
static readonly parameterNamesEnabled = 'inlayHints.parameterTypes.enabled';
|
||||
static readonly variableTypesEnabled = 'inlayHints.variableTypes.enabled';
|
||||
static readonly variableTypesSuppressWhenTypeMatchesName = 'inlayHints.variableTypes.suppressWhenTypeMatchesName';
|
||||
static readonly propertyDeclarationTypesEnabled = 'inlayHints.propertyDeclarationTypes.enabled';
|
||||
static readonly functionLikeReturnTypesEnabled = 'inlayHints.functionLikeReturnTypes.enabled';
|
||||
static readonly enumMemberValuesEnabled = 'inlayHints.enumMemberValues.enabled';
|
||||
@@ -221,6 +222,7 @@ export function getInlayHintsPreferences(config: vscode.WorkspaceConfiguration)
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName: !config.get<boolean>(InlayHintSettingNames.parameterNamesSuppressWhenArgumentMatchesName, true),
|
||||
includeInlayFunctionParameterTypeHints: config.get<boolean>(InlayHintSettingNames.parameterNamesEnabled, false),
|
||||
includeInlayVariableTypeHints: config.get<boolean>(InlayHintSettingNames.variableTypesEnabled, false),
|
||||
includeInlayVariableTypeHintsWhenTypeMatchesName: !config.get<boolean>(InlayHintSettingNames.variableTypesSuppressWhenTypeMatchesName, true),
|
||||
includeInlayPropertyDeclarationTypeHints: config.get<boolean>(InlayHintSettingNames.propertyDeclarationTypesEnabled, false),
|
||||
includeInlayFunctionLikeReturnTypeHints: config.get<boolean>(InlayHintSettingNames.functionLikeReturnTypesEnabled, false),
|
||||
includeInlayEnumMemberValueHints: config.get<boolean>(InlayHintSettingNames.enumMemberValuesEnabled, false),
|
||||
|
||||
@@ -15,14 +15,15 @@ import { Position } from '../utils/typeConverters';
|
||||
import FileConfigurationManager, { getInlayHintsPreferences, InlayHintSettingNames } from './fileConfigurationManager';
|
||||
|
||||
|
||||
const inlayHintSettingNames = [
|
||||
const inlayHintSettingNames = Object.freeze([
|
||||
InlayHintSettingNames.parameterNamesSuppressWhenArgumentMatchesName,
|
||||
InlayHintSettingNames.parameterNamesEnabled,
|
||||
InlayHintSettingNames.variableTypesEnabled,
|
||||
InlayHintSettingNames.variableTypesSuppressWhenTypeMatchesName,
|
||||
InlayHintSettingNames.propertyDeclarationTypesEnabled,
|
||||
InlayHintSettingNames.functionLikeReturnTypesEnabled,
|
||||
InlayHintSettingNames.enumMemberValuesEnabled,
|
||||
];
|
||||
]);
|
||||
|
||||
class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHintsProvider {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user