Skip to main content

build_feature_completion

Function build_feature_completion 

Source
pub fn build_feature_completion(
    feature_name: &str,
    package_name: &str,
    insert_range: Option<Range>,
) -> CompletionItem
Expand description

Builds a completion item for a feature flag.

Creates a properly formatted LSP CompletionItem for feature flag names. Only applicable to ecosystems that support features (e.g., Cargo).

§Arguments

  • feature_name - Name of the feature flag
  • package_name - Name of the package this feature belongs to
  • insert_range - LSP range where the completion should be inserted, or None to omit textEdit and let the client insert at cursor position via insertText

§Returns

A complete CompletionItem for the feature flag.

§Examples

use deps_core::completion::build_feature_completion;

let item = build_feature_completion("derive", "serde", None);
assert_eq!(item.label, "derive");