Skip to content

Commit 4ed60fb

Browse files
Renamed glyph_scope to literal_scope
1 parent d426a66 commit 4ed60fb

File tree

19 files changed

+66
-66
lines changed

19 files changed

+66
-66
lines changed

cursorless-talon/src/cheatsheet/sections/modifiers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"previous_next_modifier",
1111
"forward_backward_modifier",
1212
"position",
13-
"glyph_modifier",
13+
"literal_modifier",
1414
]
1515

1616

@@ -29,7 +29,7 @@ def get_modifiers():
2929
"next",
3030
"backward",
3131
"forward",
32-
"glyph",
32+
"literal",
3333
]
3434
simple_modifiers = {
3535
key: value
@@ -104,12 +104,12 @@ def get_modifiers():
104104
],
105105
},
106106
{
107-
"id": "glyph",
107+
"id": "literal",
108108
"type": "modifier",
109109
"variations": [
110110
{
111-
"spokenForm": f"{complex_modifiers['glyph']} <glyph>",
112-
"description": "First instance of <glyph>",
111+
"spokenForm": f"{complex_modifiers['literal']} <literal>",
112+
"description": "First instance of <literal>",
113113
},
114114
],
115115
},

cursorless-talon/src/modifiers/glyph_scope.py

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from talon import Module
2+
3+
mod = Module()
4+
5+
mod.list(
6+
"cursorless_literal_scope_type",
7+
desc="Cursorless literal scope type",
8+
)
9+
mod.list(
10+
"cursorless_literal_scope_type_plural",
11+
desc="Plural version of Cursorless literal scope type",
12+
)
13+
14+
15+
@mod.capture(rule="{user.cursorless_literal_scope_type} <user.any_alphanumeric_key>")
16+
def cursorless_literal_scope_type(m) -> dict[str, str]:
17+
return {
18+
"type": "literal",
19+
"literal": m.any_alphanumeric_key,
20+
}
21+
22+
23+
@mod.capture(
24+
rule="{user.cursorless_literal_scope_type_plural} <user.any_alphanumeric_key>"
25+
)
26+
def cursorless_literal_scope_type_plural(m) -> dict[str, str]:
27+
return {
28+
"type": "literal",
29+
"literal": m.any_alphanumeric_key,
30+
}

cursorless-talon/src/modifiers/scopes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
@mod.capture(
18-
rule="{user.cursorless_scope_type} | <user.cursorless_glyph_scope_type> | {user.cursorless_custom_regex_scope_type}"
18+
rule="{user.cursorless_scope_type} | <user.cursorless_literal_scope_type> | {user.cursorless_custom_regex_scope_type}"
1919
)
2020
def cursorless_scope_type(m) -> dict[str, str]:
2121
"""Cursorless scope type singular"""
@@ -25,15 +25,15 @@ def cursorless_scope_type(m) -> dict[str, str]:
2525
pass
2626

2727
try:
28-
return m.cursorless_glyph_scope_type
28+
return m.cursorless_literal_scope_type
2929
except AttributeError:
3030
pass
3131

3232
return {"type": "customRegex", "regex": m.cursorless_custom_regex_scope_type}
3333

3434

3535
@mod.capture(
36-
rule="{user.cursorless_scope_type_plural} | <user.cursorless_glyph_scope_type_plural> | {user.cursorless_custom_regex_scope_type_plural}"
36+
rule="{user.cursorless_scope_type_plural} | <user.cursorless_literal_scope_type_plural> | {user.cursorless_custom_regex_scope_type_plural}"
3737
)
3838
def cursorless_scope_type_plural(m) -> dict[str, str]:
3939
"""Cursorless scope type plural"""
@@ -43,7 +43,7 @@ def cursorless_scope_type_plural(m) -> dict[str, str]:
4343
pass
4444

4545
try:
46-
return m.cursorless_glyph_scope_type_plural
46+
return m.cursorless_literal_scope_type_plural
4747
except AttributeError:
4848
pass
4949

cursorless-talon/src/spoken_forms.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@
171171
"surrounding_pair_scope_type": {
172172
"string": "string"
173173
},
174-
"glyph_scope_type": {
175-
"glyph": "glyph"
174+
"literal_scope_type": {
175+
"glyph": "literal"
176176
}
177177
},
178178
"paired_delimiters.csv": {

cursorless-talon/src/spoken_forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def ret(filename: str, *args: P.args, **kwargs: P.kwargs) -> R:
6868
"wrapper_only_paired_delimiter": "pairedDelimiter",
6969
"surrounding_pair_scope_type": "pairedDelimiter",
7070
"scope_type": "simpleScopeTypeType",
71-
"glyph_scope_type": "complexScopeTypeType",
71+
"literal_scope_type": "complexScopeTypeType",
7272
"custom_regex_scope_type": "customRegex",
7373
}
7474

@@ -126,7 +126,7 @@ def handle_new_values(csv_name: str, values: list[SpokenFormEntry]):
126126
handle_csv("experimental/miscellaneous.csv"),
127127
handle_csv(
128128
"modifier_scope_types.csv",
129-
pluralize_lists=["scope_type", "glyph_scope_type"],
129+
pluralize_lists=["scope_type", "literal_scope_type"],
130130
extra_allowed_values=[
131131
"private.fieldAccess",
132132
"private.switchStatementSubject",

packages/common/src/types/command/PartialTargetDescriptor.types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,17 @@ export interface OneOfScopeType {
205205
scopeTypes: ScopeType[];
206206
}
207207

208-
export interface GlyphScopeType {
209-
type: "glyph";
210-
character: string;
208+
export interface LiteralScopeType {
209+
type: "literal";
210+
literal: string;
211211
}
212212

213213
export type ScopeType =
214214
| SimpleScopeType
215215
| SurroundingPairScopeType
216216
| CustomRegexScopeType
217217
| OneOfScopeType
218-
| GlyphScopeType;
218+
| LiteralScopeType;
219219

220220
export interface ContainingSurroundingPairModifier
221221
extends ContainingScopeModifier {

packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ export class PrimitiveTargetSpokenFormGenerator {
208208
switch (scopeType.type) {
209209
case "oneOf":
210210
throw new NoSpokenFormError(`Scope type '${scopeType.type}'`);
211-
case "glyph":
211+
case "literal":
212212
return [
213-
this.spokenFormMap.complexScopeTypeType.glyph,
214-
characterToSpokenForm(scopeType.character),
213+
this.spokenFormMap.complexScopeTypeType.literal,
214+
characterToSpokenForm(scopeType.literal),
215215
];
216216
case "surroundingPair": {
217217
const pair = this.spokenFormMap.pairedDelimiter[scopeType.delimiter];

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/RegexScopeHandler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
CustomRegexScopeType,
33
Direction,
4-
GlyphScopeType,
4+
LiteralScopeType,
55
ScopeType,
66
} from "@cursorless/common";
77
import { imap } from "itertools";
@@ -69,14 +69,14 @@ export class CustomRegexScopeHandler extends RegexStageBase {
6969
}
7070
}
7171

72-
export class GlyphScopeHandler extends RegexStageBase {
72+
export class LiteralScopeHandler extends RegexStageBase {
7373
get regex() {
74-
return new RegExp(escapeRegExp(this.scopeType.character), "gui");
74+
return new RegExp(escapeRegExp(this.scopeType.literal), "gui");
7575
}
7676

7777
constructor(
7878
scopeHandlerFactory: ScopeHandlerFactory,
79-
readonly scopeType: GlyphScopeType,
79+
readonly scopeType: LiteralScopeType,
8080
languageId: string,
8181
) {
8282
super(scopeHandlerFactory, scopeType, languageId);

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/ScopeHandlerFactoryImpl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { OneOfScopeHandler } from "./OneOfScopeHandler";
88
import { ParagraphScopeHandler } from "./ParagraphScopeHandler";
99
import {
1010
CustomRegexScopeHandler,
11-
GlyphScopeHandler,
11+
LiteralScopeHandler,
1212
NonWhitespaceSequenceScopeHandler,
1313
UrlScopeHandler,
1414
} from "./RegexScopeHandler";
@@ -73,8 +73,8 @@ export class ScopeHandlerFactoryImpl implements ScopeHandlerFactory {
7373
return new UrlScopeHandler(this, scopeType, languageId);
7474
case "customRegex":
7575
return new CustomRegexScopeHandler(this, scopeType, languageId);
76-
case "glyph":
77-
return new GlyphScopeHandler(this, scopeType, languageId);
76+
case "literal":
77+
return new LiteralScopeHandler(this, scopeType, languageId);
7878
case "custom":
7979
return scopeType.scopeHandler;
8080
case "instance":

0 commit comments

Comments
 (0)