diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-05-20 16:40:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 16:40:55 -0400 |
commit | 1fcecb6789c3f111bc1554766ba9347afcfd02dc (patch) | |
tree | 19cd1b121412b992994b2fe4bea0463793d3986e /cli/lsp/completions.rs | |
parent | e7c894e8f54ebd2d9fd61c97a265906ac54e2068 (diff) |
refactor: upgrade to deno_ast 0.15 (#14680)
Diffstat (limited to 'cli/lsp/completions.rs')
-rw-r--r-- | cli/lsp/completions.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs index b05d7bfb9..b3e338faf 100644 --- a/cli/lsp/completions.rs +++ b/cli/lsp/completions.rs @@ -97,13 +97,15 @@ fn to_narrow_lsp_range( text_info: &SourceTextInfo, range: &deno_graph::Range, ) -> lsp::Range { - let end_byte_index = text_info.byte_index(LineAndColumnIndex { - line_index: range.end.line, - column_index: range.end.character, - }); + let end_byte_index = text_info + .loc_to_source_pos(LineAndColumnIndex { + line_index: range.end.line, + column_index: range.end.character, + }) + .as_byte_index(text_info.range().start); let text_bytes = text_info.text_str().as_bytes(); let has_trailing_quote = - matches!(text_bytes[end_byte_index.0 as usize - 1], b'"' | b'\''); + matches!(text_bytes[end_byte_index - 1], b'"' | b'\''); lsp::Range { start: lsp::Position { line: range.start.line as u32, @@ -577,7 +579,6 @@ mod tests { use deno_graph::Range; use std::collections::HashMap; use std::path::Path; - use std::sync::Arc; use test_util::TempDir; fn mock_documents( @@ -593,7 +594,7 @@ mod tests { specifier.clone(), *version, language_id.clone(), - Arc::new(source.to_string()), + (*source).into(), ); } let http_cache = HttpCache::new(location); |