简体   繁体   English

WebStorm和TypeScript:如何导航到* .ts而不是* .d.ts

[英]WebStorm & TypeScript: how to navigate to *.ts instead of *.d.ts

When using WebStorm / PhpStorm / IntelliJ IDEA... 使用WebStorm / PhpStorm / IntelliJ IDEA时......

When I navigate to a file it always pulls up the *.d.ts type definition file instead of the source *.ts 当我导航到一个文件时,它总是拉出*.d.ts类型定义文件而不是源*.ts

How can I go right to the source *.ts ? 我怎样才能找到源*.ts

I tried marking the *.d.ts files as text, or registering the *.d.ts pattern under the "Text" file type. 我尝试将*.d.ts文件标记为文本,或者在“Text”文件类型下注册*.d.ts模式。 The icons change on these files but the navigation still ends up on the *.d.ts file. 图标会在这些文件上发生变化,但导航仍会在*.d.ts文件中结束。

If I include *.d.ts under the file types to ignore (in Settings), they won't get recognized for things like version control -- I just want to affect navigation. 如果我在要忽略的文件类型下包含*.d.ts (在“设置”中),它们将无法识别版本控制之类的东西 - 我只想影响导航。

This seems like it would be a problem that would affect ALL typescript users... what am I missing? 这似乎是一个会影响所有打字用户的问题...... 我错过了什么?

See: Related but different issue (I want *.ts not *.js ) 请参阅: 相关但不同的问题 (我希望*.ts不是*.js

.

UPDATE (Mar-20-2017): 更新(2017年3月20日):

As of WebStorm 2017.1 , registering the *.d.ts pattern under the "Text" file type WORKS for me. WebStorm 2017.1开始 ,在“Text”文件下注册*.d.ts模式,为我输入WORKS Problem solved! 问题解决了!

.

如有任何进展,请投票通知WEB-23618

When I navigate to a file it always pulls up the *.d.ts type definition file instead of the source *.ts 当我导航到一个文件时,它总是拉出* .d.ts类型定义文件而不是源* .ts

Libraries normally ship with .js + .d.ts right next to each other. 库通常与.js + .d.ts一起.d.ts They may or may not ship with the source .ts files. 它们可能带有或不带有源.ts文件。

To find the ts files you need to see the library's node_modules/library/src or something like that. 要查找ts文件,您需要查看库的node_modules/library/src或类似的东西。 It may be there or might be .npmignore d. 它可能存在或可能存在.npmignore d。 Best thing to do is lookup the library on github / or whereever it is published from 🌹 最好的办法是在github上查找库,或者从published发布它

UPDATE (Mar-20-2017): 更新(2017年3月20日):

As of WebStorm 2017.1 , registering the *.d.ts pattern under the "Text" file type WORKS for me (Settings/Editor/File Types). WebStorm 2017.1开始 ,在“Text”文件下注册*.d.ts模式,为我输入WORKS (设置/编辑器/文件类型)。 Problem solved! 问题解决了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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