Lazy New File README
Lazy new file allows you to quickly create a new file based on the path of the currently open file in your editor.
Create one or multiple files in any project, quickly and easily.
Contributes
Contributes the following:
lazy-lazy-new-file.lazyNewFile
command
- Three configuration options:
lnf.alwaysUseCurrentFile
– by default we will always use the
filepath of the currently open file to determine where the new file will be
created, but just in case you use this in a multiple workspace environment,
you a selector will appear to determine which workspace to use.
NOTE: This will ALWAYS default to the root of that workspace.
lnf.openAfterCreate
– Open the new file after creating it.
lnf.showExplorerItem
– show the "Lazy New File" item in the explorer context.
lnf.aliases
– Aliases for the current workspace.
lnf.ladderOpen
– When creating multiple files, alternate between opening them on the left and right panes.
- Adds a "Lazy New File" to the context menu on the explorer files. Does not
show up for folders as the behavior is mimicked by VSCode already.
Keybindings
By default there are no added keybindings. I would recommend something
like ctrl+alt+n
on Windows
Creating multiple files
Creating multiple files in one prompt requires you to use a comma in the input field. The comma can be top level, or can be nested within a set of curly brackets({}
)
These follow the same rules as the rest of the extension: if it matches an alias, it will be created from the given directory the alias is associated with.
Otherwise it will be based on the current file.
Examples
# Assume we have `src/somefile.html` open
`a.ts,b.ts` -> `src/a.ts` + `src/b.ts`
`$routes/a/{+page.ts,+page.svelte}` -> `src/routes/a/+page.ts` + `src/routes/a/+page.svelte`
`$root/a.ts,b.ts` -> `/a.ts` + `src/b.ts`
`lib/{something/index.ts,something-else.ts,something-else-else.ts}` -> `src/lib/something/index.ts` + `src/lib/something-else.ts` + `src/lib/something-else-else.ts`
Aliases
Aliases should be unique among themselves and not nested. Both the shortcut and the expanded value should end with slashes
✅ Examples of good aliases
"lnf.aliases": {
"$src/": "${workspaceRoot}/src/",
"$lib/": "${workspaceRoot}/lib/"
}
❌ Examples of bad aliases
"lnf.aliases": {
"$src/": "${workspaceRoot}/src",
// This item will never be matched because the extensions exists on first match
"$src/lib": "${workspaceRoot}/src/lib"
}