GraphiteEditor/Graphite · error · syn::Error
#[editor_commands] takes no arguments
Error message
#[editor_commands] takes no arguments
What it means
editor_commands_impl rejects any attribute argument: the macro must be written exactly as bare #[editor_commands]. Any token content inside #[editor_commands(...)] fails with this spanned error before the module is inspected.
Source
Thrown at proc-macros/src/editor_commands.rs:9
use convert_case::{Case, Casing};
use proc_macro2::TokenStream;
use quote::{quote, quote_spanned};
use syn::spanned::Spanned;
use syn::{Error, FnArg, Ident, Item, ItemFn, ItemMod, ItemUse, Pat, Visibility};
pub fn editor_commands_impl(attr: TokenStream, module: ItemMod) -> syn::Result<TokenStream> {
if !attr.is_empty() {
return Err(Error::new(attr.span(), "#[editor_commands] takes no arguments"));
}
for attr in &module.attrs {
if !attr.path().is_ident("doc") {
return Err(Error::new(attr.span(), "the #[editor_commands] module may not have other attributes"));
}
}
let Some((_, items)) = module.content else {
return Err(Error::new(module.mod_token.span, "#[editor_commands] requires a module with an inline body"));
};
let mut imports: Vec<ItemUse> = Vec::new();
let mut functions: Vec<ItemFn> = Vec::new();
for item in items {
match item {
Item::Use(import) => imports.push(import),
Item::Fn(function) => functions.push(function),
other => return Err(Error::new(other.span(), "only `use` imports and command functions may appear in an #[editor_commands] module")),
}View on GitHub (pinned to c507b35645)
Solutions
- Remove the argument and use bare #[editor_commands]
- If per-module configuration is needed, wrap or rename modules instead of passing arguments to the macro
Example fix
// before
#[editor_commands(some_arg)]
mod commands { /* ... */ }
// after
#[editor_commands]
mod commands { /* ... */ } Defensive patterns
Strategy: validation
Prevention
- Write the macro exactly as #[editor_commands] — no parentheses, no arguments
- Do not attempt per-module configuration through the attribute; it supports none
When it happens
Trigger: Writing #[editor_commands(SomeArg)] or an attribute-value form on the commands module.
Common situations: Trying to configure the macro per module (naming, scoping, feature flags) when it supports no options; autocomplete inserting parentheses with a placeholder argument.
Related errors
- the #[editor_commands] module may not have other attributes
- Failed to parse input type for #[implementation(...)]. Expec
- Expected `->` arrow after input type in #[implementations(..
- Failed to parse output type for #[implementation(...)]. Expe
- Failed to parse node_fn attributes: {e}
AI-assisted analysis of GraphiteEditor/Graphite@c507b35645 (2026-08-16).
Data as JSON: /api/errors/af37e5bfa13c7792.
Report an issue: GitHub.