microsoft / microsoft/TypeScript
[Feature Request] [Typescript Extension] Less redundant inlay hints for arrow function vars/consts
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
Example ts file without inlay hints:
```ts
//No inlay hints
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext = createContext();
export const usePixi = () => useContext(PixiContext)!;
```
Example ts file with all inlay hints:
```ts
//All inlay hints
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext /*: Context | undefined>*/ = createContext();
export const usePixi /*: () => Application*/ = () /*: Application<...*/ => useContext(PixiContext)!;
```
My suggestion is to extend the `TypeScript › Inlay Hints › Variable Types: Suppress When Type Matches Name` setting to also hide the inlay hint for a variable/constant when its value is an **arrow function** that already displays its own return type inlay hint.
Example ts file with my suggestion:
```ts
//Feature suggestion
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext /*: Context | undefined>*/ = createContext();
export const usePixi = () /*: Application*/ => useContext(PixiContext)!;
```
This would avoid redundant type information when the variable name and the function's return type provide sufficient context.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位 TypeScript 的内嵌提示实现以及“Variable Types: Suppress When Type Matches Name”设置。比较现有的箭头函数返回类型提示与所请求的变量提示抑制,然后添加测试覆盖,展示冗余的变量提示会被隐藏,而返回提示仍然保留。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- developer-experience
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100