feat: enlarge floating hover and highlight Markdown content
This commit is contained in:
@@ -64,6 +64,18 @@ impl SyntaxCache {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub(crate) fn update_text(&mut self, text: &str, path: &Path) {
|
||||
if self.source == text && self.path.as_deref() == Some(path) {
|
||||
return;
|
||||
}
|
||||
let lines: Vec<String> = text.split('\n').map(str::to_owned).collect();
|
||||
self.update(
|
||||
&lines,
|
||||
Some(path),
|
||||
self.revision.unwrap_or(0).wrapping_add(1),
|
||||
);
|
||||
}
|
||||
|
||||
/// `revision` must change whenever line content changes; path changes are detected separately.
|
||||
pub fn update(&mut self, lines: &[String], path: Option<&Path>, revision: u64) {
|
||||
let path_changed = self.path.as_deref() != path;
|
||||
|
||||
Reference in New Issue
Block a user