-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tighten Talon marks type hints (#1848)
This removes a bunch of `Any`s from the Talon code related to marks. Ref: #725 ## 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)~ - [x] I have not broken the cheatsheet
- Loading branch information
1 parent
b2ca68b
commit 531417f
Showing
6 changed files
with
58 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import Literal, TypedDict, Union | ||
|
||
|
||
class DecoratedSymbol(TypedDict): | ||
type: Literal["decoratedSymbol"] | ||
symbolColor: str | ||
character: str | ||
|
||
|
||
SimpleMark = dict[Literal["type"], str] | ||
|
||
LineNumberType = Literal["modulo100", "relative"] | ||
|
||
|
||
class LineNumberMark(TypedDict): | ||
type: Literal["lineNumber"] | ||
lineNumberType: LineNumberType | ||
lineNumber: int | ||
|
||
|
||
class LineNumberRange(TypedDict): | ||
type: Literal["range"] | ||
anchor: LineNumberMark | ||
active: LineNumberMark | ||
excludeAnchor: bool | ||
excludeActive: bool | ||
|
||
|
||
LineNumber = Union[LineNumberMark, LineNumberRange] | ||
|
||
Mark = Union[DecoratedSymbol, SimpleMark, LineNumber] |
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