markdoc / markdoc

A powerful, flexible, Markdown-based authoring framework.
https://markdoc.dev
MIT License
7.29k stars 169 forks source link

Markdoc language server on a Next.js app #499

Open filiphric opened 7 months ago

filiphric commented 7 months ago

What happened?

I’ve been trying to set up VS Code Markdown extension, but I keep getting errors and can’t get it to work. I keep hitting the following message:

Screenshot 2024-04-11 at 07 17 32

Here’s my markdoc.config.json

[
  {
    "id": "docs",
    "path": "src/app",
    "schema": {
      "path": "src/markdoc/config.mjs",
      "type": "esm",
      "property": "default",
      "watch": true
    }
  }
]

The VS Code extenstion output is throwing following error:

TypeError: Cannot read properties of undefined (reading 'markdoc')
    at new Documents (/Users/filiphric/.vscode/extensions/stripe.markdoc-language-support-0.0.12/dist/client/server.js:27176:52)
    at /Users/filiphric/.vscode/extensions/stripe.markdoc-language-support-0.0.12/dist/client/server.js:27434:7
    at Array.map (<anonymous>)
    at server (/Users/filiphric/.vscode/extensions/stripe.markdoc-language-support-0.0.12/dist/client/server.js:27432:41)

Node.js v18.18.2
[Error - 07:17:51] Connection to server got closed. Server will not be restarted.

I’ve looked into the discussion threads but solutions mentioned there don’t seem to fix the problem for me. Maybe I’m overlooking something.

To reproduce

Here’s a link to the repository Pull the latest changes from new-docs branch

Version

"@markdoc/markdoc": "^0.4.0", "@markdoc/next.js": "^0.3.7", Markdoc language support v0.0.12

Additional context

I tried v0.0.11 of the extension which does not throw the error into the output console, but throws the same "Command 'Control the Markdoc language server' resulted in an error"

louiss0 commented 5 months ago

I'm also dealing with a similar problem.

Node.js v18.18.2
[Info  - 12:39:07 PM] Connection to server got closed. Server will restart.
c:\Users\V. L. MULTISERVICE\.vscode\extensions\stripe.markdoc-language-support-0.0.12\dist\client\server.js:27176
    this.tokenizer = new Markdoc4.Tokenizer(config.markdoc ?? {});
                                                   ^

TypeError: Cannot read properties of undefined (reading 'markdoc')
    at new Documents (c:\Users\V. L. MULTISERVICE\.vscode\extensions\stripe.markdoc-language-support-0.0.12\dist\client\server.js:27176:52)
    at c:\Users\V. L. MULTISERVICE\.vscode\extensions\stripe.markdoc-language-support-0.0.12\dist\client\server.js:27434:7
    at Array.map (<anonymous>)
    at server (c:\Users\V. L. MULTISERVICE\.vscode\extensions\stripe.markdoc-language-support-0.0.12\dist\client\server.js:27432:41)

Node.js v18.18.2
[Error - 12:39:08 PM] Connection to server got closed. Server will not be restarted.

I'm using node v20.13.1 Does that matter.

filiphric commented 4 months ago

Hey there! I’m assuming it is hard to prioritize this currently, and I don’t want to step on anybody’s toes, but if there’s a way I could help out, let me know. It would be a huge help for me to have this fixed.