mdx-js / mdx-analyzer

MDX extension for Visual Studio Code

Home Page:https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Experimental Intellisense: Request textDocument/foldingRange failed.

jasikpark opened this issue · comments

Initial checklist

Affected packages and versions

v1.2.1 w/ experimental intellisense turned on

Link to runnable example

No response

Steps to reproduce

Open a markdown file named api.mdx

---
title: API Docs
hide_table_of_contents: true
---

import ApiDocMdx from '@theme/ApiDocMdx';

<ApiDocMdx id="api" />

Expected behavior

There should be no false positives / errors when opening a valid file

Actual behavior

get this error.

[Error - 12:14:46 PM] Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Cannot read properties of undefined (reading 'textSpan')
  Code: -32603 

Runtime

Node v18

Package manager

npm v8

OS

macOS

Build and bundle tools

Docusaurus

Thanks for reporting! I have been able to reproduce the issue.

Does you project have a tsconfig.json file? If so, you can add frontmatter support by adding the mdxplugins section in it. For example, see our frontmatter fixture.

Configuration for remark plugins is new since version 1.2.0. I welcome any feedback on this.

Regardless of the above, this error should not pop-up. I will look into it soon.

yep we're using the Typescript starter for Docusaurus in this instance

i'll test that out 🫡

This has just been released in v1.2.2 🎉

wahoo 🔥 excited to try it out