mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-24 18:36:18 +04:00
Merge 2fb78aa1da
into b8313da5a8
This commit is contained in:
commit
847f2fc24b
@ -141,6 +141,7 @@ ### `[editor.lsp]` Section
|
|||||||
| Key | Description | Default |
|
| Key | Description | Default |
|
||||||
| --- | ----------- | ------- |
|
| --- | ----------- | ------- |
|
||||||
| `enable` | Enables LSP integration. Setting to false will completely disable language servers regardless of language settings.| `true` |
|
| `enable` | Enables LSP integration. Setting to false will completely disable language servers regardless of language settings.| `true` |
|
||||||
|
| `autostart` | Enables LSP autostart on file opening. Setting to false will require running the `:lsp-restart` command to manually start the language server.| `true` |
|
||||||
| `display-messages` | Display LSP progress messages below statusline[^1] | `false` |
|
| `display-messages` | Display LSP progress messages below statusline[^1] | `false` |
|
||||||
| `auto-signature-help` | Enable automatic popup of signature help (parameter hints) | `true` |
|
| `auto-signature-help` | Enable automatic popup of signature help (parameter hints) | `true` |
|
||||||
| `display-inlay-hints` | Display inlay hints[^2] | `false` |
|
| `display-inlay-hints` | Display inlay hints[^2] | `false` |
|
||||||
|
@ -790,6 +790,7 @@ pub fn get<'a>(
|
|||||||
doc_path: Option<&'a std::path::PathBuf>,
|
doc_path: Option<&'a std::path::PathBuf>,
|
||||||
root_dirs: &'a [PathBuf],
|
root_dirs: &'a [PathBuf],
|
||||||
enable_snippets: bool,
|
enable_snippets: bool,
|
||||||
|
autostart: bool,
|
||||||
) -> impl Iterator<Item = (LanguageServerName, Result<Arc<Client>>)> + 'a {
|
) -> impl Iterator<Item = (LanguageServerName, Result<Arc<Client>>)> + 'a {
|
||||||
language_config.language_servers.iter().filter_map(
|
language_config.language_servers.iter().filter_map(
|
||||||
move |LanguageServerFeatures { name, .. }| {
|
move |LanguageServerFeatures { name, .. }| {
|
||||||
@ -807,6 +808,12 @@ pub fn get<'a>(
|
|||||||
}) {
|
}) {
|
||||||
return Some((name.to_owned(), Ok(client.clone())));
|
return Some((name.to_owned(), Ok(client.clone())));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// If autostart LSP turned off, do not automatically start a client for server
|
||||||
|
// Try emulate the empty clients list behavior for disable LSP
|
||||||
|
if !autostart {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
match self.start_client(
|
match self.start_client(
|
||||||
name.clone(),
|
name.clone(),
|
||||||
|
@ -426,6 +426,8 @@ pub fn get_terminal_provider() -> Option<TerminalConfig> {
|
|||||||
pub struct LspConfig {
|
pub struct LspConfig {
|
||||||
/// Enables LSP
|
/// Enables LSP
|
||||||
pub enable: bool,
|
pub enable: bool,
|
||||||
|
/// Autostart LSP on open file
|
||||||
|
pub autostart: bool,
|
||||||
/// Display LSP messagess from $/progress below statusline
|
/// Display LSP messagess from $/progress below statusline
|
||||||
pub display_progress_messages: bool,
|
pub display_progress_messages: bool,
|
||||||
/// Display LSP messages from window/showMessage below statusline
|
/// Display LSP messages from window/showMessage below statusline
|
||||||
@ -446,6 +448,7 @@ impl Default for LspConfig {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
enable: true,
|
enable: true,
|
||||||
|
autostart: true,
|
||||||
display_progress_messages: false,
|
display_progress_messages: false,
|
||||||
display_messages: true,
|
display_messages: true,
|
||||||
auto_signature_help: true,
|
auto_signature_help: true,
|
||||||
@ -1469,7 +1472,7 @@ fn launch_language_servers(&mut self, doc_id: DocumentId) {
|
|||||||
// store only successfully started language servers
|
// store only successfully started language servers
|
||||||
let language_servers = lang.as_ref().map_or_else(HashMap::default, |language| {
|
let language_servers = lang.as_ref().map_or_else(HashMap::default, |language| {
|
||||||
self.language_servers
|
self.language_servers
|
||||||
.get(language, path.as_ref(), root_dirs, config.lsp.snippets)
|
.get(language, path.as_ref(), root_dirs, config.lsp.snippets, config.lsp.autostart)
|
||||||
.filter_map(|(lang, client)| match client {
|
.filter_map(|(lang, client)| match client {
|
||||||
Ok(client) => Some((lang, client)),
|
Ok(client) => Some((lang, client)),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user