Skip to content

Commit

Permalink
update lsp-types and change types (#303)
Browse files Browse the repository at this point in the history
* Update lsp-types requirement from >=0.70, <0.84 to >=0.84, <0.85

* fix breaking changes

* update changelog

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
  • Loading branch information
Johann150 and dependabot-preview[bot] authored Nov 29, 2020
1 parent b51e3a6 commit cba2e98
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions codespan-lsp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- The error type in `codespan-lsp` is replaced with the error type in the `codespan-reporting` crate.
The error type is now `codespan_reporting::file::Error`.
- The `lsp-types` dependency was updated to use a version range: `>=0.70, <0.83`,
which includes the latest updates in `0.82.0`.
- The `lsp-types` dependency was updated to use a version range: `>=0.70, <0.85`,
which includes the latest updates in `0.84.0`.

## [0.10.1] - 2020-08-17

Expand Down
2 changes: 1 addition & 1 deletion codespan-lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ codespan-reporting = { version = "0.9.5", path = "../codespan-reporting" }
# will be valid for all the versions in this range. Getting this range wrong
# could potentially break down-stream builds on a `cargo update`. This is an
# absolute no-no, breaking much of what we enjoy about Cargo!
lsp-types = ">=0.70, <0.83"
lsp-types = ">=0.84, <0.85"
url = "2"
8 changes: 4 additions & 4 deletions codespan-lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ fn location_to_position(
Err(Error::InvalidCharBoundary { given })
} else {
let line_utf16 = line_str[..column].encode_utf16();
let character = line_utf16.count() as u64;
let line = line as u64;
let character = line_utf16.count() as u32;
let line = line as u32;

Ok(LspPosition { line, character })
}
Expand Down Expand Up @@ -77,7 +77,7 @@ where
})
}

pub fn character_to_line_offset(line: &str, character: u64) -> Result<usize, Error> {
pub fn character_to_line_offset(line: &str, character: u32) -> Result<usize, Error> {
let line_len = line.len();
let mut character_offset = 0;

Expand All @@ -90,7 +90,7 @@ pub fn character_to_line_offset(line: &str, character: u64) -> Result<usize, Err
return Ok(line_len - chars_off - ch_off);
}

character_offset += ch.len_utf16() as u64;
character_offset += ch.len_utf16() as u32;
}

// Handle positions after the last character on the line
Expand Down

0 comments on commit cba2e98

Please sign in to comment.