ITADN

`---cut-end---` at line end is being ignored

#76Closedfuma-nama 创建于 2025-08-09
F
fuma-namacommented
The error is produced when it ends with `---cut-end---`: ```ts // ---cut-start--- export class Foo {} // ---cut-end--- ``` ``` TwoslashError: ## Mismatched cut markers You have 1 cut-starts and 0 cut-ends Make sure you have a matching pair for each. at findCutNotations (file:///project/workspace/node_modules/twoslash/dist/shared/twoslash.CLSMoA24.mjs:290:11) at twoslasher2 (file:///project/workspace/node_modules/twoslash/dist/core.mjs:138:5) at file:///project/workspace/index.js:9:13 at ModuleJob.run (node:internal/modules/esm/module_job:222:25) at async ModuleLoader.import (node:internal/modules/esm/loader:323:24) at async loadESM (node:internal/process/esm_loader:28:7) at async handleMainPromise (node:internal/modules/run_main:113:12) { title: 'Mismatched cut markers', description: 'You have 1 cut-starts and 0 cut-ends', recommendation: 'Make sure you have a matching pair for each.', code: undefined } ``` This can be reproduced on twoslash, or twoslash + Shiki: ```ts import { createTwoslasher } from "twoslash"; const code = "console.log();\n// ---cut-start---\nexport class Foo {}\n// ---cut-end---"; const twoslasher = createTwoslasher(); console.log(twoslasher(code)); ``` CodeSandbox: https://codesandbox.io/p/devbox/w22dfn
关闭于 2025-08-11 0 条评论