Skip to content

Conversation

@curly210102
Copy link
Contributor

When I practice with type-challenges, I notice that I need a complete tool to get through the process quickly. Then I found this plugin and made some optimizations for it.

Effect
31db67de83c2de209755814f2d892326846df0e1d03cf94a42e69228b1a181a0

Feature Supported

  • Pick question in challenge list
  • Switch languages
  • Copy and share answer to github issue
  • Quick start next question
  • Quick find solutions

⚠️ type-challenges support is required, and I've create a PR.

@antfu antfu requested a review from g-plane December 6, 2021 12:09
@antfu
Copy link
Member

antfu commented Dec 6, 2021

@g-plane it would be great if you can have a quick review of it, or I think we could merge it first

Copy link
Member

@g-plane g-plane left a comment

Choose a reason for hiding this comment

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

Though I haven't run it locally, code looks OK, but there're some trivial problems.

setTimeout(() => {
isMarkerLoaded = true;
}, 2000);
return await markdownToHtml(readme, context.sandbox);
Copy link
Member

Choose a reason for hiding this comment

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

We aren't in try...catch block, so we can simplify like this:

Suggested change
return await markdownToHtml(readme, context.sandbox);
return markdownToHtml(readme, context.sandbox);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There need to wait for code colorize to complete

for (const match of matches) {
const [source, code] = match
const colorized = await sandbox.monaco.editor.colorize(
unescape(code),
'typescript',
{}
)
rendered = rendered.replace(
source,
`<code class="language-ts">${colorized}</code>`
)
}

Copy link
Member

Choose a reason for hiding this comment

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

I know, but here it just returns the result of markdownToHtml, so nothing different. Anyway, this isn't blocker.

Copy link
Member

@g-plane g-plane left a comment

Choose a reason for hiding this comment

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

Thanks!

@antfu antfu merged commit 4b4030f into type-challenges:master Dec 7, 2021
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