-
-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Problem
I'm using Twoslash in a VitePress project and encountered an issue where I need to display an error for a named import in a Vue SFC. Specifically, I have a TypeScript file posts.data.ts that only has a default export, but I'm attempting to import it in a Vue SFC using a named import, which should trigger an error.
Here's the relevant part of my markdown content:
<script>
// ---cut-start---
// @filename: ../src/posts.data.ts
import { createContentLoader } from "vitepress";
export default createContentLoader("posts/*.md", {
// ...
});
// ---cut-end---
</script>
<script setup lang="ts">
// @errors: 2614
import { data as posts } from "../src/posts.data";
// ...
</script>
<template>
<!-- ... -->
</template>This setup correctly displays the error I want. However, I noticed that the cut functionality only works with JavaScript-style comments (//), which means it cannot hide the <script> and </script> tags (lines 1 and 10).
Request
Would it be possible to extend the cut functionality to support HTML-style comments? For example, something like this:
<!-- ---cut-start--- -->
<script>
// @filename: ../src/posts.data.ts
import { createContentLoader } from "vitepress";
export default createContentLoader("posts/*.md", {
// ...
});
</script>
<!-- ---cut-end--- -->
<script setup lang="ts">
// @errors: 2614
import { data as posts } from "../src/posts.data";
// ...
</script>
<template>
<!-- ... -->
</template>I can confirm that the cut functionality in the example above does not currently work. For context, I'm using [email protected] and [email protected].