Use a better type for language IDs field (#35566)
Part of the preparation for proto capabilities. Release Notes: - N/A
This commit is contained in:
parent
1b3d6139b8
commit
5ca5d90234
9 changed files with 52 additions and 50 deletions
|
@ -8,8 +8,8 @@ use futures::StreamExt;
|
|||
use gpui::{App, AsyncApp, Task};
|
||||
use http_client::github::{GitHubLspBinaryVersion, latest_github_release};
|
||||
use language::{
|
||||
ContextProvider, LanguageRegistry, LanguageToolchainStore, LocalFile as _, LspAdapter,
|
||||
LspAdapterDelegate,
|
||||
ContextProvider, LanguageName, LanguageRegistry, LanguageToolchainStore, LocalFile as _,
|
||||
LspAdapter, LspAdapterDelegate,
|
||||
};
|
||||
use lsp::{LanguageServerBinary, LanguageServerName};
|
||||
use node_runtime::NodeRuntime;
|
||||
|
@ -408,10 +408,10 @@ impl LspAdapter for JsonLspAdapter {
|
|||
Ok(config)
|
||||
}
|
||||
|
||||
fn language_ids(&self) -> HashMap<String, String> {
|
||||
fn language_ids(&self) -> HashMap<LanguageName, String> {
|
||||
[
|
||||
("JSON".into(), "json".into()),
|
||||
("JSONC".into(), "jsonc".into()),
|
||||
(LanguageName::new("JSON"), "json".into()),
|
||||
(LanguageName::new("JSONC"), "jsonc".into()),
|
||||
]
|
||||
.into_iter()
|
||||
.collect()
|
||||
|
|
|
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||
use collections::HashMap;
|
||||
use futures::StreamExt;
|
||||
use gpui::AsyncApp;
|
||||
use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
|
||||
use language::{LanguageName, LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
|
||||
use lsp::{LanguageServerBinary, LanguageServerName};
|
||||
use node_runtime::NodeRuntime;
|
||||
use project::{Fs, lsp_store::language_server_settings};
|
||||
|
@ -168,20 +168,20 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
}))
|
||||
}
|
||||
|
||||
fn language_ids(&self) -> HashMap<String, String> {
|
||||
fn language_ids(&self) -> HashMap<LanguageName, String> {
|
||||
HashMap::from_iter([
|
||||
("Astro".to_string(), "astro".to_string()),
|
||||
("HTML".to_string(), "html".to_string()),
|
||||
("CSS".to_string(), "css".to_string()),
|
||||
("JavaScript".to_string(), "javascript".to_string()),
|
||||
("TSX".to_string(), "typescriptreact".to_string()),
|
||||
("Svelte".to_string(), "svelte".to_string()),
|
||||
("Elixir".to_string(), "phoenix-heex".to_string()),
|
||||
("HEEX".to_string(), "phoenix-heex".to_string()),
|
||||
("ERB".to_string(), "erb".to_string()),
|
||||
("HTML/ERB".to_string(), "erb".to_string()),
|
||||
("PHP".to_string(), "php".to_string()),
|
||||
("Vue.js".to_string(), "vue".to_string()),
|
||||
(LanguageName::new("Astro"), "astro".to_string()),
|
||||
(LanguageName::new("HTML"), "html".to_string()),
|
||||
(LanguageName::new("CSS"), "css".to_string()),
|
||||
(LanguageName::new("JavaScript"), "javascript".to_string()),
|
||||
(LanguageName::new("TSX"), "typescriptreact".to_string()),
|
||||
(LanguageName::new("Svelte"), "svelte".to_string()),
|
||||
(LanguageName::new("Elixir"), "phoenix-heex".to_string()),
|
||||
(LanguageName::new("HEEX"), "phoenix-heex".to_string()),
|
||||
(LanguageName::new("ERB"), "erb".to_string()),
|
||||
(LanguageName::new("HTML/ERB"), "erb".to_string()),
|
||||
(LanguageName::new("PHP"), "php".to_string()),
|
||||
(LanguageName::new("Vue.js"), "vue".to_string()),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ use futures::future::join_all;
|
|||
use gpui::{App, AppContext, AsyncApp, Task};
|
||||
use http_client::github::{AssetKind, GitHubLspBinaryVersion, build_asset_url};
|
||||
use language::{
|
||||
ContextLocation, ContextProvider, File, LanguageToolchainStore, LspAdapter, LspAdapterDelegate,
|
||||
ContextLocation, ContextProvider, File, LanguageName, LanguageToolchainStore, LspAdapter,
|
||||
LspAdapterDelegate,
|
||||
};
|
||||
use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName};
|
||||
use node_runtime::NodeRuntime;
|
||||
|
@ -741,11 +742,11 @@ impl LspAdapter for TypeScriptLspAdapter {
|
|||
}))
|
||||
}
|
||||
|
||||
fn language_ids(&self) -> HashMap<String, String> {
|
||||
fn language_ids(&self) -> HashMap<LanguageName, String> {
|
||||
HashMap::from_iter([
|
||||
("TypeScript".into(), "typescript".into()),
|
||||
("JavaScript".into(), "javascript".into()),
|
||||
("TSX".into(), "typescriptreact".into()),
|
||||
(LanguageName::new("TypeScript"), "typescript".into()),
|
||||
(LanguageName::new("JavaScript"), "javascript".into()),
|
||||
(LanguageName::new("TSX"), "typescriptreact".into()),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use anyhow::Result;
|
|||
use async_trait::async_trait;
|
||||
use collections::HashMap;
|
||||
use gpui::AsyncApp;
|
||||
use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
|
||||
use language::{LanguageName, LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
|
||||
use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName};
|
||||
use node_runtime::NodeRuntime;
|
||||
use project::{Fs, lsp_store::language_server_settings};
|
||||
|
@ -273,11 +273,11 @@ impl LspAdapter for VtslsLspAdapter {
|
|||
Ok(default_workspace_configuration)
|
||||
}
|
||||
|
||||
fn language_ids(&self) -> HashMap<String, String> {
|
||||
fn language_ids(&self) -> HashMap<LanguageName, String> {
|
||||
HashMap::from_iter([
|
||||
("TypeScript".into(), "typescript".into()),
|
||||
("JavaScript".into(), "javascript".into()),
|
||||
("TSX".into(), "typescriptreact".into()),
|
||||
(LanguageName::new("TypeScript"), "typescript".into()),
|
||||
(LanguageName::new("JavaScript"), "javascript".into()),
|
||||
(LanguageName::new("TSX"), "typescriptreact".into()),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue