summaryrefslogtreecommitdiff
path: root/cli/lsp/diagnostics.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-02-18 15:37:05 +1100
committerGitHub <noreply@github.com>2021-02-18 15:37:05 +1100
commit2225e83da2d118678e3df1e2801af195166bc65a (patch)
tree0d33bdf77e19872a72fca4364281c6cc14ec5724 /cli/lsp/diagnostics.rs
parent78e34d49120d8cc2583d8d6d28ae9b74f9765533 (diff)
fix(lsp): handle data URLs properly (#9522)
Fixes #9514 Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/lsp/diagnostics.rs')
-rw-r--r--cli/lsp/diagnostics.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs
index 8017d7e28..705f0866d 100644
--- a/cli/lsp/diagnostics.rs
+++ b/cli/lsp/diagnostics.rs
@@ -295,9 +295,11 @@ pub async fn generate_dependency_diagnostics(
}
ResolvedDependency::Resolved(specifier) => {
if !(state_snapshot.documents.contains_key(&specifier) || sources.contains_key(&specifier)) {
- let is_local = specifier.scheme() == "file";
- let (code, message) = if is_local {
+ let scheme = specifier.scheme();
+ let (code, message) = if scheme == "file" {
(Some(lsp::NumberOrString::String("no-local".to_string())), format!("Unable to load a local module: \"{}\".\n Please check the file path.", specifier))
+ } else if scheme == "data" {
+ (Some(lsp::NumberOrString::String("no-cache-data".to_string())), "Uncached data URL.".to_string())
} else {
(Some(lsp::NumberOrString::String("no-cache".to_string())), format!("Unable to load the remote module: \"{}\".", specifier))
};