简体   繁体   中英

TypeScript files display two sets of inlay hints

Using Visual Studio Code v1.70.1, with Typescript 4.9-dev.20220815

Here is my settings.json configuration for inlay hints:

"typescript.inlayHints.parameterNames.enabled": "all",
"typescript.inlayHints.enumMemberValues.enabled": true,
"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName": true,
"typescript.inlayHints.functionLikeReturnTypes.enabled": true,
"typescript.inlayHints.parameterTypes.enabled": true,
"typescript.inlayHints.propertyDeclarationTypes.enabled": true,
"typescript.inlayHints.variableTypes.enabled": true,

In .tsx files, this works as intended, producing one inlay hint with the styling I have defined:

Header.tsx

镶嵌提示正常工作

However, in regular .ts files, two sets of inlay hints are produced where there should only be one, with on with the correct styling and one without:

两个镶嵌提示

Disabling inlay hints entirely with editor.inlayHints.enabled": "off" removes the ones with the correct styling, bu the erroneous hints are still there. Upon creating a new files this does not change either.

This issue was being caused by having another extension (specifically TypeScript Hero), which was also trying to add inlay hints. Removing the extension leaves just the built-in inlay hints.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM