Skip to content

feat(extension): support config-based ordering #223

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 9 commits into from
Aug 8, 2024

Conversation

Nemikolh
Copy link
Member

@Nemikolh Nemikolh commented Aug 7, 2024

This PR adds:

  • ✅ Support for config based ordering.
  • ✅ Deletion of lessons, chapters or parts (I needed that for testing).
  • ✅ It now shows the root node so that we can view the tutorial config. The name of the root node is the folder name of the project.

It does not implement re-ordering via drag and drop (I'll do that in a follow up PR).

I simplified the TreeView so that it does not contains any logic regarding the data structure generation. This is now done entirely in models/tree/load.ts (not a fan of this location but couldn't think of a better one). The logic no longer use fs.readdirSync and instead use vscode.workspace.fs functions.

Screen.Recording.2024-08-07.at.10.37.07.mov

Closes #188

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

cloudflare-workers-and-pages bot commented Aug 7, 2024

Deploying tutorialkit-demo-page with  Cloudflare Pages  Cloudflare Pages

Latest commit: 043f5e6
Status: ✅  Deploy successful!
Preview URL: https://f33a8823.tutorialkit-demo-page.pages.dev
Branch Preview URL: https://joan-config-based-ordering.tutorialkit-demo-page.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Aug 7, 2024

Deploying tutorialkit-docs-page with  Cloudflare Pages  Cloudflare Pages

Latest commit: 043f5e6
Status: ✅  Deploy successful!
Preview URL: https://a4c6aa88.tutorialkit-docs-page.pages.dev
Branch Preview URL: https://joan-config-based-ordering.tutorialkit-docs-page.pages.dev

View logs

@Nemikolh Nemikolh marked this pull request as ready for review August 7, 2024 15:31
Comment on lines -122 to -125
"__esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node",
"__dev": "pnpm run esbuild-base -- --sourcemap --watch",
"__vscode:prepublish": "pnpm run esbuild-base -- --minify",
"__build": "vsce package",
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed those because I don't think we should use them? @sulco what do you think?

lesson.name = parsedContent.data.title;
timeoutId = setTimeout(async () => {
loading = true;
await this.refresh();
Copy link
Member Author

Choose a reason for hiding this comment

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

When a file is changed, we throw away everything and recalculate everything (lazily on a needed basis though).

This is pretty inefficient but very simple.

Ideally, I'd want to do something more fine-grained where we only update the element of the tree that need to. This should improve perf on really big tutorials with many many markdown files.

@Nemikolh Nemikolh requested review from sulco and AriPerkkio August 7, 2024 15:37
@Nemikolh Nemikolh mentioned this pull request Aug 7, 2024
29 tasks
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

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

I'm not that familiar with vscode extension API but the code itself looks good.

@Nemikolh Nemikolh requested a review from AriPerkkio August 8, 2024 08:41
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

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

Looks good to me. I did some testing locally with Vite Plugin Tutorial too. Nice work! 💯

@Nemikolh Nemikolh merged commit 3b2c776 into main Aug 8, 2024
9 checks passed
@Nemikolh Nemikolh deleted the joan/config-based-ordering branch August 8, 2024 09:36
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.

Extension: Order from metadata not used
2 participants