swap between related files
- swap between related files with command or editor title button (Keybinding CTRL+B)
- allow configuration of swap patterns
- create missing File, for which a swap is configured (Keybinding CTRL+I)
Allow swapping between ts
, js
, html
, css
, spec.ts
, ... with same file name
[
{
"pattern": "^(?<path>.*?)(ts|js|css|sass|scss|html|spec.ts|spec.js|test.js|test.ts)$",
"alternatives": ["**/<path>{ts,js,css,sass,scss,html,spec.js,spec.ts}"]
}
]
Allow swapping between Java Source and Java Test File
[
{
"pattern": "^(?<rootPath>.*?)(main|test)(?<path>.*?)(Test)?.(java|kt)$",
"alternatives": ["**/<rootPath>{main,test}<path>*.{java,kt}"]
}
]
Allow swapping between Header and Source File
[
{
"pattern": "^(?<path>.*?)(cpp|c|cc|cxx|m|mm|h|hpp|hh|hxx)$",
"alternatives": ["**/<path>{cpp,c,cc,cxx,m,mm,h,hpp,hh,hxx}"]
}
]
Allow swapping between C# Source File and Additional Designer File
[
{
"pattern": "^(?<path>.*?)(cs)$",
"alternatives": ["**/<path>cs", "**/<path>*.cs"]
}
]
Allow swapping between same file name, like package.json
[
{
"pattern": "^.*?(?<file>[^/]*)$",
"alternatives": ["**/<file>"]
}
]
- open VSCode settings and change
swapf.patterns
pattern
needs to be a valid Regexp- all named groups in pattern replaces
<named_group>
in alternative - alternative are used as VSCode GlobPattern
- To get feedback during testing the OutputChannel SwapF can be used