Use word-level diffs for text content too

We already do word-level diffs for comments, so use comment atoms in
the line-based parser.

Fixes #33
ida_star
Wilfred Hughes 2021-09-06 12:47:20 +07:00
parent 2d845d9026
commit a39d4b3bb7
2 changed files with 4 additions and 1 deletions

@ -11,6 +11,8 @@ and `.joker`.
Fixed an issue with parsing integer values in CSS with units,
e.g. `123px`.
The line-based parser for text files now uses word-level diffs.
## 0.8
### Git integration

@ -8,7 +8,8 @@ use crate::{positions::SingleLineSpan, syntax::Syntax};
pub fn parse<'a>(arena: &'a Arena<Syntax<'a>>, s: &str) -> Vec<&'a Syntax<'a>> {
let mut res = vec![];
for (i, line) in s.lines().enumerate() {
res.push(Syntax::new_atom(
// Mark each line as a comment atom, so we get word-level diffs.
res.push(Syntax::new_comment(
arena,
vec![SingleLineSpan {
line: i.into(),