From 633c5aab1f28538dde619fe755f8ec9fa77a3719 Mon Sep 17 00:00:00 2001 From: jeiea Date: Sun, 6 Jun 2021 14:00:17 +0900 Subject: fix(#10747): cannot read config option in windows (#10791) Fixes #10747 --- cli/lsp/language_server.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cli/lsp/language_server.rs') diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 10bb0478e..9e4e6af14 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -447,7 +447,15 @@ impl Inner { )) }?; - let config_file = ConfigFile::read(config_url.path())?; + let config_file = { + let buffer = config_url + .to_file_path() + .map_err(|_| anyhow!("Bad uri: \"{}\"", config_url))?; + let path = buffer + .to_str() + .ok_or_else(|| anyhow!("Bad uri: \"{}\"", config_url))?; + ConfigFile::read(path)? + }; let (value, maybe_ignored_options) = config_file.as_compiler_options()?; tsconfig.merge(&value); self.maybe_config_uri = Some(config_url); -- cgit v1.2.3