Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/editor.rs')
| -rw-r--r-- | helix-view/src/editor.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index e5ae45c5..2146bc87 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -15,6 +15,7 @@ use crate::{ Document, DocumentId, View, ViewId, }; use helix_event::dispatch; +use helix_loader::workspace_trust::TrustStatus; use helix_vcs::DiffProviderRegistry; use futures_util::stream::select_all::SelectAll; @@ -431,6 +432,8 @@ pub struct Config { /// Whether to enable Kitty Keyboard Protocol pub kitty_keyboard_protocol: KittyKeyboardProtocolConfig, pub buffer_picker: BufferPickerConfig, + /// Whether to implicitly trust every workspace or not + pub insecure: bool, } #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, Clone, Copy)] @@ -1153,6 +1156,7 @@ impl Default for Config { rainbow_brackets: false, kitty_keyboard_protocol: Default::default(), buffer_picker: BufferPickerConfig::default(), + insecure: false, } } } @@ -1633,7 +1637,7 @@ impl Editor { } /// Launch a language server for a given document - fn launch_language_servers(&mut self, doc_id: DocumentId) { + pub fn launch_language_servers(&mut self, doc_id: DocumentId) { if !self.config().lsp.enable { return; } @@ -1648,6 +1652,15 @@ impl Editor { let config = doc.config.load(); let root_dirs = &config.workspace_lsp_roots; + if let TrustStatus::Untrusted = + helix_loader::workspace_trust::quick_query_workspace(self.config.load().insecure) + { + self.set_status( + "Current workspace is not trusted. Run `:workspace-trust` to enable all features.", + ); + return; + }; + // store only successfully started language servers let language_servers = lang.as_ref().map_or_else(HashMap::default, |language| { self.language_servers |