Skip to content

Simplify default iteration scopes; file scopeHandler #1075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

pokey
Copy link
Member

@pokey pokey commented Oct 23, 2022

Removes notion of getIterationScopesTouchingPosition and instead just calls containing scope on iteration scope

Also steals DocumentScopeHandler from #1073 as that was necessary to make line scope handler work in this new setup

Checklist


export default class DocumentScopeHandler implements ScopeHandler {
public readonly scopeType = { type: "line" } as const;
public readonly iterationScopeType = { type: "document" } as const;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that iteration scope of document is document, so we get "every file" for free, if for whatever reason someone wants to do that 🤔

* might want the default iteration scope to be `"file"`, but you don't need
* to expand to the file just to find instances of the given scope type.
*/
protected get searchScopeType(): ScopeType {
Copy link
Member Author

@pokey pokey Oct 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this in preparation for "next air" / "every air", which will use line as its search scope, but document as its iteration scope

Comment on lines -150 to -155
if (fixture.thrownError != null) {
throw Error(
`Expected error ${fixture.thrownError.name} but none was thrown`
);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to move this so that we could update fixtures that went from error to success

@AndreasArvidsson AndreasArvidsson linked an issue Oct 23, 2022 that may be closed by this pull request
@AndreasArvidsson AndreasArvidsson merged commit c4d0918 into main Oct 24, 2022
@AndreasArvidsson AndreasArvidsson deleted the pokey/simplify-default-iteration-scopes-file-scopehandler branch October 24, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate document to use a scope handler
2 participants