Struct NpmEcosystem
pub struct NpmEcosystem { /* private fields */ }Expand description
npm ecosystem implementation.
Provides LSP functionality for package.json files, including:
- Dependency parsing with position tracking
- Version information from npm registry
- Inlay hints for latest versions
- Hover tooltips with package metadata
- Code actions for version updates
- Diagnostics for unknown/deprecated packages
Implementations§
§impl NpmEcosystem
impl NpmEcosystem
pub fn new(cache: Arc<HttpCache>) -> NpmEcosystem
pub fn new(cache: Arc<HttpCache>) -> NpmEcosystem
Creates a new npm ecosystem with the given HTTP cache, using a fresh, default
[NpmParseContext] — an all-PublicOnly-policy, empty-cache context private to this
ecosystem instance. Production use goes through Self::with_context instead.
pub fn with_registry(registry: Arc<NpmRegistry>) -> NpmEcosystem
pub fn with_registry(registry: Arc<NpmRegistry>) -> NpmEcosystem
Creates a new npm ecosystem around an existing NpmRegistry instance (#312), using
a fresh, default [NpmParseContext].
Used only by tests that need a shared NpmRegistry but no live .npmrc policy of
their own; production registration goes through Self::with_context.
pub fn with_context(
registry: Arc<NpmRegistry>,
ctx: NpmParseContext,
) -> NpmEcosystem
pub fn with_context( registry: Arc<NpmRegistry>, ctx: NpmParseContext, ) -> NpmEcosystem
Creates a new npm ecosystem sharing ctx’s reachability policy and .npmrc
memoization cache, around an existing NpmRegistry instance (#312) — the production
constructor, used by crate::lib::register_ecosystems so
initialize/workspace/didChangeConfiguration can update the same
Arc<RegistryAccessPolicy> this ecosystem’s every parse reads, and so deps-deno can
share one NpmRegistry (and thus one freshness-path publish-time cache) with this
ecosystem via its own DenoRegistry::with_npm.
Trait Implementations§
§impl Ecosystem for NpmEcosystem
impl Ecosystem for NpmEcosystem
§fn generate_hover<'a>(
&'a self,
parse_result: &'a dyn ParseResult,
position: Position,
versions: VersionData<'a>,
freshness: FreshnessSettings,
) -> Pin<Box<dyn Future<Output = Option<Hover>> + Send + 'a>>
fn generate_hover<'a>( &'a self, parse_result: &'a dyn ParseResult, position: Position, versions: VersionData<'a>, freshness: FreshnessSettings, ) -> Pin<Box<dyn Future<Output = Option<Hover>> + Send + 'a>>
Appends a **Catalog** line (spec 046) to the shared default’s hover output for a
catalog:/catalog:<name>-referencing dependency — the base hover already renders
everything else identically to a literal-range dependency (FR-004), since a resolved
catalog entry rewrites version_req in place before hover ever runs.
§fn generate_diagnostics<'a>(
&'a self,
parse_result: &'a dyn ParseResult,
versions: VersionData<'a>,
uri: &'a Uri,
freshness: FreshnessSettings,
severities: DiagnosticSeverities,
) -> Pin<Box<dyn Future<Output = Vec<Diagnostic>> + Send + 'a>>
fn generate_diagnostics<'a>( &'a self, parse_result: &'a dyn ParseResult, versions: VersionData<'a>, uri: &'a Uri, freshness: FreshnessSettings, severities: DiagnosticSeverities, ) -> Pin<Box<dyn Future<Output = Vec<Diagnostic>> + Send + 'a>>
Appends one diagnostic per unresolved catalog:-referencing dependency (spec 046
FR-005/FR-006) to the shared default’s output — additive, since the base pass never
evaluates a catalog dependency’s outdated/unsatisfiable/yanked status once
version_req is None (the module’s totality invariant closes that off structurally).
§fn display_name(&self) -> &'static str
fn display_name(&self) -> &'static str
§fn manifest_filenames(&self) -> &[&'static str]
fn manifest_filenames(&self) -> &[&'static str]
§fn lockfile_filenames(&self) -> &[&'static str]
fn lockfile_filenames(&self) -> &[&'static str]
§fn watched_config_filenames(&self) -> &[&'static str]
fn watched_config_filenames(&self) -> &[&'static str]
Self::parse_manifest
(e.g. ["pnpm-workspace.yaml", ".npmrc"] for npm’s catalog and registry resolution),
whose values end up baked into a manifest’s ParseResult rather than looked up
separately the way a Self::lockfile_provider is. Read more§fn parse_manifest<'a>(
&'a self,
content: &'a str,
uri: &'a Uri,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn ParseResult>, DepsError>> + Send + 'a>>
fn parse_manifest<'a>( &'a self, content: &'a str, uri: &'a Uri, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ParseResult>, DepsError>> + Send + 'a>>
§fn lockfile_provider(&self) -> Option<Arc<dyn LockFileProvider>>
fn lockfile_provider(&self) -> Option<Arc<dyn LockFileProvider>>
§fn formatter(&self) -> &dyn EcosystemFormatter
fn formatter(&self) -> &dyn EcosystemFormatter
§fn generate_completions<'a>(
&'a self,
parse_result: &'a dyn ParseResult,
position: Position,
content: &'a str,
freshness: FreshnessSettings,
) -> Pin<Box<dyn Future<Output = Completions> + Send + 'a>>
fn generate_completions<'a>( &'a self, parse_result: &'a dyn ParseResult, position: Position, content: &'a str, freshness: FreshnessSettings, ) -> Pin<Box<dyn Future<Output = Completions> + Send + 'a>>
§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Source§fn manifest_extensions(&self) -> &[&'static str]
fn manifest_extensions(&self) -> &[&'static str]
[".csproj", ".fsproj"] for NuGet project files). Read moreSource§fn manifest_patterns(&self) -> &[&'static str]
fn manifest_patterns(&self) -> &[&'static str]
* wildcard (e.g. ["requirements*.txt"]). Read moreSource§fn manifest_directory_patterns(&self) -> &[(&'static str, &'static str)]
fn manifest_directory_patterns(&self) -> &[(&'static str, &'static str)]
(directory_path, file_suffix) pairs identifying a file solely by its
containing directory path and suffix. directory_path may be a single
segment (e.g. [("requirements", ".txt")] for Python’s
requirements/base.txt split-file layout) or multiple /-joined
segments (e.g. [(".github/workflows", ".yml")] for GitHub Actions
workflow files) — either way it is matched against the tail of the
file’s directory path on segment boundaries, not just the immediate
parent, so a multi-segment pattern matches regardless of how many
ancestor directories precede it. Used when the basename alone carries
no ecosystem signal. Read moreSource§fn generate_inlay_hints<'a>(
&'a self,
parse_result: &'a dyn ParseResult,
versions: VersionData<'a>,
loading_state: LoadingState,
config: &'a EcosystemConfig,
) -> Pin<Box<dyn Future<Output = Vec<InlayHint>> + Send + 'a>>
fn generate_inlay_hints<'a>( &'a self, parse_result: &'a dyn ParseResult, versions: VersionData<'a>, loading_state: LoadingState, config: &'a EcosystemConfig, ) -> Pin<Box<dyn Future<Output = Vec<InlayHint>> + Send + 'a>>
Source§fn generate_code_actions<'a>(
&'a self,
parse_result: &'a dyn ParseResult,
position: Position,
uri: &'a Uri,
versions: VersionData<'a>,
content: &'a str,
) -> Pin<Box<dyn Future<Output = Vec<CodeAction>> + Send + 'a>>
fn generate_code_actions<'a>( &'a self, parse_result: &'a dyn ParseResult, position: Position, uri: &'a Uri, versions: VersionData<'a>, content: &'a str, ) -> Pin<Box<dyn Future<Output = Vec<CodeAction>> + Send + 'a>>
Source§fn generate_document_links(
&self,
_parse_result: &dyn ParseResult,
_uri: &Uri,
) -> Vec<DocumentLink>
fn generate_document_links( &self, _parse_result: &dyn ParseResult, _uri: &Uri, ) -> Vec<DocumentLink>
textDocument/documentLink targets for the document. Read moreSource§fn generate_code_lenses<'a>(
&'a self,
parse_result: &'a dyn ParseResult,
content: &'a str,
versions: VersionData<'a>,
uri: &'a Uri,
command_id: &'a str,
) -> Pin<Box<dyn Future<Output = Vec<CodeLens>> + Send + 'a>>
fn generate_code_lenses<'a>( &'a self, parse_result: &'a dyn ParseResult, content: &'a str, versions: VersionData<'a>, uri: &'a Uri, command_id: &'a str, ) -> Pin<Box<dyn Future<Output = Vec<CodeLens>> + Send + 'a>>
Source§fn package_search_is_incomplete(&self) -> bool
fn package_search_is_incomplete(&self) -> bool
PypiRegistry::search’s doc comment). Read moreimpl Sealed for NpmEcosystem
Auto Trait Implementations§
impl !RefUnwindSafe for NpmEcosystem
impl !UnwindSafe for NpmEcosystem
impl Freeze for NpmEcosystem
impl Send for NpmEcosystem
impl Sync for NpmEcosystem
impl Unpin for NpmEcosystem
impl UnsafeUnpin for NpmEcosystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more