pub struct SourceChangeBuilder {
edit: TextEditBuilder,
pub file_id: FileId,
pub source_change: SourceChange,
pub command: Option<Command>,
file_editors: FxHashMap<FileId, SyntaxEditor>,
snippet_annotations: Vec<(AnnotationSnippet, SyntaxAnnotation)>,
}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
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
fn add_snippet_annotation( &mut self, kind: AnnotationSnippet, ) -> SyntaxAnnotation
pub fn finish(self) -> SourceChange
Auto Trait Implementations§
impl !RefUnwindSafe for SourceChangeBuilder
impl !Send for SourceChangeBuilder
impl !Sync for SourceChangeBuilder
impl !UnwindSafe for SourceChangeBuilder
impl Freeze for SourceChangeBuilder
impl Unpin for SourceChangeBuilder
impl UnsafeUnpin 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