From 3d9997889bfe536a96e70535ab208a6e7ff3bc12 Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Tue, 23 Jun 2020 19:07:42 +1000 Subject: SSR: Add initial support for placeholder constraints --- crates/ra_ide/src/ssr.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ra_ide/src/ssr.rs') diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs index 9f8e540c0..b3e9e5dfe 100644 --- a/crates/ra_ide/src/ssr.rs +++ b/crates/ra_ide/src/ssr.rs @@ -10,6 +10,18 @@ use ra_ssr::{MatchFinder, SsrError, SsrRule}; // The syntax for a structural search replace command is ` ==>> `. // A `$` placeholder in the search pattern will match any AST node and `$` will reference it in the replacement. // Within a macro call, a placeholder will match up until whatever token follows the placeholder. +// +// Placeholders may be given constraints by writing them as `${::...}`. +// +// Supported constraints: +// +// |=== +// | Constraint | Restricts placeholder +// +// | kind(literal) | Is a literal (e.g. `42` or `"forty two"`) +// | not(a) | Negates the constraint `a` +// |=== +// // Available via the command `rust-analyzer.ssr`. // // ```rust -- cgit v1.2.3