Skip to content

Commit

Permalink
position to byteoffset line 0 bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
frederik-uni committed Aug 27, 2024
1 parent ad10f54 commit 3411a0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "live-server-lsp"
version = "0.3.1"
version = "0.3.2"
edition = "2021"

[dependencies]
Expand Down
3 changes: 3 additions & 0 deletions src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ pub fn get_byte_index_from_position(s: &str, position: Position) -> usize {
}

fn index_of_first_char_in_line(s: &str, line: u32) -> Option<usize> {
if line == 0 {
return Some(0);
}
let mut current_line = 0;
let mut index = 0;

Expand Down

0 comments on commit 3411a0b

Please sign in to comment.