summaryrefslogtreecommitdiff
path: root/cli/lsp/sources.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-03-10 21:39:16 +1100
committerGitHub <noreply@github.com>2021-03-10 21:39:16 +1100
commit88a7fa36aa40df3c461137d3bbbfea03db69446f (patch)
tree0c7d9497a2dcb3a7950d27a43dbd99ead22bd9c6 /cli/lsp/sources.rs
parentdb96be7cdc3b9d8c8d5373e90ca6c2c57599529b (diff)
fix(lsp): allow on disk files to change (#9746)
Fixes #9348
Diffstat (limited to 'cli/lsp/sources.rs')
-rw-r--r--cli/lsp/sources.rs28
1 files changed, 0 insertions, 28 deletions
diff --git a/cli/lsp/sources.rs b/cli/lsp/sources.rs
index 0cd7b5876..445c49824 100644
--- a/cli/lsp/sources.rs
+++ b/cli/lsp/sources.rs
@@ -163,14 +163,6 @@ impl Sources {
self.0.lock().unwrap().contains_key(specifier)
}
- /// Provides the length of the source content, calculated in a way that should
- /// match the behavior of JavaScript, where strings are stored effectively as
- /// `&[u16]` and when counting "chars" we need to represent the string as a
- /// UTF-16 string in Rust.
- pub fn get_length_utf16(&self, specifier: &ModuleSpecifier) -> Option<usize> {
- self.0.lock().unwrap().get_length_utf16(specifier)
- }
-
pub fn get_line_index(
&self,
specifier: &ModuleSpecifier,
@@ -248,13 +240,6 @@ impl Inner {
false
}
- fn get_length_utf16(&mut self, specifier: &ModuleSpecifier) -> Option<usize> {
- let specifier =
- resolve_specifier(specifier, &mut self.redirects, &self.http_cache)?;
- let metadata = self.get_metadata(&specifier)?;
- Some(metadata.length_utf16)
- }
-
fn get_line_index(
&mut self,
specifier: &ModuleSpecifier,
@@ -472,19 +457,6 @@ mod tests {
}
#[test]
- fn test_sources_get_length_utf16() {
- let (sources, _) = setup();
- let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
- let tests = c.join("tests");
- let specifier =
- resolve_path(&tests.join("001_hello.js").to_string_lossy()).unwrap();
- let actual = sources.get_length_utf16(&specifier);
- assert!(actual.is_some());
- let actual = actual.unwrap();
- assert_eq!(actual, 28);
- }
-
- #[test]
fn test_resolve_dependency_types() {
let (sources, location) = setup();
let cache = HttpCache::new(&location);