MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / resolve_mago

Function resolve_mago

src/mago.rs:82–97  ·  view source on GitHub ↗

Attempt to resolve the Mago binary from configuration and the workspace environment. Resolution rules: - Config value `Some("")` (empty string) → disabled (`None`). - Config value `Some(cmd)` → use `cmd` as-is (user override). - Config value `None` → auto-detect: try `vendor/bin/mago` under the workspace root, then search `$PATH`.

(
    workspace_root: Option<&Path>,
    config: &MagoConfig,
    bin_dir: Option<&str>,
)

Source from the content-addressed store, hash-verified

80/// - Config value `None` → auto-detect: try `vendor/bin/mago` under
81/// the workspace root, then search `$PATH`.
82pub(crate) fn resolve_mago(
83 workspace_root: Option<&Path>,
84 config: &MagoConfig,
85 bin_dir: Option<&str>,
86) -> Option<ResolvedMago> {
87 match config.command.as_deref() {
88 // Explicitly disabled.
89 Some("") => None,
90 // User-provided command.
91 Some(cmd) => Some(ResolvedMago {
92 path: PathBuf::from(cmd),
93 }),
94 // Auto-detect.
95 None => auto_detect(workspace_root, bin_dir),
96 }
97}
98
99/// Auto-detect Mago by checking `<bin_dir>/mago` then `$PATH`.
100fn auto_detect(workspace_root: Option<&Path>, bin_dir: Option<&str>) -> Option<ResolvedMago> {

Calls 1

auto_detectFunction · 0.70