-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
indicate when a cell is dirty wrt the server
- Loading branch information
Jake Donham
committed
May 1, 2024
1 parent
a8b81ce
commit b3a6e6c
Showing
8 changed files
with
71 additions
and
19 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
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
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,27 @@ | ||
import type { TextDocumentChangeEvent } from "vscode"; | ||
import { NotebookEdit, WorkspaceEdit, workspace } from "vscode"; | ||
|
||
export function handleDidChangeTextDocument(e: TextDocumentChangeEvent) { | ||
if (e.document.uri.scheme !== "vscode-notebook-cell") { | ||
return; | ||
} | ||
const notebook = workspace.notebookDocuments.find( | ||
(notebook) => notebook.uri.path === e.document.uri.path | ||
); | ||
if (!notebook) { | ||
return; | ||
} | ||
const cell = notebook | ||
.getCells() | ||
.find((cell) => cell.document.uri.fragment === e.document.uri.fragment); | ||
if (!cell) { | ||
return; | ||
} | ||
|
||
const metadata = { ...cell.metadata, docDirty: true }; | ||
const edit = new WorkspaceEdit(); | ||
edit.set(notebook.uri, [ | ||
NotebookEdit.updateCellMetadata(cell.index, metadata), | ||
]); | ||
workspace.applyEdit(edit); | ||
} |
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