Skip to content

Commit 4b8ced9

Browse files
Renamed to maybe
1 parent 39710bd commit 4b8ced9

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

packages/cursorless-engine/src/processTargets/modifiers/ContainingScopeStage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class ContainingScopeStage implements ModifierStage {
3434
run(target: Target): Target[] {
3535
const { scopeType, ancestorIndex = 0 } = this.modifier;
3636

37-
const scopeHandler = this.scopeHandlerFactory.tryCreate(
37+
const scopeHandler = this.scopeHandlerFactory.maybeCreate(
3838
scopeType,
3939
target.editor.document.languageId,
4040
);

packages/cursorless-engine/src/processTargets/modifiers/EveryScopeStage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class EveryScopeStage implements ModifierStage {
3939
const { scopeType } = this.modifier;
4040
const { editor, isReversed } = target;
4141

42-
const scopeHandler = this.scopeHandlerFactory.tryCreate(
42+
const scopeHandler = this.scopeHandlerFactory.maybeCreate(
4343
scopeType,
4444
editor.document.languageId,
4545
);
@@ -108,7 +108,7 @@ export class EveryScopeStage implements ModifierStage {
108108
scopeHandlerFactory: ScopeHandlerFactory,
109109
target: Target,
110110
): Range[] {
111-
const iterationScopeHandler = scopeHandlerFactory.tryCreate(
111+
const iterationScopeHandler = scopeHandlerFactory.maybeCreate(
112112
scopeHandler.iterationScopeType,
113113
target.editor.document.languageId,
114114
);

packages/cursorless-engine/src/processTargets/modifiers/RelativeScopeStage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class RelativeScopeStage implements ModifierStage {
3131
) {}
3232

3333
run(target: Target): Target[] {
34-
const scopeHandler = this.scopeHandlerFactory.tryCreate(
34+
const scopeHandler = this.scopeHandlerFactory.maybeCreate(
3535
this.modifier.scopeType,
3636
target.editor.document.languageId,
3737
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ScopeType } from "@cursorless/common";
22
import type { CustomScopeType, ScopeHandler } from "./scopeHandler.types";
33

44
export interface ScopeHandlerFactory {
5-
tryCreate(
5+
maybeCreate(
66
scopeType: ScopeType | CustomScopeType,
77
languageId: string,
88
): ScopeHandler | undefined;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ import type { CustomScopeType, ScopeHandler } from "./scopeHandler.types";
4545
*/
4646
export class ScopeHandlerFactoryImpl implements ScopeHandlerFactory {
4747
constructor(private languageDefinitions: LanguageDefinitions) {
48-
this.tryCreate = this.tryCreate.bind(this);
48+
this.maybeCreate = this.maybeCreate.bind(this);
4949
this.create = this.create.bind(this);
5050
}
5151

52-
tryCreate(
52+
maybeCreate(
5353
scopeType: ScopeType | CustomScopeType,
5454
languageId: string,
5555
): ScopeHandler | undefined {
@@ -120,7 +120,7 @@ export class ScopeHandlerFactoryImpl implements ScopeHandlerFactory {
120120
scopeType: ScopeType | CustomScopeType,
121121
languageId: string,
122122
): ScopeHandler {
123-
const handler = this.tryCreate(scopeType, languageId);
123+
const handler = this.maybeCreate(scopeType, languageId);
124124
if (handler == null) {
125125
throw new Error(`Couldn't create scope handler for '${scopeType.type}'`);
126126
}

packages/cursorless-engine/src/scopeProviders/ScopeRangeProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ScopeRangeProvider {
2929
editor: TextEditor,
3030
{ scopeType, visibleOnly }: ScopeRangeConfig,
3131
): ScopeRanges[] {
32-
const scopeHandler = this.scopeHandlerFactory.tryCreate(
32+
const scopeHandler = this.scopeHandlerFactory.maybeCreate(
3333
scopeType,
3434
editor.document.languageId,
3535
);
@@ -50,7 +50,7 @@ export class ScopeRangeProvider {
5050
{ scopeType, visibleOnly, includeNestedTargets }: IterationScopeRangeConfig,
5151
): IterationScopeRanges[] {
5252
const { languageId } = editor.document;
53-
const scopeHandler = this.scopeHandlerFactory.tryCreate(
53+
const scopeHandler = this.scopeHandlerFactory.maybeCreate(
5454
scopeType,
5555
languageId,
5656
);
@@ -59,7 +59,7 @@ export class ScopeRangeProvider {
5959
return [];
6060
}
6161

62-
const iterationScopeHandler = this.scopeHandlerFactory.tryCreate(
62+
const iterationScopeHandler = this.scopeHandlerFactory.maybeCreate(
6363
scopeHandler.iterationScopeType,
6464
languageId,
6565
);

packages/cursorless-engine/src/scopeProviders/ScopeSupportChecker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ScopeSupportChecker {
2929
*/
3030
getScopeSupport(editor: TextEditor, scopeType: ScopeType): ScopeSupport {
3131
const { languageId } = editor.document;
32-
const scopeHandler = this.scopeHandlerFactory.tryCreate(
32+
const scopeHandler = this.scopeHandlerFactory.maybeCreate(
3333
scopeType,
3434
languageId,
3535
);
@@ -56,7 +56,7 @@ export class ScopeSupportChecker {
5656
scopeType: ScopeType,
5757
): ScopeSupport {
5858
const { languageId } = editor.document;
59-
const scopeHandler = this.scopeHandlerFactory.tryCreate(
59+
const scopeHandler = this.scopeHandlerFactory.maybeCreate(
6060
scopeType,
6161
languageId,
6262
);
@@ -65,7 +65,7 @@ export class ScopeSupportChecker {
6565
return getLegacyScopeSupport(languageId, scopeType);
6666
}
6767

68-
const iterationScopeHandler = this.scopeHandlerFactory.tryCreate(
68+
const iterationScopeHandler = this.scopeHandlerFactory.maybeCreate(
6969
scopeHandler.iterationScopeType,
7070
languageId,
7171
);

0 commit comments

Comments
 (0)