Skip to content

Bug: Source navigation fails for forward relations that cover only 1 line of source code #2668

@haxtibal

Description

@haxtibal

Describe the bug

For file relations that highlight only 1 line of source code, code navigation in the source file view doesn't work. Clicking the node in the left toc side panel causes JS exception Uncaught TypeError when when changeActive() tries to access this.ranges[rangeAlias]?.banner .

To Reproduce

Use forward relations to link to a 1-line function definition.

sdoc

[REQUIREMENT]
UID: REQ-1
TITLE: Requirement Title #1
STATEMENT: Requirement Statement #1
RELATIONS:
- TYPE: File
  VALUE: file.c
  FUNCTION: f1
- TYPE: File
  VALUE: file.c
  FUNCTION: f2

file.c (note how fn2 spans only 1 line)

void fn1() {
}

void fn2() {}

Go to file.c source view and click fn2.

Expected behavior and additional context

1-line definitions are not uncommon, in particular in the Rust case where I'll enable to forward link not only to functions, but to any identifier like struct Pair(i32, f32);. They shouldn't cause problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions