Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

fix(web): multiline highlight ranges are broken / omitted in LightweightCodeHighlighter

已關閉 適合新手
#1,698 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@riteshvish02 已經在處理了。

開始於 2026年9月30日。

  • #1699 來自 @riteshvish02 —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
82/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
typescript
領域
frontend

研究方向

從 LightweightCodeHighlighter.tsx 開始,檢查針對每一行如何篩選及映射 highlightRanges。確認 symbolDefinitionPreview.tsx、fileMatch.tsx 及 referenceList.tsx 中相關的使用方式。完成的標準是:起始行使用從起始欄到 line.length 的範圍,中間行從 0 高亮到 line.length,結束行使用從 0 到結束欄的範圍。

由索引模型根據 Issue 內容生成。

描述

In LightweightCodeHighlighter.tsx, highlight ranges spanning multiple lines are not properly mapped across lines.

Currently, the component filters and maps ranges using:

// @todo: we will need to handle the case where a range spans multiple lines.
const ranges = highlightRanges?.filter(range => {
    return range.start.lineNumber === lineNumber || range.end.lineNumber === lineNumber;
}).map(range => ({
    from: range.start.column - 1,
    to: range.end.column - 1,
}));
Consequences
  1. Middle Lines Dropped: Any line between range.start.lineNumber and range.end.lineNumber fails the condition range.start.lineNumber === lineNumber || range.end.lineNumber === lineNumber, resulting in zero highlighting for intermediate lines.
  2. Column Inversion on Start/End Lines:
    • Start Line: to is set to range.end.column - 1 (column from a different line). If start.column > end.column, from > to creates an invalid range.
    • End Line: from is set to range.start.column - 1 (start line's column), clipping or omitting matches.
Impacted Areas

This affects all views using LightweightCodeHighlighter:

  • Symbol Definition Previews (symbolDefinitionPreview.tsx): Multi-line types, interfaces, or function definitions have broken highlights in hover popovers.
  • Search Result Chunks (fileMatch.tsx): Multi-line regex matches from Zoekt render corrupted or blank intermediate highlights.
  • References List (referenceList.tsx): Multi-line call signatures and JSX nodes.
Expected Behavior

Highlight ranges spanning multiple lines should:

  • Start line: Highlight from start.column to line.length.
  • Intermediate lines: Highlight the entire line (0 to line.length).
  • End line: Highlight from 0 to end.column.

主要語言
TypeScript
星號
3.9k
分支
374
平均合併
2 天 13 小時
30 天內合併 PR
48

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

sourcebot-dev/sourcebot 的其他 Issue

查看 sourcebot-dev/sourcebot 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。