build_feature_completion

Function build_feature_completion 

Source
pub fn build_feature_completion(
    feature_name: &str,
    package_name: &str,
    insert_range: 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

§Returns

A complete CompletionItem for the feature flag.

§Examples

use deps_core::completion::build_feature_completion;
use tower_lsp_server::ls_types::Range;

let range = Range::default();
let item = build_feature_completion("derive", "serde", range);
assert_eq!(item.label, "derive");