Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T05:07:17.178Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

protobuf_language_server.rs

53 lines · 1.7 KB · rust
1use zed_extension_api::{self as zed, Result, settings::LspSettings};
2
3pub(crate) struct ProtobufLanguageServer {
4    cached_binary_path: Option<String>,
5}
6
7impl ProtobufLanguageServer {
8    pub(crate) const SERVER_NAME: &str = "protobuf-language-server";
9
10    pub(crate) fn new() -> Self {
11        ProtobufLanguageServer {
12            cached_binary_path: None,
13        }
14    }
15
16    pub(crate) fn language_server_binary(
17        &mut self,
18        worktree: &zed::Worktree,
19    ) -> Result<zed::Command> {
20        let binary_settings = LspSettings::for_worktree(Self::SERVER_NAME, worktree)
21            .ok()
22            .and_then(|lsp_settings| lsp_settings.binary);
23
24        let args = binary_settings
25            .as_ref()
26            .and_then(|binary_settings| binary_settings.arguments.clone())
27            .unwrap_or_else(|| vec!["-logs".into(), "".into()]);
28
29        if let Some(path) = binary_settings.and_then(|binary_settings| binary_settings.path) {
30            Ok(zed::Command {
31                command: path,
32                args,
33                env: Default::default(),
34            })
35        } else if let Some(path) = self.cached_binary_path.clone() {
36            Ok(zed::Command {
37                command: path,
38                args,
39                env: Default::default(),
40            })
41        } else if let Some(path) = worktree.which(Self::SERVER_NAME) {
42            self.cached_binary_path = Some(path.clone());
43            Ok(zed::Command {
44                command: path,
45                args,
46                env: Default::default(),
47            })
48        } else {
49            Err(format!("{} not found in PATH", Self::SERVER_NAME))
50        }
51    }
52}
53
Served at tenant.openagents/omega Member data and write actions are omitted.