reqlanOverviewIdeasFilesCode filesClustersAttributesGraphPrint

Printable idea sheet

reference_file

reqlan rq/language/syntax.rq:189

Katz 0.266

References may target arbitrary files, not only. rq files.
File reference syntax uses a bracketed quoted path.
A relative path resolves from the document directory.
When that path climbs with `..` and the file is not there, the same path is tried from each ancestor directory up to the workspace folder.
The document-directory file wins when it exists.
Line or line-range references append `L#n` or `L#n-m` after the path inside the brackets.
Test-name references append `:` and the test title after the path ( for example `./app.test.ts:lists items` ).
The first `:` after the path starts the title; later `:` characters stay in the title ( `e2e: …` ).
`://` and a Windows drive `C:` / `C:/` are part of the path, not a test suffix.
Symbol references append a dot-separated symbol path after the quoted file path.
Quoted body text is not a file reference: reference_edgecase.

implementation
reqlan-file-references.ts, reqlan-path-resolve.ts, reqlan-imports.ts, reqlan-comment-resolver.ts, path.rs, reqlan-file-link-resolver.ts, broken.rs
tests
references.test.ts:parses L# line suffix from file reference strings, references.test.ts:parses :test name suffix from file reference strings, references.test.ts:keeps colons inside the test name suffix, path.rs:strips_test_name_and_line_suffix, path.rs:test_name_suffix_keeps_colons_in_the_title, broken_references.rs:check_strips_test_name_and_line_suffix_before_file_exists, broken_references.rs:check_accepts_test_names_that_contain_colons_from_nested_rq, linking.test.ts:document links resolve test file references to the matching test, path-resolve.test.ts:a climbing relative path resolves from an ancestor directory, path-resolve.test.ts:a file next to the document wins over an ancestor

Interactive page: reference_file