diff --git a/codespan-lsp/CHANGELOG.md b/codespan-lsp/CHANGELOG.md index 45dd67d..a9177c8 100644 --- a/codespan-lsp/CHANGELOG.md +++ b/codespan-lsp/CHANGELOG.md @@ -11,8 +11,11 @@ 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 the version range: `>=0.84, <0.85`. + Compatibility was broken as a result of the [clarified numeric types] that this crate depended on. +- The `character_to_line_offset` function was made private to reduce the chance of future public breakages. + +[clarified numeric types]: https://github.com/gluon-lang/lsp-types/pull/186 ## [0.10.1] - 2020-08-17 diff --git a/codespan-lsp/Cargo.toml b/codespan-lsp/Cargo.toml index b9c060b..775aaa6 100644 --- a/codespan-lsp/Cargo.toml +++ b/codespan-lsp/Cargo.toml @@ -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" diff --git a/codespan-lsp/src/lib.rs b/codespan-lsp/src/lib.rs index 99b9a00..c4d659c 100644 --- a/codespan-lsp/src/lib.rs +++ b/codespan-lsp/src/lib.rs @@ -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 }) } @@ -77,7 +77,7 @@ where }) } -pub fn character_to_line_offset(line: &str, character: u64) -> Result { +fn character_to_line_offset(line: &str, character: u32) -> Result { let line_len = line.len(); let mut character_offset = 0; @@ -90,7 +90,7 @@ pub fn character_to_line_offset(line: &str, character: u64) -> Result