From 1ef2c0613134633ef0fe0d515f7d416e482f07fb Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Mon, 4 Mar 2019 09:19:46 +0200 Subject: Allow syntax strings to contain test markers We simply remove all the CUSTOM_MARKERS before attempting to parse the file. This allows for the syntax selection to work with most of the test strings. --- crates/ra_ide_api/src/syntax_tree.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ra_ide_api/src/syntax_tree.rs b/crates/ra_ide_api/src/syntax_tree.rs index cdee63d59..bbe9222b4 100644 --- a/crates/ra_ide_api/src/syntax_tree.rs +++ b/crates/ra_ide_api/src/syntax_tree.rs @@ -71,7 +71,9 @@ fn syntax_tree_for_token(node: &T, text_range: TextRange) -> Option .trim_start_matches('"') .trim_end_matches('#') .trim_end_matches('"') - .trim(); + .trim() + // Remove custom markers + .replace("<|>", ""); let parsed = SourceFile::parse(&text); -- cgit v1.2.3