-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create way to remove editor by id and current editor
- Loading branch information
Showing
6 changed files
with
84 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as vscode from "vscode"; | ||
import ActiveProjectService from "../service/active-project-service"; | ||
import WorkspaceService from "../service/workspace-service"; | ||
|
||
export function createRemoveCurrentEditorCommand( | ||
workspaceService: WorkspaceService, | ||
activeProjectService: ActiveProjectService | ||
) { | ||
return async () => { | ||
let activeEditor = vscode.window.activeTextEditor; | ||
if (!activeEditor) { | ||
return; | ||
} | ||
activeProjectService.removeEditorByName(activeEditor.document.fileName); | ||
workspaceService.saveWorkspace(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ActiveProjectService from "../service/active-project-service"; | ||
import WorkspaceService from "../service/workspace-service"; | ||
|
||
export function createRemoveEditorByIdCommand( | ||
workspaceService: WorkspaceService, | ||
activeProjectService: ActiveProjectService | ||
) { | ||
return (id: number) => { | ||
return async () => { | ||
const didRemove = activeProjectService.removeEditorById(id); | ||
if (didRemove) { | ||
workspaceService.saveWorkspace(); | ||
} | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters