Replies: 1 comment 1 reply
-
When the language server loads a schema, it literally attempts to import it, so it has to conform with the requirements imposed by the Node.js runtime for imports. On the first line of your schema, you have something like this: In projects that use TypeScript and couple React components with the schema, what I'd recommend is adding a build step of some kind to generate a pure schema output. You can have a TypeScript file somewhere that just imports the schema part of the configuration, and then do a standalone build of that entry point. I typically do this with esbuild in my projects. I'm going to convert this issue to a discussion, but I will explore some options for exposing schema loading errors and see if there's something that I can do to make these kinds of issues less opaque to the end user. There should be an easy way to see when there is a schema loading exception. |
Beta Was this translation helpful? Give feedback.
-
What happened?
Hi!
I am trying to make use of the Markdoc language server extension within VS Code to provide validation, autocomplete etc. Unfortunately, I can't seem to be able to get the extension to perform correctly despite following the documentation provided by Markdoc.
I have created a simple repo (available here: https://github.com/crcorbett/tilt-legal-site) to test out Markdoc's functionality. I have installed the Markdoc language server extension within my VS Code workspace. I have created a simple Markdoc schema, a basic
post.mdoc
, and confirmed that Markdoc is working correctly locally.When I select a file ending in
.mdoc
I can see that the Markdoc extension is being activated as it appears within the status bar of VS Code (see screenshot below).However, I don't seem to be able to get any features of the extension to work. When typing within the
.mdoc
file no autocomplete hints or validations appear.Furthermore, when activating the
Control the markdoc language server
action from the command palette the following error message appears (see screenshots below):Similarly, the
Display a rendered preview of Markdoc content
action does not succeed — though no error message appears here i.e. it fails silently.Appreciating that this is an open-source project, I have tried to exhaust the possibilities for where I could've introduced a bug before raising this issue. I've taken a look through the previously closed issues that relate the Markdoc language server (e.g. #428) and attempted to follow the advice given in these.
Additionally, I have also tried cloning other repos that appear to have correct configurations to test the extension including:
Unfortunately, I am still having the same issue with these other repos.
This leads me to believe that there may be some issue with the configuration of my VS Code application distinct from any issues with Markdoc or the Markdoc language server. I have tested disabling all other extensions, which was unsuccessful and also had a colleague test out these repos on their VS Code install to no avail.
I have provided extracts of our Markdoc schema and config below for your reference.
Please let me know if there is any further detail I can provide to assist with debugging this issue.
Your assistance is greatly appreciated! 😃
Markdoc schema
https://github.com/crcorbett/tilt-legal-site/blob/main/src/app/blog/config.markdoc.js
Markdoc config (Extension)
https://github.com/crcorbett/tilt-legal-site/blob/ef9139e034cfb4b6b235b443e992456ab5280707/markdoc.config.json
To reproduce
Clone our
tilt-legal-site
test repository:Then install necessary packages and run locally:
VS Code
Version: 1.83.1 (Universal)
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:46:55.789Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.5.0
Markdoc language support extension
v0.0.11
Version
0.3.4
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions