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

Can't preview antora references after vscode update #899

Closed
alaindresse opened this issue Sep 2, 2024 · 3 comments
Closed

Can't preview antora references after vscode update #899

alaindresse opened this issue Sep 2, 2024 · 3 comments
Labels

Comments

@alaindresse
Copy link
Contributor

Since my last vscode update, I can no longer preview a page with antora references (e.g. include::partial$...antora documentation since the latest vscode update (even tried to reinstall vscode from scratch).

When I open the developer tools, I see a bunch of errors like

console.ts:137 [Extension Host] Unable to get Antora context for file:///Users/alaindresse/code/twipe-documentation/docs/modules/antora-intro/pages/index.adoc TypeError: A dynamic import callback was not specified.
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:228:9)
    at getAntoraDocumentContext (/Users/alaindresse/.vscode/extensions/asciidoctor.asciidoctor-vscode-3.3.1/src/features/antora/antoraSupport.ts:319:27)
    at AsciidocIncludeItemsLoader.prepare (/Users/alaindresse/.vscode/extensions/asciidoctor.asciidoctor-vscode-3.3.1/src/asciidocLoader.ts:59:35)
    at AsciidocIncludeItemsLoader.getIncludeItems (/Users/alaindresse/.vscode/extensions/asciidoctor.asciidoctor-vscode-3.3.1/src/asciidocLoader.ts:95:9)
    at LinkProvider.provideDocumentLinks (/Users/alaindresse/.vscode/extensions/asciidoctor.asciidoctor-vscode-3.3.1/src/features/documentLinkProvider.ts:51:41)
    at ae.provideLinks (/Users/alaindresse/Desktop/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:154:126920)

which seem to be related to

[antoraSupport.ts:319] let classifyContent = await import('@antora/content-classifier')

(for reference, initially discussed on Asciidoctor zulip chat

@alaindresse
Copy link
Contributor Author

Workaround (requires modifying the extension) for those having a similar issue:

With Node 20, I could actually import the content-classifier without await import in antoraSupport.ts:

import * as contentClassifier from '@antora/content-classifier'
const classifyContent = contentClassifier.default || contentClassifier

and comment later in antoraSupport.ts

    // let classifyContent = await import('@antora/content-classifier')
    // if ('default' in classifyContent) {
    //   classifyContent = classifyContent.default // default export
    // }

@ggrossetie
Copy link
Member

VS code will eventually support dynamic imports (see microsoft/vscode#226260) but until then we should use a static import.

@BcOleks
Copy link

BcOleks commented Sep 12, 2024

Hi @ggrossetie , can I ask when this issue fix gonna be released? Or how can I apply it without manually changing the extension code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants