Skip to main content

Module lsp_helpers

Module lsp_helpers 

Source
Expand description

Shared LSP response builders.

Structs§

CharOffsets
Maps a yaml-rust2 char index to a byte offset in content, and a byte offset to the end of its containing line.
DependencyOutcome
Everything the lifecycle fetch learned about one package, keyed by its normalized name.
DependencyOutcomes
Normalized-package-name -> DependencyOutcome map.
DiagnosticSeverities
Diagnostic severity levels for the four per-dependency issue categories.
LineOffsetTable
Converts byte offsets in source text to LSP Position values.
PackageVersions
Registry version data for one package, fetched together in a single round trip.
VersionData
Bundles the two per-package version maps (cached, resolved) that LSP handlers pass together everywhere.

Enums§

RequirementStatus
Result of checking whether a dependency’s declared requirement is already satisfied by the latest known version.

Constants§

CMD_DOT_FOOTER
The Cmd+. update-footer markdown this function appends when a code action may exist for the hovered dependency.
DEPRECATED_DIAGNOSTIC_CODE
Stable [Diagnostic::code] set on the package-level deprecation diagnostic (issue #205).
HOVER_RECENT_VERSIONS
Maximum number of recent versions hover’s “Recent versions” section renders.
MAX_FALLBACK_SCAN_BYTES
Upper bound, in bytes past search_from, on how far locate_value_span’s fallback scan will search.
UNSATISFIABLE_DIAGNOSTIC_CODE
Stable [Diagnostic::code] set on the unsatisfiable-requirement diagnostic.

Traits§

DiagnosticMessages
Static wording for diagnostics and hover about yanked/deprecated package state.
DiagnosticPolicy
Per-ecosystem opt-outs for which diagnostics apply to which dependency/requirement shapes.
EcosystemFormatter
Umbrella marker for a complete ecosystem formatter.
OsvNaming
Native <-> OSV.dev namespace bridging for package names and version strings.
PackageNaming
Ecosystem-specific package name normalization and validation.
PackageRendering
How a package/version renders into manifest text edits and hover content.
RequirementMatcher
A requirement compiled by one ecosystem, ready to test candidate versions against.
RequirementResolution
Requirement parsing, matching, and up-to-date status.
SourcePolicy
What a DependencySource may be used for: resolution, vulnerability scanning, and cache-key/link trust.

Functions§

collect_update_all_edits
Manifest edits bringing every safely-editable outdated dependency to latest.
compile_requirement_unless
Shared shape for a crate::lsp_helpers::RequirementResolution::compile_requirement guarded by one predicate.
concrete_pin_version
Returns the concrete version text requirement denotes, or None if requirement is not the shape of a single concrete version.
escape_markdown
Escapes Markdown syntax characters so untrusted text cannot break out of the Markdown structure it is embedded in.
generate_code_actions
Generates the code actions offered for the dependency at position.
generate_code_lenses
Zero or one lens for the document, bound to command_id.
generate_diagnostics_from_cache
Generates diagnostics using cached versions (no network calls).
generate_hover
generate_inlay_hints
in_use_version
The version of dep this project treats as actually in use.
is_dot_segment
Whether segment is exactly . or ...
is_full_semver_shape
Whether s has the shape of a full major.minor.patch version.
is_full_sha
Whether s is a 40-character hex string — a git commit SHA shape, shared by every ecosystem resolving refs against a git-tags-datasource API (GitHub, GitLab).
is_safe_maven_coordinate_segment
Whether segment is safe to embed as a Maven groupId/artifactId value in a pom.xml [TextEdit] or completion item.
is_safe_package_name
Whether name is safe to embed as a package name in a manifest [TextEdit] or completion item.
is_safe_registry_url
Whether url is safe to embed as a Swift Package Manager repository URL in a Package.swift [TextEdit] or completion item.
is_safe_version_string
Whether version is safe to embed in a manifest [TextEdit] or completion item.
is_same_major_minor
Checks if two version strings have the same major and minor version.
is_tag_shaped
Whether s has the shape of a tag ref: an optional leading v/V followed by a digit.
locate_value_span
Finds the byte offset in content (searching only within the line starting at search_from) where the literal bytes of value occur.
markdown_code_span
Wraps content in a Markdown inline code span (backticks included) that safely contains arbitrary untrusted text, regardless of embedded backticks.
match_v_prefix_style
Rewrites tag to match current’s leading v/V prefix style (or lack of one).
position_in_range
Checks whether a cursor position falls within an LSP range (inclusive on both ends).
requirement_is_unsatisfiable
Returns true when no published version satisfies requirement.
truncate_for_diagnostic
Truncates value to at most max_chars characters, appending when truncated.
warn_rejected_value
Logs a tracing::warn! for a value rejected by an is_safe_* predicate (or an equivalent value-rejecting gate) before it reaches a manifest edit or registry URL.