mirror of https://github.com/helix-editor/helix
Merge c88b9a6679
into 362e97e927
commit
80f7d8573a
|
@ -142,6 +142,7 @@ These are the available options for a language server.
|
||||||
| `config` | Language server initialization options |
|
| `config` | Language server initialization options |
|
||||||
| `timeout` | The maximum time a request to the language server may take, in seconds. Defaults to `20` |
|
| `timeout` | The maximum time a request to the language server may take, in seconds. Defaults to `20` |
|
||||||
| `environment` | Any environment variables that will be used when starting the language server `{ "KEY1" = "Value1", "KEY2" = "Value2" }` |
|
| `environment` | Any environment variables that will be used when starting the language server `{ "KEY1" = "Value1", "KEY2" = "Value2" }` |
|
||||||
|
| `roots` | A set of marker files to look for when trying to find the workspace root. These apply befory `language.roots` |
|
||||||
| `required-root-patterns` | A list of `glob` patterns to look for in the working directory. The language server is started if at least one of them is found. |
|
| `required-root-patterns` | A list of `glob` patterns to look for in the working directory. The language server is started if at least one of them is found. |
|
||||||
|
|
||||||
A `format` sub-table within `config` can be used to pass extra formatting options to
|
A `format` sub-table within `config` can be used to pass extra formatting options to
|
||||||
|
|
|
@ -394,8 +394,7 @@ where
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub struct LanguageServerConfiguration {
|
pub struct LanguageServerConfiguration {
|
||||||
pub command: String,
|
pub command: String,
|
||||||
#[serde(default)]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
||||||
pub environment: HashMap<String, String>,
|
pub environment: HashMap<String, String>,
|
||||||
|
@ -403,6 +402,8 @@ pub struct LanguageServerConfiguration {
|
||||||
pub config: Option<serde_json::Value>,
|
pub config: Option<serde_json::Value>,
|
||||||
#[serde(default = "default_timeout")]
|
#[serde(default = "default_timeout")]
|
||||||
pub timeout: u64,
|
pub timeout: u64,
|
||||||
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
|
pub roots: Vec<String>,
|
||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing,
|
skip_serializing,
|
||||||
|
|
|
@ -873,11 +873,17 @@ fn start_client(
|
||||||
) -> Result<NewClient, StartupError> {
|
) -> Result<NewClient, StartupError> {
|
||||||
let (workspace, workspace_is_cwd) = helix_loader::find_workspace();
|
let (workspace, workspace_is_cwd) = helix_loader::find_workspace();
|
||||||
let workspace = path::normalize(workspace);
|
let workspace = path::normalize(workspace);
|
||||||
|
let mut roots = config.roots.clone();
|
||||||
|
if !ls_config.roots.is_empty() {
|
||||||
|
let mut ls_roots = ls_config.roots.clone();
|
||||||
|
ls_roots.append(&mut roots);
|
||||||
|
roots = ls_roots;
|
||||||
|
};
|
||||||
let root = find_lsp_workspace(
|
let root = find_lsp_workspace(
|
||||||
doc_path
|
doc_path
|
||||||
.and_then(|x| x.parent().and_then(|x| x.to_str()))
|
.and_then(|x| x.parent().and_then(|x| x.to_str()))
|
||||||
.unwrap_or("."),
|
.unwrap_or("."),
|
||||||
&config.roots,
|
&roots,
|
||||||
config.workspace_lsp_roots.as_deref().unwrap_or(root_dirs),
|
config.workspace_lsp_roots.as_deref().unwrap_or(root_dirs),
|
||||||
&workspace,
|
&workspace,
|
||||||
workspace_is_cwd,
|
workspace_is_cwd,
|
||||||
|
|
|
@ -93,7 +93,7 @@ prisma-language-server = { command = "prisma-language-server", args = ["--stdio"
|
||||||
purescript-language-server = { command = "purescript-language-server", args = ["--stdio"] }
|
purescript-language-server = { command = "purescript-language-server", args = ["--stdio"] }
|
||||||
pylsp = { command = "pylsp" }
|
pylsp = { command = "pylsp" }
|
||||||
pyrefly = { command = "pyrefly", args = ["lsp"] }
|
pyrefly = { command = "pyrefly", args = ["lsp"] }
|
||||||
pyright = { command = "pyright-langserver", args = ["--stdio"], config = {} }
|
pyright = { command = "pyright-langserver", args = ["--stdio"], config = {}, roots = ["pyrightconfig.json"] }
|
||||||
protols = { command = "protols", args = [] }
|
protols = { command = "protols", args = [] }
|
||||||
basedpyright = { command = "basedpyright-langserver", args = ["--stdio"], config = {} }
|
basedpyright = { command = "basedpyright-langserver", args = ["--stdio"], config = {} }
|
||||||
pylyzer = { command = "pylyzer", args = ["--server"] }
|
pylyzer = { command = "pylyzer", args = ["--server"] }
|
||||||
|
@ -945,7 +945,7 @@ scope = "source.python"
|
||||||
injection-regex = "py(thon)?"
|
injection-regex = "py(thon)?"
|
||||||
file-types = ["py", "pyi", "py3", "pyw", "ptl", "rpy", "cpy", "ipy", "pyt", { glob = ".python_history" }, { glob = ".pythonstartup" }, { glob = ".pythonrc" }, { glob = "*SConstruct" }, { glob = "*SConscript" }, { glob = "*sconstruct" }]
|
file-types = ["py", "pyi", "py3", "pyw", "ptl", "rpy", "cpy", "ipy", "pyt", { glob = ".python_history" }, { glob = ".pythonstartup" }, { glob = ".pythonrc" }, { glob = "*SConstruct" }, { glob = "*SConscript" }, { glob = "*sconstruct" }]
|
||||||
shebangs = ["python", "uv"]
|
shebangs = ["python", "uv"]
|
||||||
roots = ["pyproject.toml", "setup.py", "poetry.lock", "pyrightconfig.json"]
|
roots = ["pyproject.toml", "setup.py", "poetry.lock"]
|
||||||
comment-token = "#"
|
comment-token = "#"
|
||||||
language-servers = ["ty", "ruff", "jedi", "pylsp"]
|
language-servers = ["ty", "ruff", "jedi", "pylsp"]
|
||||||
# TODO: pyls needs utf-8 offsets
|
# TODO: pyls needs utf-8 offsets
|
||||||
|
|
Loading…
Reference in New Issue