在 VS Code Explorer 中,我想隱藏 TypeScript 編譯期間生成的檔案。
當有一個時my-file.ts,生成的檔案可以是:
my-file.jsmy-file.js.mapmy-file.d.ts
隱藏前兩個很容易,我需要在settings.jsonVS Code 中使用它:
{
"files.exclude": {
"**/*.js.map": true,
"**/*.js": { "when": "$(basename).ts" }
}
}
但是第三個呢?我試過這個,但它隱藏了所有.d.ts檔案,甚至是不是從.ts檔案生成的獨立檔案。
{
"files.exclude": {
"**/*.d.ts": { "when": "$(basename).ts", "__MY_PROBLEM": "It hides all .d.ts files" }
}
}
有什么建議只隱藏那些.d.ts從.ts同名檔案生成的檔案嗎?
uj5u.com熱心網友回復:
我認為隱藏*.d.ts與*.ts檔案關聯的檔案是不可能的。
請參閱https://github.com/microsoft/vscode/issues/4642,其中有些人報告說這是有效的:
"**/*.map": {
"when": "$(basename)"
}
隱藏*.js.map檔案,但我無法得到
"**/*.ts": {
"when": "$(basename)"
}
做任何事。也許你會有更好的運氣。
另請參閱https://github.com/microsoft/vscode/issues/59368不成功。
和https://github.com/microsoft/vscode/issues/40850談論.d.ts排除所有檔案的事實。關閉為“超出范圍”。但是你可以點贊。
uj5u.com熱心網友回復:
您可以關閉.d.ts發射declaration:false或將它們發射到單獨的目錄中:
// tsconfig.json
"compilerOptions": {
"declaration": true,
"declarationDir": "./types" // configure the root directory for where declaration files are emitted
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/383361.html
