pub fn to_text_edit(&self, cfg: InsertUseConfig) -> Option<TextEdit> {
        let _p = profile::span("ImportEdit::to_text_edit");

        let rewriter =
            insert_use::insert_use(&self.scope, mod_path_to_ast(&self.import.import_path), cfg);
        let old_ast = rewriter.rewrite_root()?;
        let mut import_insert = TextEdit::builder();
        algo::diff(&old_ast, &rewriter.rewrite(&old_ast)).into_text_edit(&mut import_insert);

        Some(import_insert.finish())
    }
/// Attempts to insert the import to the given scope, producing a text edit.
/// May return no edit in edge cases, such as scope already containing the import.
Attempts to insert the import to the given scope, producing a text edit.
May return no edit in edge cases, such as scope already containing the import.
Attempts to insert the import to the given scope producing a text edit . May return no edit in edge cases such as scope already containing the import .
pub fn to_text_edit(&self, cfg: InsertUseConfig) -> Option<TextEdit> {
        let _p = profile::span("ImportEdit::to_text_edit");
        let rewriter =
            insert_use::insert_use(&self.scope, mod_path_to_ast(&self.import.import_path), cfg);
        let old_ast = rewriter.rewrite_root()?;
        let mut import_insert = TextEdit::builder();
        algo::diff(&old_ast, &rewriter.rewrite(&old_ast)).into_text_edit(&mut import_insert);
        Some(import_insert.finish())
    }
pub fn to_text_edit ( & self , cfg : InsertUseConfig ) -> Option < TextEdit > { let _p = profile :: span ( " " ) ; let rewriter = insert_use :: insert_use ( & self . scope , mod_path_to_ast ( & self . import . import_path ) , cfg ) ; let old_ast = rewriter . rewrite_root ( ) ? ; let mut import_insert = TextEdit :: builder ( ) ; algo :: diff ( & old_ast , & rewriter . rewrite ( & old_ast ) ) . into_text_edit ( & mut import_insert ) ; Some ( import_insert . finish ( ) ) }
Attempts to insert the import to the given scope, producing a text edit.
Attempts to insert the import to the given scope producing a text edit .
&self
cfg
InsertUseConfig
&self
cfg
InsertUseConfig