memorax-ai/dsh-render-engine--packages-code-frame-render ↗★ 1

@ch4acko3/dsh-code-frame-render

渲染带语法高亮和诊断信息的代码上下文 适合需要展示代码诊断、编译器报错或代码片段对比的插件开发者。

套件
@ch4acko3/dsh-code-frame-render
相容性
待驗證
Cordis 依賴範圍
^4.0.1
版本
0.1.3
授權
MIT
最近更新
2026年9月24日

同名套件的其他儲存庫

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:memorax-ai/dsh-render-engine#9582bf138d3a6d7381a84359a4a0b878a1ea8952&path:packages/code-frame-render

@ch4acko3/dsh-code-frame-render

A browser-side Cordis service that renders syntax-highlighted source context with diagnostic ranges and messages. It performs no file IO and does not depend on an LSP implementation.

Positions are zero-based UTF-16 code-unit offsets, matching the LSP position model. Diagnostics from compilers, linters, tests, agents, or language servers can therefore be adapted into the same request shape.

const result = ctx.codeFrameRenderer.render({
  code: 'const value = missing\n',
  language: 'ts',
  fileName: 'app.ts',
  diagnostics: [{
    range: {
      start: { line: 0, character: 14 },
      end: { line: 0, character: 21 },
    },
    message: 'Cannot find name "missing"',
    severity: 'error',
  }],
})

console.log(result.html)