File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,9 @@ export default function addImportStatement(
2929 // Insert the import statement at the top of the document
3030 const edit = new vscode . WorkspaceEdit ( ) ;
3131 edit . insert ( document . uri , new vscode . Position ( 0 , 0 ) , importStatement ) ;
32- vscode . workspace . applyEdit ( edit ) ;
32+ vscode . workspace . applyEdit ( edit ) . then ( ( ) => {
33+ saveDocument ( document ) ;
34+ } ) ;
3335}
3436
3537function calculateRelativePath (
@@ -66,3 +68,16 @@ function calculateRelativePath(
6668
6769 return relativePath ;
6870}
71+
72+ function saveDocument ( document : vscode . TextDocument ) {
73+ if ( document . isDirty ) {
74+ document . save ( ) . then (
75+ ( ) => {
76+ vscode . window . showInformationMessage ( 'Stack created successfully 🎉' ) ;
77+ } ,
78+ ( err ) => {
79+ vscode . window . showErrorMessage ( `Error saving document: ${ err } ` ) ;
80+ }
81+ ) ;
82+ }
83+ }
You can’t perform that action at this time.
0 commit comments