microsoft / microsoft/TypeScript
[Feature Request] [Typescript Extension] Less redundant inlay hints for arrow function vars/consts
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.3k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 132
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xác định phần triển khai inlay-hints của TypeScript và cài đặt “Variable Types: Suppress When Type Matches Name”. So sánh gợi ý kiểu trả về hiện có của hàm mũi tên với việc chặn gợi ý biến được yêu cầu, sau đó bổ sung độ bao phủ cho thấy các gợi ý biến dư thừa bị ẩn trong khi các gợi ý trả về vẫn còn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- developer-experience
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100