Vscode Typescript:显示类型的别名而不是其定义
Vscode Typescript: Display alias of type rather than its definition
我有以下代码
type Opaque<T,U> = T & {_:U};
type EKey = Opaque<number,'EKey'>;
type AKey = Opaque<EKey,'AKey'>;
type PKey = Opaque<AKey,'PKey'>;
let a = <PKey>1;
let b:EKey = a;
当我移动到 a
时,我希望它显示 PKey
而不是 Opaque<Opaque<Opaque<"EKey">,"AKey">,"PKey">
。
有没有办法使用内置 vscode 选项或使用 vscode API 编写我自己的 vscode 扩展?
您可以通过编写自己的打字稿语言服务器插件并覆盖 getQuickInfoAtPosition
.
来更改快速信息
https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin
我有以下代码
type Opaque<T,U> = T & {_:U};
type EKey = Opaque<number,'EKey'>;
type AKey = Opaque<EKey,'AKey'>;
type PKey = Opaque<AKey,'PKey'>;
let a = <PKey>1;
let b:EKey = a;
当我移动到 a
时,我希望它显示 PKey
而不是 Opaque<Opaque<Opaque<"EKey">,"AKey">,"PKey">
。
有没有办法使用内置 vscode 选项或使用 vscode API 编写我自己的 vscode 扩展?
您可以通过编写自己的打字稿语言服务器插件并覆盖 getQuickInfoAtPosition
.
https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin