mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-11 21:06:23 +00:00
migrate generate new
This commit is contained in:
parent
ed193af369
commit
9cc03e01c5
6 changed files with 97 additions and 58 deletions
|
@ -5,7 +5,7 @@
|
|||
//! [`SyntaxEditor`]: https://github.com/dotnet/roslyn/blob/43b0b05cc4f492fd5de00f6f6717409091df8daa/src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs
|
||||
|
||||
use std::{
|
||||
fmt,
|
||||
fmt, iter,
|
||||
num::NonZeroU32,
|
||||
ops::RangeInclusive,
|
||||
sync::atomic::{AtomicU32, Ordering},
|
||||
|
@ -41,6 +41,15 @@ impl SyntaxEditor {
|
|||
self.annotations.push((element.syntax_element(), annotation))
|
||||
}
|
||||
|
||||
pub fn add_annotation_all(
|
||||
&mut self,
|
||||
elements: Vec<impl Element>,
|
||||
annotation: SyntaxAnnotation,
|
||||
) {
|
||||
self.annotations
|
||||
.extend(elements.into_iter().map(|e| e.syntax_element()).zip(iter::repeat(annotation)));
|
||||
}
|
||||
|
||||
pub fn merge(&mut self, mut other: SyntaxEditor) {
|
||||
debug_assert!(
|
||||
self.root == other.root || other.root.ancestors().any(|node| node == self.root),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue