Fix to cache correct PathToNode in artifact graph (#6632)
* Add NodePath to artifact graph Since this is cached, this should make PathToNode computation correct even when code is formatted, whitespace changes, and source ranges are different. * Remove dead code * Add unit tests * Add tests for PathToNode conversion * Remove unused parameter * Add missing PathToNode cases * Fix to handle unlabeled arg * Cherry pick unlabeled arg fix * Change PathToNode comment to match TS implementation
This commit is contained in:
@ -99,6 +99,11 @@ impl SourceRange {
|
||||
pos >= self.start() && pos <= self.end()
|
||||
}
|
||||
|
||||
/// Check if the range contains another range. Modules must match.
|
||||
pub(crate) fn contains_range(&self, other: &Self) -> bool {
|
||||
self.module_id() == other.module_id() && self.start() <= other.start() && self.end() >= other.end()
|
||||
}
|
||||
|
||||
pub fn start_to_lsp_position(&self, code: &str) -> LspPosition {
|
||||
// Calculate the line and column of the error from the source range.
|
||||
// Lines are zero indexed in vscode so we need to subtract 1.
|
||||
|
Reference in New Issue
Block a user