diff options
| author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-05-01 01:44:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-01 01:44:20 +0100 |
| commit | ac9e07bdfa525c22190fed76b9cfbac6e4b486af (patch) | |
| tree | fca06d239af585e96f9dbcd560e6ce2d315cdcd0 | |
| parent | 544d248c1655d784fb9cff1e94a575104efc4ea2 (diff) | |
chore(lsp): revert import map pre-resolution for jsxImportSource (#23619)
| -rw-r--r-- | cli/lsp/config.rs | 27 | ||||
| -rw-r--r-- | tests/integration/lsp_tests.rs | 2 |
2 files changed, 4 insertions, 25 deletions
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index ec209e0e6..e1fed5a54 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -1057,35 +1057,13 @@ impl Default for LspTsConfig { } impl LspTsConfig { - pub fn new( - config_file: Option<&ConfigFile>, - import_map: Option<&ImportMap>, - ) -> Self { + pub fn new(config_file: Option<&ConfigFile>) -> Self { let mut ts_config = Self::default(); match ts_config.inner.merge_tsconfig_from_config_file(config_file) { Ok(Some(ignored_options)) => lsp_warn!("{}", ignored_options), Err(err) => lsp_warn!("{}", err), _ => {} } - let mut maybe_map_jsx_import_source = || { - let import_map = import_map?; - let referrer = &config_file?.specifier; - let compiler_options = ts_config.inner.0.as_object_mut()?; - let jsx_import_source = compiler_options - .get("jsxImportSourceTypes") - .and_then(|v| v.as_str()) - .or_else(|| { - compiler_options - .get("jsxImportSource") - .and_then(|v| v.as_str()) - })?; - let jsx_import_source = - import_map.resolve(jsx_import_source, referrer).ok()?; - compiler_options - .insert("jsxImportSource".to_string(), json!(jsx_import_source)); - Some(()) - }; - maybe_map_jsx_import_source(); ts_config } } @@ -1268,6 +1246,8 @@ impl ConfigData { (lint_options, lint_rules) }); + let ts_config = LspTsConfig::new(config_file.as_ref()); + let vendor_dir = config_file.as_ref().and_then(|c| c.vendor_dir_path()); // Load lockfile @@ -1436,7 +1416,6 @@ impl ConfigData { } } } - let ts_config = LspTsConfig::new(config_file.as_ref(), import_map.as_ref()); ConfigData { scope: scope.clone(), diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index d000973c0..d9f2f10cc 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -10628,7 +10628,7 @@ export function B() { ); let diagnostics = client.read_diagnostics(); - assert_eq!(diagnostics.all().len(), 0); + assert_eq!(json!(diagnostics.all()), json!([])); let res = client.write_request( "textDocument/hover", |
