summaryrefslogtreecommitdiff
path: root/cli/args/lockfile.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-05-22 21:28:36 -0400
committerGitHub <noreply@github.com>2023-05-22 21:28:36 -0400
commitbb37dfb5b79c0e5ae18d34f01313cb1f39d7a2dd (patch)
treeeed3c2a5ed443933e6809b4c9541c75b651fb38f /cli/args/lockfile.rs
parent58782589528dc442e2a1fdf6d98454cbf01ac2ad (diff)
feat(lsp): support lockfile and node_modules directory (#19203)
This adds support for the lockfile and node_modules directory to the lsp. In the case of the node_modules directory, it is only enabled when explicitly opted into via `"nodeModulesDir": true` in the configuration file. This is to reduce the language server automatically modifying the node_modules directory when the user doesn't want it to. Closes #16510 Closes #16373
Diffstat (limited to 'cli/args/lockfile.rs')
-rw-r--r--cli/args/lockfile.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs
index aa7e51fa1..c169c7b00 100644
--- a/cli/args/lockfile.rs
+++ b/cli/args/lockfile.rs
@@ -17,7 +17,6 @@ use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot;
use deno_npm::NpmPackageId;
use deno_semver::npm::NpmPackageReq;
-use crate::args::config_file::LockConfig;
use crate::args::ConfigFile;
use crate::npm::CliNpmRegistryApi;
use crate::Flags;
@@ -45,22 +44,9 @@ pub fn discover(
None => match maybe_config_file {
Some(config_file) => {
if config_file.specifier.scheme() == "file" {
- match config_file.to_lock_config()? {
- Some(LockConfig::Bool(lock)) if !lock => {
- return Ok(None);
- }
- Some(LockConfig::PathBuf(lock)) => config_file
- .specifier
- .to_file_path()
- .unwrap()
- .parent()
- .unwrap()
- .join(lock),
- _ => {
- let mut path = config_file.specifier.to_file_path().unwrap();
- path.set_file_name("deno.lock");
- path
- }
+ match config_file.resolve_lockfile_path()? {
+ Some(path) => path,
+ None => return Ok(None),
}
} else {
return Ok(None);