Optimize markdown workspace scanning (#152563)

* Optimize markdown workspace scanning

- Adds cache for markdown file
- Avoid reading non-markdown files from disk (when we expect markdown files)
- Use `range.contains(pos)` instead of `range.intersects(range)`

* Don't remove cached document on change

We only want to invalidate the cached document when it is first opened (since the cached version is the one from disk). Otherwise we can use the live version of the doc
This commit is contained in:
Matt Bierner
2022-06-19 09:40:10 -07:00
committed by GitHub
parent 5a175207de
commit 4c72dedb4a
2 changed files with 29 additions and 2 deletions

View File

@@ -260,7 +260,7 @@ class NoLinkRanges {
contains(range: vscode.Range): boolean {
return this.multiline.some(interval => range.start.line >= interval[0] && range.start.line < interval[1]) ||
this.inline.some(position => position.intersection(range));
this.inline.some(inlineRange => inlineRange.contains(range.start));
}
}