Allow each language adapter to provide their own code action kinds array
This commit is contained in:
@@ -20,6 +20,7 @@ use futures::{
|
||||
use gpui::{executor::Background, MutableAppContext, Task};
|
||||
use highlight_map::HighlightMap;
|
||||
use lazy_static::lazy_static;
|
||||
use lsp::CodeActionKind;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use postage::watch;
|
||||
use regex::Regex;
|
||||
@@ -140,6 +141,10 @@ impl CachedLspAdapter {
|
||||
self.adapter.cached_server_binary(container_dir).await
|
||||
}
|
||||
|
||||
pub fn code_action_kinds(&self) -> Option<Vec<CodeActionKind>> {
|
||||
self.adapter.code_action_kinds()
|
||||
}
|
||||
|
||||
pub fn workspace_configuration(
|
||||
&self,
|
||||
cx: &mut MutableAppContext,
|
||||
@@ -225,6 +230,16 @@ pub trait LspAdapter: 'static + Send + Sync {
|
||||
None
|
||||
}
|
||||
|
||||
fn code_action_kinds(&self) -> Option<Vec<CodeActionKind>> {
|
||||
Some(vec![
|
||||
CodeActionKind::EMPTY,
|
||||
CodeActionKind::QUICKFIX,
|
||||
CodeActionKind::REFACTOR,
|
||||
CodeActionKind::REFACTOR_EXTRACT,
|
||||
CodeActionKind::SOURCE,
|
||||
])
|
||||
}
|
||||
|
||||
async fn disk_based_diagnostic_sources(&self) -> Vec<String> {
|
||||
Default::default()
|
||||
}
|
||||
@@ -825,6 +840,7 @@ impl LanguageRegistry {
|
||||
&binary.path,
|
||||
&binary.arguments,
|
||||
&root_path,
|
||||
adapter.code_action_kinds(),
|
||||
cx,
|
||||
)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user