Use LanguageServerName in more places (#18167)

This pushes the new LanguageServerName type to more places.

As both languages and language servers were identified by Arc<str>, it
was
sometimes hard to tell which was intended.

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-09-20 18:51:34 -06:00 committed by GitHub
parent 743feb98bc
commit 4f227fd3bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 150 additions and 85 deletions

View file

@ -33,7 +33,7 @@ fn server_binary_arguments() -> Vec<OsString> {
pub struct GoLspAdapter;
impl GoLspAdapter {
const SERVER_NAME: &'static str = "gopls";
const SERVER_NAME: LanguageServerName = LanguageServerName::new_static("gopls");
}
static GOPLS_VERSION_REGEX: LazyLock<Regex> =
@ -46,7 +46,7 @@ static GO_ESCAPE_SUBTEST_NAME_REGEX: LazyLock<Regex> = LazyLock::new(|| {
#[async_trait(?Send)]
impl super::LspAdapter for GoLspAdapter {
fn name(&self) -> LanguageServerName {
LanguageServerName(Self::SERVER_NAME.into())
Self::SERVER_NAME.clone()
}
async fn fetch_latest_server_version(
@ -71,7 +71,8 @@ impl super::LspAdapter for GoLspAdapter {
cx: &AsyncAppContext,
) -> Option<LanguageServerBinary> {
let configured_binary = cx.update(|cx| {
language_server_settings(delegate, Self::SERVER_NAME, cx).and_then(|s| s.binary.clone())
language_server_settings(delegate, &Self::SERVER_NAME, cx)
.and_then(|s| s.binary.clone())
});
match configured_binary {