Skip to content
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

Cannot print to HTML when another extension crashes #834

Closed
vincent-hughes opened this issue Oct 11, 2020 · 7 comments
Closed

Cannot print to HTML when another extension crashes #834

vincent-hughes opened this issue Oct 11, 2020 · 7 comments
Assignees
Labels
Area: Exporting To HTML. Probably also other formats someday. Issue: Bug Res: Fixed Fix is checked in, but it might be a few weeks until a release.

Comments

@vincent-hughes
Copy link

Problem

What went wrong?

when I print document to html, console reports a err as follows:

ERR Cannot find module '@thomaskoppelaar/markdown-it-wikilinks'
Require stack:
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\MarkdownRenderingPlugin.js
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js:

and then, I can't find html in my current markdown file path

Expected behavior?

Print document to HTML successfully!

My environment

  • OS: Win 10
  • VS Code: 1.50.0
  • Plugins Version
    • Markdown All in One: 3.3.0
    • Markdown Notes: 0.0.20

How to reproduce

  1. open any markdown file and execute command Markdown All in One: Print current document to HTML
  2. click menu Help -> Toggle Developer Tools

err is shown in console

Error message in the console

ERR Cannot find module '@thomaskoppelaar/markdown-it-wikilinks'
Require stack:
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\MarkdownRenderingPlugin.js
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js:
@yzhang-gh
Copy link
Owner

Thanks for the feedback.

The Markdown Notes extensions uses a non-standard(?) way to extendMarkdownIt

https://github.com/kortina/vscode-markdown-notes/blob/431084cdae86891ab55cf01c8cb9983fcb377384/src/extension.ts#L70-L71

Not sure whether it matters 🤔

cc @1354092549 (in case you have some insights into this issue).

@yzhang-gh yzhang-gh added Area: Exporting To HTML. Probably also other formats someday. Issue: Bug labels Oct 11, 2020
@ArcticLampyrid
Copy link
Contributor

Does the Markdown Notes extensions work well when previewing?
It seems the error is reported by VSCode Extension Loader.
Is there more detailed stacktrace?

@yzhang-gh
Copy link
Owner

Just tried on my PC and it seems it is an issue of Markdown Notes (on its activation). We can still see the error message if we do nothing but open a Markdown file.

Does the Markdown Notes extensions work well when previewing?

I haven't used this extension before but from what I can see, it doesn't work in the VSCode's preview tab. (@orangee-wi)

@Lemmingh
Copy link
Collaborator

Generally speaking, that extension is supposed to be shipped with markdown-it-wikilinks. But it doesn't:
kortina/vscode-markdown-notes#101

@Lemmingh
Copy link
Collaborator

VS Code ignores broken extensions:
https://github.com/microsoft/vscode/blob/2b7760fa1fac6902b6114e79a0873dfd6ba7ad6c/extensions/markdown-language-features/src/markdownEngine.ts#L79-L85

Maybe we can do similar things here

for (const contribute of this.contributionsProvider.contributions) {
if (extensionBlacklist.has(contribute.extensionId)) {
continue;
}
md = await contribute.extendMarkdownIt(md);
}

@ArcticLampyrid
Copy link
Contributor

It's okey to just add a try-catch block. And log may be needed.

@Lemmingh
Copy link
Collaborator

What about:

// Skip the third-party Markdown extension, if it is broken or crashes.
try {
    md = await contribute.extendMarkdownIt(md);
} catch (err) {
    console.error(`Skipped Markdown extension: ${contribute.extensionId}\nBecause:\n${err}`);
}

@Lemmingh Lemmingh self-assigned this Oct 18, 2020
@Lemmingh Lemmingh added Res: Fixed Fix is checked in, but it might be a few weeks until a release. and removed Needs More Info labels Oct 18, 2020
@Lemmingh Lemmingh changed the title Cannot find module 'wikilinks' when print document to HTML Cannot print to HTML when another extension crashes Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Exporting To HTML. Probably also other formats someday. Issue: Bug Res: Fixed Fix is checked in, but it might be a few weeks until a release.
Projects
None yet
Development

No branches or pull requests

4 participants