Skip to content

Commit 62f0916

Browse files
Add interior scope to visualize sidebar
1 parent 95d4e61 commit 62f0916

3 files changed

Lines changed: 9 additions & 26 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,8 @@ const simpleScopeTypeTypesSet = new Set(simpleScopeTypeTypes);
215215

216216
export type SimpleScopeTypeType = (typeof simpleScopeTypeTypes)[number];
217217

218-
export const pseudoScopes = new Set<SimpleScopeTypeType>([
218+
export const pseudoScopeTypes = new Set<SimpleScopeTypeType>([
219219
"instance",
220-
"interior",
221220
"className",
222221
"functionName",
223222
]);
@@ -229,7 +228,7 @@ export function isSimpleScopeType(
229228
}
230229

231230
export function isPseudoScope(scopeType: ScopeType): boolean {
232-
return isSimpleScopeType(scopeType) && pseudoScopes.has(scopeType.type);
231+
return isSimpleScopeType(scopeType) && pseudoScopeTypes.has(scopeType.type);
233232
}
234233

235234
export interface SimpleScopeType {

packages/lib-engine/src/languages/TreeSitterQuery/captureNames.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { pseudoScopes, simpleScopeTypeTypes } from "@cursorless/lib-common";
1+
import { pseudoScopeTypes, simpleScopeTypeTypes } from "@cursorless/lib-common";
22

3-
const scopeCaptureNames = [
4-
...simpleScopeTypeTypes.filter((s) => !pseudoScopes.has(s)),
5-
// Interior is a pseudo scope, but it's implemented with an actual internal scope
6-
"interior",
7-
] as const;
3+
const scopeCaptureNames = simpleScopeTypeTypes.filter(
4+
(s) => !pseudoScopeTypes.has(s),
5+
);
86

97
export type ScopeCaptureName = (typeof scopeCaptureNames)[number];
108

packages/lib-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
import type {
2-
Direction,
3-
Position,
4-
ScopeType,
5-
TextEditor,
6-
} from "@cursorless/lib-common";
7-
import { NoContainingScopeError } from "@cursorless/lib-common";
1+
import type { Direction, Position, TextEditor } from "@cursorless/lib-common";
82
import type { LanguageDefinitions } from "../../../../languages/LanguageDefinitions";
93
import type { Target } from "../../../../typings/target.types";
104
import { InteriorTarget } from "../../../targets";
115
import { BaseScopeHandler } from "../BaseScopeHandler";
126
import type { TargetScope } from "../scope.types";
13-
import type {
14-
ComplexScopeType,
15-
ScopeIteratorRequirements,
16-
} from "../scopeHandler.types";
7+
import type { ScopeIteratorRequirements } from "../scopeHandler.types";
178
import type { TreeSitterScopeHandler } from "../TreeSitterScopeHandler";
189

1910
export class InteriorScopeHandler extends BaseScopeHandler {
2011
public readonly scopeType = { type: "interior" } as const;
12+
public readonly iterationScopeType = { type: "document" } as const;
2113
protected isHierarchical = true;
2214

2315
static maybeCreate(
@@ -39,12 +31,6 @@ export class InteriorScopeHandler extends BaseScopeHandler {
3931
super();
4032
}
4133

42-
get iterationScopeType(): ScopeType | ComplexScopeType {
43-
throw new NoContainingScopeError(
44-
"Iteration scope for InteriorScopeHandler",
45-
);
46-
}
47-
4834
*generateScopeCandidates(
4935
editor: TextEditor,
5036
position: Position,

0 commit comments

Comments
 (0)