дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
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]>
16 рядки
440 B
Rust
16 рядки
440 B
Rust
use openidea_plugin::{Error, Invocation, Plugin, register_plugin};
|
|
|
|
#[derive(Default)]
|
|
struct FileTemplates;
|
|
|
|
impl Plugin for FileTemplates {
|
|
fn run_command(&mut self, id: &str, _ctx: &Invocation, _arg: Option<&str>) -> Result<Option<String>, Error> {
|
|
match id {
|
|
"ping" => Ok(Some("File templates ready".into())),
|
|
_ => Err(Error::NotFound(id.into())),
|
|
}
|
|
}
|
|
}
|
|
|
|
register_plugin!(FileTemplates);
|