pub struct SourceChangeBuilder {
pub edit: TextEditBuilder,
pub file_id: FileId,
pub source_change: SourceChange,
pub command: Option<Command>,
pub file_editors: FxHashMap<FileId, SyntaxEditor>,
pub snippet_annotations: Vec<(AnnotationSnippet, SyntaxAnnotation)>,
mutated_tree: Option<TreeMutator>,
pub snippet_builder: Option<SnippetBuilder>,
}Fields§
§edit: TextEditBuilder§file_id: FileId§source_change: SourceChange§command: Option<Command>§file_editors: FxHashMap<FileId, SyntaxEditor>Keeps track of all edits performed on each file
snippet_annotations: Vec<(AnnotationSnippet, SyntaxAnnotation)>Keeps track of which annotations correspond to which snippets
mutated_tree: Option<TreeMutator>Maps the original, immutable SyntaxNode to a clone_for_update twin.
snippet_builder: Option<SnippetBuilder>Keeps track of where to place snippets
Implementations§
Source§impl SourceChangeBuilder
impl SourceChangeBuilder
pub fn new(file_id: impl Into<FileId>) -> SourceChangeBuilder
pub fn edit_file(&mut self, file_id: impl Into<FileId>)
pub fn make_editor(&self, node: &SyntaxNode) -> SyntaxEditor
pub fn add_file_edits( &mut self, file_id: impl Into<FileId>, editor: SyntaxEditor, )
pub fn make_placeholder_snippet(&mut self, _cap: SnippetCap) -> SyntaxAnnotation
pub fn make_tabstop_before(&mut self, _cap: SnippetCap) -> SyntaxAnnotation
pub fn make_tabstop_after(&mut self, _cap: SnippetCap) -> SyntaxAnnotation
fn commit(&mut self)
Sourcepub fn insert(&mut self, offset: TextSize, text: impl Into<String>)
pub fn insert(&mut self, offset: TextSize, text: impl Into<String>)
Append specified text at the given offset
Sourcepub fn replace(&mut self, range: TextRange, replace_with: impl Into<String>)
pub fn replace(&mut self, range: TextRange, replace_with: impl Into<String>)
Replaces specified range of text with a given string.
pub fn replace_ast<N: AstNode>(&mut self, old: N, new: N)
pub fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>)
pub fn move_file(&mut self, src: impl Into<FileId>, dst: AnchoredPathBuf)
Sourcepub fn trigger_parameter_hints(&mut self)
pub fn trigger_parameter_hints(&mut self)
Triggers the parameter hint popup after the assist is applied
Sourcepub fn add_tabstop_before(&mut self, _cap: SnippetCap, node: impl AstNode)
pub fn add_tabstop_before(&mut self, _cap: SnippetCap, node: impl AstNode)
Adds a tabstop snippet to place the cursor before node
Sourcepub fn add_tabstop_before_token(&mut self, _cap: SnippetCap, token: SyntaxToken)
pub fn add_tabstop_before_token(&mut self, _cap: SnippetCap, token: SyntaxToken)
Adds a tabstop snippet to place the cursor before token
Sourcepub fn add_tabstop_after_token(&mut self, _cap: SnippetCap, token: SyntaxToken)
pub fn add_tabstop_after_token(&mut self, _cap: SnippetCap, token: SyntaxToken)
Adds a tabstop snippet to place the cursor after token
Sourcepub fn add_placeholder_snippet(&mut self, _cap: SnippetCap, node: impl AstNode)
pub fn add_placeholder_snippet(&mut self, _cap: SnippetCap, node: impl AstNode)
Adds a snippet to move the cursor selected over node
fn add_snippet(&mut self, snippet: PlaceSnippet)
fn add_snippet_annotation( &mut self, kind: AnnotationSnippet, ) -> SyntaxAnnotation
pub fn finish(self) -> SourceChange
Auto Trait Implementations§
impl Freeze for SourceChangeBuilder
impl !RefUnwindSafe for SourceChangeBuilder
impl !Send for SourceChangeBuilder
impl !Sync for SourceChangeBuilder
impl Unpin for SourceChangeBuilder
impl UnsafeUnpin for SourceChangeBuilder
impl !UnwindSafe for SourceChangeBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more