Doc more features
This commit is contained in:
parent
8915183d7d
commit
b795a07320
5 changed files with 47 additions and 54 deletions
|
|
@ -1,5 +1,3 @@
|
|||
//! This modules implements "expand macro" functionality in the IDE
|
||||
|
||||
use hir::Semantics;
|
||||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::{
|
||||
|
|
@ -14,6 +12,15 @@ pub struct ExpandedMacro {
|
|||
pub expansion: String,
|
||||
}
|
||||
|
||||
// Feature: Expand Macro Recursively
|
||||
//
|
||||
// Shows the full macro expansion of the macro at current cursor.
|
||||
//
|
||||
// |===
|
||||
// | Editor | Action Name
|
||||
//
|
||||
// | VS Code | **Rust Analyzer: Expand macro recursively**
|
||||
// |===
|
||||
pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<ExpandedMacro> {
|
||||
let sema = Semantics::new(db);
|
||||
let file = sema.parse(position.file_id);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
//! structural search replace
|
||||
|
||||
use std::{collections::HashMap, iter::once, str::FromStr};
|
||||
|
||||
use ra_db::{SourceDatabase, SourceDatabaseExt};
|
||||
|
|
@ -25,6 +23,28 @@ impl std::fmt::Display for SsrError {
|
|||
|
||||
impl std::error::Error for SsrError {}
|
||||
|
||||
// Feature: Structural Seach and Replace
|
||||
//
|
||||
// Search and replace with named wildcards that will match any expression.
|
||||
// The syntax for a structural search replace command is `<search_pattern> ==>> <replace_pattern>`.
|
||||
// A `$<name>:expr` placeholder in the search pattern will match any expression and `$<name>` will reference it in the replacement.
|
||||
// Available via the command `rust-analyzer.ssr`.
|
||||
//
|
||||
// ```rust
|
||||
// // Using structural search replace command [foo($a:expr, $b:expr) ==>> ($a).foo($b)]
|
||||
//
|
||||
// // BEFORE
|
||||
// String::from(foo(y + 5, z))
|
||||
//
|
||||
// // AFTER
|
||||
// String::from((y + 5).foo(z))
|
||||
// ```
|
||||
//
|
||||
// |===
|
||||
// | Editor | Action Name
|
||||
//
|
||||
// | VS Code | **Rust Analyzer: Structural Search Replace**
|
||||
// |===
|
||||
pub fn parse_search_replace(
|
||||
query: &str,
|
||||
parse_only: bool,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use std::{fmt, iter::FromIterator, sync::Arc};
|
||||
|
||||
use hir::MacroFile;
|
||||
|
|
@ -26,6 +24,15 @@ fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats {
|
|||
db.query(hir::db::ParseMacroQuery).entries::<SyntaxTreeStats>()
|
||||
}
|
||||
|
||||
// Feature: Status
|
||||
//
|
||||
// Shows internal statistic about memory usage of rust-analyzer.
|
||||
//
|
||||
// |===
|
||||
// | Editor | Action Name
|
||||
//
|
||||
// | VS Code | **Rust Analyzer: Status**
|
||||
// |===
|
||||
pub(crate) fn status(db: &RootDatabase) -> String {
|
||||
let files_stats = db.query(FileTextQuery).entries::<FilesStats>();
|
||||
let syntax_tree_stats = syntax_tree_stats(db);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue