Repository: astral-sh/ruff
File: crates/ty_server/src/session.rs (Rust)

Code before:

    pub(crate) fn resolved_client_capabilities(&self) -> ResolvedClientCapabilities {
        self.resolved_client_capabilities
    }

    pub(crate) const fn in_test(&self) -> bool {
        self.in_test
    }

    pub(crate) fn revision(&self) -> u64 {
        self.revision
    }

    pub(crate) fn client_name(&self) -> Option<&str> {
        self.client_name.as_deref()
    }
}

/// Returns editor-specific guidance for finding logs.
///
/// Different editors have different ways to access language server logs,
/// so we provide tailored instructions based on the connected client.
pub(crate) fn log_guidance(client_name: Option<&str>) -> &'static str {
    match client_name {
        Some("Zed") => {
            "Check the logs for more details (find logs via the command palette: `dev: open language server logs`)."
        }
        // Generic message for other editors. VS Code has a "Show Logs" button via the ty extension.
        _ => "Check the logs for more details.",
    }
}

#[derive(Debug, Default)]
pub(crate) struct Workspaces {
    workspaces: BTreeMap<SystemPathBuf, Workspace>,
    uninitialized: usize,
}

impl Workspaces {
    /// Registers a new workspace with the given URL and default settings for the workspace.
    ///
    /// It's the caller's responsibility to later call [`initialize`] with the resolved settings
    /// for this workspace. Registering and initializing a workspace is a two-step process because
    /// the workspace are announced to the server during the `initialize` request, but the
    /// resolved settings are only available after the client has responded to the `workspace/configuration`
    /// request.
    ///
    /// [`initialize`]: Workspaces::initialize
    pub(crate) fn register(&mut self, url: Url) -> anyhow::Result<()> {
        let path = url
            .to_file_path()

Review comment (suggestion):
```suggestion
            "Check the logs for more details (command palette: `dev: open language server logs`)."
```

The *find logs* part confused me for a bit. I think saying "command pallete" and mentioning the text to search for should be sufficient.

Code after:
    pub(crate) fn resolved_client_capabilities(&self) -> ResolvedClientCapabilities {
        self.resolved_client_capabilities
    }

    pub(crate) const fn in_test(&self) -> bool {
        self.in_test
    }

    pub(crate) fn revision(&self) -> u64 {
        self.revision
    }

    pub(crate) fn client_name(&self) -> ClientName {
        self.client_name
    }
}

/// Represents the client (editor) that's connected to the language server.
#[derive(Debug, Clone, Copy)]
pub(crate) enum ClientName {
    Zed,
    Other,
}

impl From<Option<ClientInfo>> for ClientName {
    fn from(info: Option<ClientInfo>) -> Self {
        match info {
            Some(info) if matches!(info.name.as_str(), "Zed") => ClientName::Zed,
            _ => ClientName::Other,
        }
    }
}

impl ClientName {
    /// Returns editor-specific guidance for finding logs.
    ///
    /// Different editors have different ways to access language server logs, so we provide tailored
    /// instructions based on the connected client.
    pub(crate) fn log_guidance(self) -> &'static str {
        match self {
            ClientName::Zed => {
                "Please refer to the logs for more details \
                    (command palette: `dev: open language server logs`)."
            }
            ClientName::Other => "Please refer to the logs for more details.",
        }
    }
}

#[derive(Debug, Default)]
pub(crate) struct Workspaces {