简体   繁体   中英

Make WebStorm ignore .spec.js files for “Choose Declaration” dropdown

WebStorm has a nice feature that lets you cmd-click on a function and go to its definition. Since I'm writing JavaScript (w/ AngularJS), those definitions aren't always precise, and it offers a list of choices.

The frustrating thing is when WebStorm deduces that the definition is actually in a test file, and brings me to a line where I'm declaring a mock object with the same name.

Is there a way to make WebStorm ignore certain files (eg .spec.js files) when looking for function definitions?

I've tried adding *.spec.js to the "Ignore files and folders" list in the Editor > File Types dialog. This does the trick, but then I can't access any .spec.js files from within Webstorm. They're all hidden, and I can't even create new files matching that pattern.

The test files are scattered around, mostly living next to the components they test, so I can't simply exclude the tests directory, for example.

Is there another way to do this?

It seems that it's not possible. You can vote for a similar feature

I had the same problem, with a concatenated .js file. I solved it for me by "Marking the file as Plain Text" In the "Project"-Pane --> right click on a js-file --> click " Mark as Plain Text "

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