Add native locator for finding pythons - #23208
Merged
Karthik Nadig (karthiknadig) merged 6 commits intoMay 3, 2024
Merged
Conversation
| tmp/** | ||
| typings/** | ||
| types/** | ||
| native_locator/src/** |
Member
Author
There was a problem hiding this comment.
Why do we need the source in the VSIX?
There was a problem hiding this comment.
oh never mind, I mis-understood what this file was for.
| fn get_conda_package_json_path(any_path: &Path, package: &str) -> Option<PathBuf> { | ||
| let package_name = format!("{}-", package); | ||
| let conda_meta_path = get_conda_meta_path(any_path); | ||
| match conda_meta_path { |
There was a problem hiding this comment.
Haven't tested but you can probably simplify this to something like:
/// Get the path to the json file of a package in the conda environment from the 'conda-meta' directory.
fn get_conda_package_json_path(any_path: &Path, package: &str) -> Option<PathBuf> {
let package_name = format!("{}-", package);
let conda_meta_path = get_conda_meta_path(any_path)?;
std::fs::read_dir(conda_meta_path).ok()?.find_map(|entry| {
let path = entry.ok()?.path();
let file_name = path.file_name()?.to_string_lossy();
if file_name.starts_with(&package_name) && file_name.ends_with(".json") {
Some(path)
} else {
None
}
})
}
Member
Author
There was a problem hiding this comment.
Thanks Wolf Vollprecht (@wolfv) that simplifies it :)
Karthik Nadig (karthiknadig)
force-pushed
the
rust-locator
branch
from
May 3, 2024 18:35
47a0974 to
18c468f
Compare
Karthik Nadig (karthiknadig)
marked this pull request as ready for review
May 3, 2024 18:39
Anthony Kim (anthonykim1)
pushed a commit
to anthonykim1/vscode-python
that referenced
this pull request
May 16, 2024
Don Jayamanne (DonJayamanne)
pushed a commit
that referenced
this pull request
Jun 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.