File Scaffolder
Create new files with the correct extension and basic scaffolding straight from
the Explorer right-click menu — the way PHPStorm's New → Vue File / PHP Class
works.
Right-click a folder in the Explorer, choose New From Template, pick a
template, type a name, and the file is created (with sensible starter content)
and opened for editing.
Templates
| Template |
Output |
Notes |
| Vue Component |
Name.vue |
<script setup lang="ts"> + <template> + <style scoped> |
| PHP Class |
Name.php |
declare(strict_types=1) + namespace + class Name {} |
| PHP Interface |
Name.php |
Same, emitting interface Name {} |
Names are normalised to PascalCase for the file name and symbol.
PSR-4 namespace inference
For PHP files, the extension walks up to the nearest composer.json, reads its
autoload / autoload-dev PSR-4 map, and derives the namespace from the target
folder's path relative to the matched source root (longest-prefix match).
Example — with composer.json mapping "App\\": "src/", a class created in
src/Enscribe/Entity/ gets namespace App\Enscribe\Entity;. If no matching
mapping is found it falls back to a best-effort namespace from the path.
Settings
| Setting |
Default |
Description |
fileScaffolder.vue.scriptSetup |
true |
Use <script setup lang="ts"> (vs Options API defineComponent) |
fileScaffolder.vue.scopedStyles |
true |
Include a <style scoped> block |
fileScaffolder.php.strictTypes |
true |
Emit declare(strict_types=1); (per-folder overridable) |
fileScaffolder.php.inferNamespace |
true |
Infer the PHP namespace from composer.json PSR-4 (per-folder overridable) |
The PHP settings are resource-scoped: the defaults apply everywhere with no
configuration, and any single project can override them via its own
.vscode/settings.json (e.g. a legacy project that shouldn't emit
declare(strict_types=1);).
Usage from the Command Palette
The templates are also available from the Command Palette (prefixed New:),
in which case the file is created in the first workspace folder.
Development
npm install
npm run compile # type-check + bundle to dist/
npm run watch # incremental build
npm run lint
npm run format
Press F5 to launch an Extension Development Host.
License
MIT © Daniel Winning