Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lsp): cache jsxImportSource automatically #21687

Merged
merged 7 commits into from
Jan 2, 2024

Conversation

nayeemrmn
Copy link
Collaborator

@nayeemrmn nayeemrmn commented Dec 22, 2023

Fixes #20582.
Fixes #21725.

When a deno.json file is loaded, read compilerOptions.jsxImportSource and queue a task to cache it.

cli/lsp/language_server.rs Outdated Show resolved Hide resolved
cli/lsp/language_server.rs Outdated Show resolved Hide resolved
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsherret any more comments?

Comment on lines +1070 to +1073
if let Some(config_file) = self.config.maybe_config_file() {
if let Ok((compiler_options, _)) = config_file.to_compiler_options() {
if let Some(compiler_options_obj) = compiler_options.as_object() {
if let Some(jsx_import_source) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, but all of this should be simplified using let else

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it could just be extracted out to a separate method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case IMO it's more readable like this, I don't want to add more methods for this because it's going to be moved for #21029.

cli/lsp/language_server.rs Show resolved Hide resolved
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +1070 to +1073
if let Some(config_file) = self.config.maybe_config_file() {
if let Ok((compiler_options, _)) = config_file.to_compiler_options() {
if let Some(compiler_options_obj) = compiler_options.as_object() {
if let Some(jsx_import_source) =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it could just be extracted out to a separate method?

@nayeemrmn nayeemrmn merged commit 261f32e into denoland:main Jan 2, 2024
14 checks passed
@nayeemrmn nayeemrmn deleted the lsp-jsx-import-source-auto-cache branch January 2, 2024 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants