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
平均合并
17 小时 15 分钟
30 天内合并 PR
38

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sourcebot-dev/sourcebot 的其他 Issue

查看 sourcebot-dev/sourcebot 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。