Configuring Document Links
Document links are declared outside the AST.
auto-lsp
enables finding document links by running a regular expression on the comments.
Example
// Create a document or use an existing one
let (workspace, document) = Workspace::from_utf8(
&PARSER_LIST.get("HTML").unwrap(),
Url::parse("file://index.html").unwrap(),
r#"<!DOCTYPE html>
<!-- source:file1.txt:52 -->
<div>
<!-- source:file2.txt:25 -->
</div>"#
.into()
).unwrap();
let regex = Regex::new(r" source:(\w+\.\w+):(\d+)").unwrap();
let results = workspace.find_all_with_regex(&document, ®ex);
assert_eq!(results.len(), 2);