Skip to content

Bulk scope test recorder #2383

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
merged 11 commits into from
Jun 7, 2024
Merged

Bulk scope test recorder #2383

merged 11 commits into from
Jun 7, 2024

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Jun 2, 2024

  1. Add support for new scope facets to a particular language. eg: scopeSupportFacets\typescript.ts
  2. Issue first command to show all unimplemented facets
    • Select language
    • New untitled document opens with all supported facets for the language that are missing .scope files
  3. Edit document with any number of fixtures
  4. Issues second command to create multiple scope test fixtures
[[typescript]]

[command] - A command, for example Talon spoken command or bash
hello
---

Thoughts:

  • Do we want to close the document after it's read? If yes do we have something on the ide for this already or do I need to add it?
  • I'm not one hundred percent sure on the command identifiers
  • Regarding docs. Should I add a new heading in the exist test case recorder file or should I start a new one for this format?

Checklist

  • [/] I have added tests
  • I have updated the docs and cheatsheet
  • [/] I have not broken the cheatsheet

@AndreasArvidsson AndreasArvidsson requested a review from pokey as a code owner June 2, 2024 10:57
@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Jun 4, 2024

@pokey Scope facet description is now added

@pokey
Copy link
Member

pokey commented Jun 5, 2024

Any idea how we would go about recording tests for eg javascript.core? I guess for now just record them for javascript and then move them?

@AndreasArvidsson
Copy link
Member Author

Any idea how we would go about recording tests for eg javascript.core? I guess for now just record them for javascript and then move them?

That was more or less what I was thinking

@pokey
Copy link
Member

pokey commented Jun 5, 2024

yeah probably fine for now. I don't see any easy way to do something smarter, and I believe for everything other than ts/js/tsx/jsx you could get away with just recording the test for the base language. Eg for css/scss you'd just add the support info to css and record test for css and it would just work

@AndreasArvidsson
Copy link
Member Author

Pretty much.

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Ok I made some tweaks and left a couple comments. My changes were as follows:

  • Add spoken forms to our dev talon file
  • Use a snippet so that you can just say "next" to go from one facet to the next
  • Set language id to markdown, as the highlighting is not bad and it prevents VSCode from trying to guess a language
  • Fix the regex for faced ids that have a . in them, eg branch.if

@@ -29,7 +29,7 @@ import { yamlScopeSupport } from "./yaml";

export const languageScopeSupport: Record<
string,
LanguageScopeSupportFacetMap
LanguageScopeSupportFacetMap | undefined
Copy link
Member

Choose a reason for hiding this comment

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

What is this for?

Copy link
Member Author

Choose a reason for hiding this comment

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

The key is a string so I think this is much clearer that you can actually get back undefined. I actually think the implementation of record in typescript is a bit problematic where it does not have the key value map expectation where the key can be missing.

Copy link
Member

Choose a reason for hiding this comment

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

If the key is a literal union then TypeScript will enforce exhaustiveness of the record.

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case the key type is string. If I do languageScopeSupport["hello"] I will get back undefined and I think that the type system should reflect this.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this one has bitten me before. I'd be tempted to have a utility type

type StringRecord<T> = Partial<Record<string, T>>

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I implement this here?

Copy link
Member

@pokey pokey Jun 7, 2024

Choose a reason for hiding this comment

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

Yeah I think so. I don't think it's significant enough to warrant its own PR

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@AndreasArvidsson
Copy link
Member Author

I'm happy with those changes

github-merge-queue bot pushed a commit that referenced this pull request Jun 5, 2024
Figured while I was testing
#2383 I might as well
do something useful at the same time 😊

## Checklist

- [x] 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)
- [-] I have not broken the cheatsheet
@pokey pokey enabled auto-merge June 7, 2024 12:30
@pokey pokey added this pull request to the merge queue Jun 7, 2024
Merged via the queue into main with commit 2d07d11 Jun 7, 2024
15 checks passed
@pokey pokey deleted the scopeTestRecorder branch June 7, 2024 12:46
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.

3 participants