vscode-fuzzy-go-to-spec
Switch between the source file and the spec.
(Why I created this extension? See Comparison at the bottom of the README.)
Commands
commands |
description |
Shortcut |
Fuzzy Go to Spec: Go to Spec |
Switch between the source and spec. |
Cmd + Shift + t |
Configurations
configuration |
description |
Default |
fuzzyGoToSpec.specPatterns |
List spec patterns. |
['.spec', '.test', '_test'] |
Add spec patterns
Open extension settings, and add your spec patterns to Fuzzy Go To Spec: SpecPatterns
.
For example, your specs are named like someFunction.unit.test.ts
, then add '.unit.test'
to the list.
After modified, Cmd + Shift + P
-> 「Developer: Reload Window」
Comparison to Other switchers
There are some great formers, but almost all has problems.
- Cannot switch between the source and spec when their extensions are not the same
- Cannot switch properly if custom patterns are configured
- Cannot determine proper spec if file names are duplicated
So I created the same extension from scratch, and aim for...
- Enable to toggle even if extension is not the same (e.g.
toast.tsx
<=> toast.test.ts
, Button.vue
<=> Button.test.ts
)
- Enable to toggle even if spec patterns are specific (e.g.
toast.ts
<=> toast.unit.test.ts
)
- Enable to toggle even if source file name is not unique (e.g.
index.ts
<=> index.test.ts
)
This extension uses smart regexp patterns to accomplish 1 and 2, and uses fast-fuzzy to accomplish 3.