Repository: zed-industries/zed
File: crates/languages/src/python.rs (Rust)

Code before:
            '1' // protected
        } else {
            '0' // public
        };

        let is_external = item
            .detail
            .as_ref()
            .is_some_and(|detail| detail == "Auto-import");

        let source_priority = if is_external { '1' } else { '0' };

        // Kind priority within same visibility level
        let kind_priority = match item.kind {
            Some(lsp::CompletionItemKind::KEYWORD) => '0',
            Some(lsp::CompletionItemKind::ENUM_MEMBER) => '1',
            Some(lsp::CompletionItemKind::FIELD) => '2',
            Some(lsp::CompletionItemKind::PROPERTY) => '3',
            Some(lsp::CompletionItemKind::VARIABLE) => '4',
            Some(lsp::CompletionItemKind::CONSTANT) => '5',
            Some(lsp::CompletionItemKind::METHOD) => '6',
            Some(lsp::CompletionItemKind::FUNCTION) => '6',
            Some(lsp::CompletionItemKind::CLASS) => '7',
            Some(lsp::CompletionItemKind::MODULE) => '8',

            Some(lsp::CompletionItemKind::TEXT) => 'z',
            _ => 'z',
        };

        // Named arguments get higher priority
        let argument_priority = if is_named_argument { '0' } else { '1' };

        item.sort_text = Some(format!(
            "{}{}{}{}{}",
            argument_priority, source_priority, visibility_priority, kind_priority, item.label
        ));
    }
}

pub struct TyLspAdapter {
    fs: Arc<dyn Fs>,
}

#[cfg(target_os = "macos")]
impl TyLspAdapter {
    const GITHUB_ASSET_KIND: AssetKind = AssetKind::TarGz;
    const ARCH_SERVER_NAME: &str = "apple-darwin";
}

#[cfg(target_os = "linux")]
impl TyLspAdapter {

Review comment (refactor):
PR looks good. Can we remove this redudant arm? I think then it's good to go. This is much better than what we had previously.

Code after:
            '1' // protected
        } else {
            '0' // public
        };

        let is_external = item
            .detail
            .as_ref()
            .is_some_and(|detail| detail == "Auto-import");

        let source_priority = if is_external { '1' } else { '0' };

        // Kind priority within same visibility level
        let kind_priority = match item.kind {
            Some(lsp::CompletionItemKind::KEYWORD) => '0',
            Some(lsp::CompletionItemKind::ENUM_MEMBER) => '1',
            Some(lsp::CompletionItemKind::FIELD) => '2',
            Some(lsp::CompletionItemKind::PROPERTY) => '3',
            Some(lsp::CompletionItemKind::VARIABLE) => '4',
            Some(lsp::CompletionItemKind::CONSTANT) => '5',
            Some(lsp::CompletionItemKind::METHOD) => '6',
            Some(lsp::CompletionItemKind::FUNCTION) => '6',
            Some(lsp::CompletionItemKind::CLASS) => '7',
            Some(lsp::CompletionItemKind::MODULE) => '8',

            _ => 'z',
        };

        // Named arguments get higher priority
        let argument_priority = if is_named_argument { '0' } else { '1' };

        item.sort_text = Some(format!(
            "{}{}{}{}{}",
            argument_priority, source_priority, visibility_priority, kind_priority, item.label
        ));
    }
}

pub struct TyLspAdapter {
    fs: Arc<dyn Fs>,
}

#[cfg(target_os = "macos")]
impl TyLspAdapter {
    const GITHUB_ASSET_KIND: AssetKind = AssetKind::TarGz;
    const ARCH_SERVER_NAME: &str = "apple-darwin";
}

#[cfg(target_os = "linux")]
impl TyLspAdapter {
    const GITHUB_ASSET_KIND: AssetKind = AssetKind::TarGz;