Files
Arnaud Ritti f6531542de feat(plugins): add fixed filenames and file template variables (#2032)
Closes #1954

Plugin file templates could only take a typed name plus a fixed extension, so dot-files such as .dockerignore and templates needing more than a name weren't expressible. Templates (API ^1.3) can now declare a fixed `fileName` and named `variables` that the New File dialog asks for, and plugin templates get the same Java/Kotlin/Go/PHP package inference as built-in ones. Unsafe filenames and existing files are refused. The dialog no longer submits on Enter while an IME is composing, and its variable form has proper padding. Adds a file-templates test fixture.

Co-authored-by: arnaud-ritti <[email protected]>
2026-11-08 02:37:26 +08:00

39 lines
1.0 KiB
TOML

id = "file-templates"
name = "File Templates"
version = "0.1.0"
description = "API 1.3 fixture: exact filenames, variables and inferred packages."
engines.openidea = "^1.3"
wasm = "dist/plugin.wasm"
activation = ["on-command:ping"]
[[contributes.commands]]
id = "ping"
title = "File Templates: Ping"
[[contributes.fileTemplates]]
id = "dockerignore"
name = "Docker ignore"
extension = "dockerignore"
fileName = ".dockerignore"
path = "templates/dockerignore.txt"
[[contributes.fileTemplates]]
id = "attributes"
name = "Git attributes"
fileName = ".gitattributes"
path = "templates/attributes.txt"
variables = [{ name = "PATTERN", prompt = "File pattern" }, { name = "FILTER", prompt = "Attribute filter" }]
[[contributes.fileTemplates]]
id = "repository"
name = "Java repository"
extension = "java"
path = "templates/repository.txt"
variables = [{ name = "ENTITY", prompt = "Entity class" }, { name = "TABLE", prompt = "Table name" }]
[[contributes.fileTemplates]]
id = "kotlin"
name = "Kotlin entity"
extension = "kt"
path = "templates/kotlin.txt"