lsp: Handle selections and highlighting in the LSP

Ask the interpreter for all the necessary information, but handle the
look and feel in the LSP preview UI.
This commit is contained in:
Tobias Hunger 2023-12-19 17:31:15 +01:00 committed by Tobias Hunger
parent c9414d98fa
commit ca1263c3e5
9 changed files with 324 additions and 632 deletions

View file

@ -5,7 +5,7 @@ use std::io::Read;
use std::path::{Path, PathBuf};
use std::rc::Rc;
use crate::parser::{TextRange, TextSize};
use crate::parser::TextSize;
/// Span represent an error location within a file.
///
@ -114,16 +114,6 @@ impl SourceFileInner {
)
}
pub fn text_range_to_file_line_column(
&self,
range: TextRange,
) -> (String, usize, usize, usize, usize) {
let file_name = self.path().to_string_lossy().to_string();
let (start_line, start_column) = self.line_column(range.start().into());
let (end_line, end_column) = self.line_column(range.end().into());
(file_name, start_line, start_column, end_line, end_column)
}
pub fn text_size_to_file_line_column(
&self,
size: TextSize,