@@ -3,7 +3,7 @@ use crate::{
3 Call, Error, OffsetEncoding, Result,
3 Call, Error, OffsetEncoding, Result,
6−use helix_core::{chars::char_is_line_ending, find_root, ChangeSet, Rope};
6+use helix_core::{find_root, ChangeSet, Rope};
7use jsonrpc_core as jsonrpc;
7use jsonrpc_core as jsonrpc;
8use lsp_types as lsp;
8use lsp_types as lsp;
9use serde_json::Value;
9use serde_json::Value;
@@ -356,7 +356,6 @@ impl Client {
357 // Calculation is therefore a bunch trickier.
357 // Calculation is therefore a bunch trickier.
359− // TODO: stolen from syntax.rs, share
360 use helix_core::RopeSlice;
359 use helix_core::RopeSlice;
361 fn traverse(pos: lsp::Position, text: RopeSlice) -> lsp::Position {
360 fn traverse(pos: lsp::Position, text: RopeSlice) -> lsp::Position {
362 let lsp::Position {
361 let lsp::Position {
@@ -366,7 +365,12 @@ impl Client {
367 let mut chars = text.chars().peekable();
366 let mut chars = text.chars().peekable();
368 while let Some(ch) = chars.next() {
367 while let Some(ch) = chars.next() {
368+ // LSP only considers \n, \r or \r\n as line endings
369+ if ch == '\n' || ch == '\r' {
369− if char_is_line_ending(ch) && !(ch == '\r' && chars.peek() == Some(&'\n')) {
371+ if chars.peek() == Some(&'\n') {
370 line += 1;
374 line += 1;
371 character = 0;
375 character = 0;