Fix eslint diagnostics by passing worktree root during workspace init
This commit is contained in:
parent
02174084ca
commit
f9cd45269a
9 changed files with 45 additions and 16 deletions
|
@ -105,6 +105,7 @@ impl LspAdapter for JsonLspAdapter {
|
|||
|
||||
fn workspace_configuration(
|
||||
&self,
|
||||
_workspace_root: &Path,
|
||||
cx: &mut AppContext,
|
||||
) -> BoxFuture<'static, serde_json::Value> {
|
||||
let action_names = cx.all_action_names().collect::<Vec<_>>();
|
||||
|
|
|
@ -29,7 +29,6 @@ pub struct IntelephenseLspAdapter {
|
|||
impl IntelephenseLspAdapter {
|
||||
const SERVER_PATH: &'static str = "node_modules/intelephense/lib/intelephense.js";
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn new(node: Arc<dyn NodeRuntime>) -> Self {
|
||||
Self { node }
|
||||
}
|
||||
|
|
|
@ -107,7 +107,11 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
}))
|
||||
}
|
||||
|
||||
fn workspace_configuration(&self, _: &mut AppContext) -> BoxFuture<'static, Value> {
|
||||
fn workspace_configuration(
|
||||
&self,
|
||||
_workspace_root: &Path,
|
||||
_: &mut AppContext,
|
||||
) -> BoxFuture<'static, Value> {
|
||||
future::ready(json!({
|
||||
"tailwindCSS": {
|
||||
"emmetCompletions": true,
|
||||
|
|
|
@ -205,7 +205,6 @@ pub struct EsLintLspAdapter {
|
|||
impl EsLintLspAdapter {
|
||||
const SERVER_PATH: &'static str = "vscode-eslint/server/out/eslintServer.js";
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn new(node: Arc<dyn NodeRuntime>) -> Self {
|
||||
EsLintLspAdapter { node }
|
||||
}
|
||||
|
@ -213,13 +212,23 @@ impl EsLintLspAdapter {
|
|||
|
||||
#[async_trait]
|
||||
impl LspAdapter for EsLintLspAdapter {
|
||||
fn workspace_configuration(&self, _: &mut AppContext) -> BoxFuture<'static, Value> {
|
||||
fn workspace_configuration(
|
||||
&self,
|
||||
workspace_root: &Path,
|
||||
_: &mut AppContext,
|
||||
) -> BoxFuture<'static, Value> {
|
||||
future::ready(json!({
|
||||
"": {
|
||||
"validate": "on",
|
||||
"rulesCustomizations": [],
|
||||
"run": "onType",
|
||||
"nodePath": null,
|
||||
"workingDirectory": {"mode": "auto"},
|
||||
"workspaceFolder": {
|
||||
"uri": workspace_root,
|
||||
"name": workspace_root.file_name()
|
||||
.unwrap_or_else(|| workspace_root.as_os_str()),
|
||||
},
|
||||
}
|
||||
}))
|
||||
.boxed()
|
||||
|
|
|
@ -93,7 +93,11 @@ impl LspAdapter for YamlLspAdapter {
|
|||
) -> Option<LanguageServerBinary> {
|
||||
get_cached_server_binary(container_dir, &*self.node).await
|
||||
}
|
||||
fn workspace_configuration(&self, cx: &mut AppContext) -> BoxFuture<'static, Value> {
|
||||
fn workspace_configuration(
|
||||
&self,
|
||||
_workspace_root: &Path,
|
||||
cx: &mut AppContext,
|
||||
) -> BoxFuture<'static, Value> {
|
||||
let tab_size = all_language_settings(None, cx)
|
||||
.language(Some("YAML"))
|
||||
.tab_size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue