-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notebook cell scope provider (#2693)
Fixes #1053 Related #1052 I'm sure how we're gonna support the python comment style cells ```py # %% print("hello") ``` We have tests for them: https://github.com/cursorless-dev/cursorless/blob/56ad4c5cef3f8c8267a098a375cf9139cbbfb0ff/data/fixtures/recorded/selectionTypes/pourCell.yml But they are not a cell scope you can actually target. Tree sitter just sees these as a comment and a function call. We could 1. Remove them. I'm probably leaning towards this. 2. Try to use regular expression to actually support them properly. That means we're back to language specific implementations in typescript. 3. Do what we did before and just yield the current position as a notebook target. Feels very hacky and not something I would like to do. ## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet --------- Co-authored-by: Phil Cohen <[email protected]>
- Loading branch information
1 parent
09eb32b
commit 9b4bb24
Showing
26 changed files
with
299 additions
and
272 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
import type { TextDocument } from "./TextDocument"; | ||
|
||
export interface NotebookCell { | ||
/** | ||
* The index of this cell in its containing notebook. The | ||
* index is updated when a cell is moved within its notebook. The index is `-1` | ||
* when the cell has been removed from its notebook. | ||
*/ | ||
readonly index: number; | ||
|
||
/** | ||
* The kind of this cell. | ||
*/ | ||
readonly kind: NotebookCellKind; | ||
|
||
/** | ||
* The {@link TextDocument} of this cell. | ||
*/ | ||
readonly document: TextDocument; | ||
} | ||
|
||
export enum NotebookCellKind { | ||
/** | ||
* A markup-cell is formatted source that is used for display. | ||
*/ | ||
Markup = 1, | ||
|
||
/** | ||
* A code-cell. | ||
*/ | ||
Code = 2, | ||
} |
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,22 @@ | ||
import type { URI } from "vscode-uri"; | ||
import type { NotebookCell } from "./NotebookCell"; | ||
|
||
export interface NotebookEditor { | ||
/** | ||
* The associated uri for this document. | ||
* | ||
* *Note* that most documents use the `file`-scheme, which means they are files on disk. However, **not** all documents are | ||
* saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk. | ||
*/ | ||
readonly uri: URI; | ||
|
||
/** | ||
* The number of cells in the notebook. | ||
*/ | ||
readonly cellCount: number; | ||
|
||
/** | ||
* The cells of this notebook. | ||
*/ | ||
readonly cells: NotebookCell[]; | ||
} |
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
Oops, something went wrong.