-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Generate Examples -- Continued #2272
base: main
Are you sure you want to change the base?
Conversation
8baf3e5
to
25adbca
Compare
Thanks for picking this up! If you need any help figuring out what I was doing let me know. I can answer questions but completely have no time to code outside of work commitments 😞 |
All good, happy to see you're well :) I'm definitely curious about the decisions you made to choose these libraries and what your vision was for how you wanted this feature to end up. Recently I was looking for more opportunities for to learn what Cursorless can do and wanted a series of gifs that could demo its capabilities. We've already got all these test files so that seemed like a good place to start, and it turns out you already are plenty of the way there! |
I think we just had the same desire, while I was learning Cursorless at the start I just wanted something like a "library" of examples of what each command could do. My overall thinking was just a "search command/scope/etc, see examples" type app, but never got past the "just make the HTML work" stage. I don't think there was anything really "deep" in my decision-making, |
I think one of my main questions is where this will end up residing. Eg is it gonna be available locally via something like the cheat sheet or is it only online via the docs. That might be a better question if Andreas or Pokey, but I think it affects how I would explore building this. My first inclination was to see if anything could be reused from the Docusaurus space:
If it's going to reside in the cheat sheet then there's no established components, theme etc to start from and something like shiki seems like the right choice. I honestly have no idea though. |
Sorry can't help you there, definitely a question for Pokey or Andreas as I didn't really figure out with them where was best. |
With the caveat that I haven't really read through the previous pull request we definitely want code examples in the online documentation. We might link from the cheat sheet to the online docs, but I don't think we should actually cram all the documentation into the cheat sheet itself. |
A package is the way to go, but I'd recommend starting from a clean checkout of
I'm not sure Fwiw you might want to look at the For local testing / experimentation, I'd just add a dummy page to our Once you have a working react component, we can look into getting it into docusaurus using mdx Lmk if any of the above doesn't make sense, and feel free to drop into another meet-up if you get stuck! |
wip: Delete workspace.json for cherry-pick - git cherry pick 070c870 - Delete cursorless-nx/workspace.json Add the package and initial working There is an issue here that the jest parser requires no file name extension in imports, but ts-node requires `.js` extension. Probably will need to change this to build then generate rather than ts-node (or spend ages messing with the configs) [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci All working with tests Need to update to be in the new NX repo format and correctly handle the newer formats for test fixtures which have changed since this was written
cool! shall I take a look, or did you want to hack some more before I look? Or easier to give me a walkthrough at a meet-up? |
6afc57c
to
0fb7e81
Compare
I think a walkthrough at a meetup would make more sense. A lot closer but not ready yet. |
I think that there might be some uncommitted code from awhile back to handle the I'm reading through the code looking for the location where the const during = data.decorations
? await safeGenerateHtml(
"decorations",
{
...data.initialState,
decorations: data.decorations.map(
({
name,
type,
start,
end,
}: {
name: string;
type: string;
start: SelectionAnchor;
end: SelectionAnchor;
}) => ({
name,
type,
anchor: start,
active: end,
}),
),
}, But the In the code from then codepen, there is a highlighting feature But the code from The |
ide:
flashes:
- style: pendingDelete
range: {type: line, start: 1, end: 4} This is the |
); | ||
const data = [...dataActions, ...dataDecorations]; | ||
const loaded = ( | ||
await Promise.all(data.map((val) => loadFixture(val))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run
cursorless/packages/cursorless-engine/src/scripts/transformRecordedTests/transformations/upgrade.ts
Line 4 in bccc6d8
export function upgrade(fixture: TestCaseFixtureLegacy): TestCaseFixture { |
import "./shiki.css"; | ||
import "./styles.css"; | ||
|
||
export const TestCaseComponentPage: React.FC<{ data: any; loaded: any }> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove loaded and make data
have type TestCaseFixture
Looking at my last commit message has "Needs to update to match new fixture structure" 😅 It's likely to be wrong now, it used to be the |
Got sick, been down for the count and unable to make cursorless meets for the last weeks. Back at it soon ™️ |
This is following on from the work of #940
This is currently a draft PR
Latest updates
.yml
files are successfully loaded viagetStaticProps
and passed toTestCaseComponentPage
Shiki 1.4
fromShiki 0.x
Screenshot
Current issues
during
step that shows selection for deletion isn't being hitloadFixtures.ts
)Older changes
Summary of older changes
main
cursorless-rx/ ... /generate-exmples
folder topackages/generate-examples
to conform with monorepoloadFixture
directory to point correctly tocursorless-vscode-e2e
recorded
folderpackages/generate-examples/src/lib/generateHtml.ts
@SelectionParser.parse
that madepnpm build
failloadFixture
with original data -- as of yet unusedpnpm
install/setup commandsChecklist