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

refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver #23764

Merged
merged 13 commits into from
May 13, 2024

Conversation

nayeemrmn
Copy link
Collaborator

@nayeemrmn nayeemrmn commented May 10, 2024

So we don't need to have separate hooks in LspGraphResolver::resolve().

Unrelated: Remove redundant 1-layer dep recursion in op_script_names(). Cleanup other resolver interfaces.

cli/lsp/resolver.rs Outdated Show resolved Hide resolved
@nayeemrmn nayeemrmn requested a review from dsherret May 10, 2024 08:21
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.

Looks great! I think we'll need to update this to not use the state_cache in the LSP because it might get out of date.

cli/lsp/resolver.rs Outdated Show resolved Hide resolved
cli/resolver.rs Outdated
@@ -1065,7 +1053,7 @@ impl SloppyImportsResolver {
}

let probe_paths: Vec<(PathBuf, SloppyImportsResolutionReason)> =
match (stat_sync)(&path) {
match self.stat_cache.stat_sync(&path) {
Copy link
Member

Choose a reason for hiding this comment

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

One thing we're probably going to have to do with this change is not use a stat cache because it will get out of date.

Another point to note (that I mentioned on the last PR, but worth re-iterating to keep in mind) is that sloppy import resolution may change when a file is added or deleted. Probably in the future (I wouldn't suggest as part of this PR), we'll need to invalidate resolved resolution more when using sloppy imports.

@nayeemrmn nayeemrmn requested a review from dsherret May 11, 2024 06:55
cli/factory.rs Outdated Show resolved Hide resolved
cli/resolver.rs Outdated 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

@nayeemrmn nayeemrmn merged commit 88529f0 into denoland:main May 13, 2024
17 checks passed
@nayeemrmn nayeemrmn deleted the lsp-sloppy-imports-cleanup branch May 13, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants