mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 10:42:08 +00:00
Implement workspace_configuration for Dart LSP (#8568)
This PR addressed https://github.com/zed-industries/zed/issues/8558 and allows the [Dart Client Workspace Configuration](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/tool/lsp_spec/README.md#client-workspace-configuration). Differing from the issue, the settings are used from the LSP settings section, example: ``` { "lsp": { "dart": { "settings": { "lineLength": 200 } } } } ``` Note: this only works for the global settings (not folder specific) Release Notes: - Fixed missing client workspace configuration of Dart LSP. Those can now be configured by setting `{"lsp": {"dart": { "settings: { "your-settings-here": "here"} } }` in the Zed settings. ([#8858](https://github.com/zed-industries/zed/issues/8558)).
This commit is contained in:
parent
34de33ef72
commit
d6492d091d
1 changed files with 20 additions and 1 deletions
|
@ -1,8 +1,15 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
use gpui::AppContext;
|
||||||
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
|
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
|
||||||
use lsp::LanguageServerBinary;
|
use lsp::LanguageServerBinary;
|
||||||
use std::{any::Any, path::PathBuf};
|
use project::project_settings::ProjectSettings;
|
||||||
|
use serde_json::Value;
|
||||||
|
use settings::Settings;
|
||||||
|
use std::{
|
||||||
|
any::Any,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct DartLanguageServer;
|
pub struct DartLanguageServer;
|
||||||
|
|
||||||
|
@ -51,4 +58,16 @@ impl LspAdapter for DartLanguageServer {
|
||||||
async fn installation_test_binary(&self, _: PathBuf) -> Option<LanguageServerBinary> {
|
async fn installation_test_binary(&self, _: PathBuf) -> Option<LanguageServerBinary> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn workspace_configuration(&self, _workspace_root: &Path, cx: &mut AppContext) -> Value {
|
||||||
|
let settings = ProjectSettings::get_global(cx)
|
||||||
|
.lsp
|
||||||
|
.get("dart")
|
||||||
|
.and_then(|s| s.settings.clone())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
serde_json::json!({
|
||||||
|
"dart": settings
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue