first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ strum = { workspace = true }
strum_macros = { workspace = true }
galaxy_core = { workspace = true }
galaxy_util.workspace = true
galaxyui.workspace = true
galaxyui_core.workspace = true
instant.workspace = true
http_client = { workspace = true }
cfg-if.workspace = true
+1 -1
View File
@@ -6,4 +6,4 @@ This crate provides a stdio-only Language Server Protocol (LSP) client transport
- Communicates over stdio using JSON-RPC with proper Content-Length framing
See main.rs for an example implmentation
See `examples/rust-lsp/main.rs` for an example implementation.
+9 -11
View File
@@ -6,21 +6,19 @@
//! - Core LSP features: go-to-definition, hover, completion, symbols
//! - Proper shutdown and error handling
use std::{
env,
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};
use std::env;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::Duration;
use chrono::Utc;
use galaxyui::r#async::{executor::Background, Timer};
use log::LevelFilter;
use lsp::{
spawn_lsp_service, supported_servers::LSPServerType, LspServerConfig, LspService,
LspServiceInitializationResult,
};
use lsp::supported_servers::LSPServerType;
use lsp::{spawn_lsp_service, LspServerConfig, LspService, LspServiceInitializationResult};
use lsp_types::Position;
use galaxyui_core::r#async::executor::Background;
use galaxyui_core::r#async::Timer;
fn init_logging() {
let mut base_logger = env_logger::builder();
@@ -114,7 +112,7 @@ fn main() -> anyhow::Result<()> {
}
});
galaxyui::r#async::block_on(task)?;
galaxyui_core::r#async::block_on(task)?;
Ok(())
}
-1
View File
@@ -133,7 +133,6 @@ mod unix_tests {
// Windows-specific tests use Windows paths
#[cfg(windows)]
mod windows_tests {
use super::*;
#[test]
fn test_lsp_uri_to_path_basic() {
+1 -2
View File
@@ -1,8 +1,7 @@
use anyhow::{Context, Result};
use serde::Deserialize;
#[cfg(all(feature = "local_fs", unix))]
use async_fs::unix::PermissionsExt;
use serde::Deserialize;
cfg_if::cfg_if! {
if #[cfg(feature = "local_fs")] {
+2 -1
View File
@@ -1,8 +1,9 @@
use std::path::Path;
use crate::CommandBuilder;
use async_trait::async_trait;
use crate::CommandBuilder;
/// Defines the detection and installation for a specific Language Server.
///
/// This trait allows us to decouple the specific logic for each server (installation,
+6 -5
View File
@@ -21,10 +21,8 @@ pub mod types;
pub use config::{default_init_params, LanguageId, LspServerConfig};
pub use jsonrpc::{JsonRpcService, ServerNotificationEvent, Transport};
pub use lsp_types::{
notification::{self},
CompletionItem, Position, Range,
};
pub use lsp_types::notification::{self};
pub use lsp_types::{Position, Range};
pub use manager::{LspManagerModel, LspManagerModelEvent};
pub use model::{
BackgroundTaskInfo, DocumentDiagnostics, LanguageServerId, LspEvent, LspServerModel, LspState,
@@ -56,12 +54,15 @@ impl std::fmt::Display for LspServerLogLevel {
}
}
use std::sync::Arc;
use anyhow::Result;
use galaxyui::r#async::executor::Background;
use galaxyui::AppContext;
#[cfg(not(target_arch = "wasm32"))]
use simple_logger::SimpleLogger;
use std::sync::Arc;
use galaxyui_core::r#async::executor::Background;
use galaxyui_core::AppContext;
pub struct LspServiceInitializationResult {
pub service: LspService,
+10 -11
View File
@@ -1,13 +1,12 @@
use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use crate::{
config::LanguageId, model::LanguageServerId, supported_servers::LSPServerType, LspEvent,
LspServerConfig, LspServerModel,
};
use galaxyui::{AppContext, Entity, ModelContext, ModelHandle, SingletonEntity};
use galaxyui_core::{AppContext, Entity, ModelContext, ModelHandle, SingletonEntity};
use crate::config::LanguageId;
use crate::model::LanguageServerId;
use crate::supported_servers::LSPServerType;
use crate::{LspEvent, LspServerConfig, LspServerModel};
#[derive(Debug)]
pub enum LspManagerModelEvent {
@@ -188,7 +187,7 @@ impl LspManagerModel {
let lsp = ctx.add_model(|_| LspServerModel::new(config));
let path_clone = path.clone();
ctx.subscribe_to_model(&lsp, move |_, event, ctx| match event {
ctx.subscribe_to_model(&lsp, move |_, _, event, ctx| match event {
LspEvent::Started => {
ctx.emit(LspManagerModelEvent::ServerStarted(path_clone.clone()));
}
@@ -234,7 +233,7 @@ impl LspManagerModel {
pub fn stop_all(&mut self, path: PathBuf, ctx: &mut ModelContext<Self>) {
let Some(servers) = self.servers.get(&path) else {
log::warn!("No server resgistered to stop at path: {}", path.display());
log::warn!("No server registered to stop at path: {}", path.display());
return;
};
+28 -33
View File
@@ -1,41 +1,36 @@
use crate::{
config::{lsp_uri_to_path, LanguageId},
server_repo_watcher::LspRepoWatcher,
supported_servers::LSPServerType,
types::{
CodeActionData, CompletionResult, CompletionTrigger, DefinitionLocation, DocumentVersion,
HoverResult, Location, PrepareRenameResult, ReferenceLocation, RenameResult,
SignatureHelpResult, TextDocumentContentChangeEvent, TextEdit, WatchedFileChangeEvent,
},
LspServerConfig, LspServerLogLevel, LspService,
};
use instant::Instant;
use lsp_types::{
notification::{self, Notification},
CompletionItem, CompletionTriggerKind, FormattingOptions, NumberOrString, ProgressParams,
ProgressParamsValue, PublishDiagnosticsParams, Range as LspRange, WorkDoneProgress,
};
use std::{
collections::HashMap,
future::Future,
path::{Path, PathBuf},
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
};
use std::collections::HashMap;
use std::future::Future;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
#[cfg(not(target_arch = "wasm32"))]
use crate::{spawn_lsp_service, LspServiceInitializationResult};
use anyhow::{Error, Result};
#[cfg(not(target_arch = "wasm32"))]
use galaxy_core::features::FeatureFlag;
#[cfg(not(target_arch = "wasm32"))]
use galaxyui::SingletonEntity;
use galaxyui::{r#async::executor::Background, Entity, ModelContext};
use instant::Instant;
use jsonrpc::ServerNotificationEvent;
use lsp_types::notification::{self, Notification};
use lsp_types::{
FormattingOptions, NumberOrString, ProgressParams, ProgressParamsValue,
PublishDiagnosticsParams, WorkDoneProgress,
};
#[cfg(not(target_arch = "wasm32"))]
use simple_logger::manager::LogManager;
#[cfg(not(target_arch = "wasm32"))]
use galaxy_core::features::FeatureFlag;
use galaxyui_core::r#async::executor::Background;
#[cfg(not(target_arch = "wasm32"))]
use galaxyui_core::SingletonEntity;
use galaxyui_core::{Entity, ModelContext};
use crate::config::{lsp_uri_to_path, LanguageId};
use crate::server_repo_watcher::LspRepoWatcher;
use crate::supported_servers::LSPServerType;
use crate::types::{
DefinitionLocation, DocumentVersion, HoverResult, Location, ReferenceLocation,
TextDocumentContentChangeEvent, TextEdit, WatchedFileChangeEvent,
};
#[cfg(not(target_arch = "wasm32"))]
use crate::{spawn_lsp_service, LspServiceInitializationResult};
use crate::{LspServerConfig, LspServerLogLevel, LspService};
static NEXT_LANGUAGE_SERVER_ID: AtomicUsize = AtomicUsize::new(0);
+9 -6
View File
@@ -1,15 +1,18 @@
use std::{future::Future, path::PathBuf, pin::Pin};
use std::future::Future;
use std::path::PathBuf;
use std::pin::Pin;
use async_channel::Sender;
use galaxy_util::standardized_path::StandardizedPath;
use galaxyui::{ModelContext, SingletonEntity, WeakModelHandle};
use lsp_types::FileChangeType;
use repo_metadata::{
repository::{RepositorySubscriber, SubscriberId},
DirectoryWatcher, Repository, RepositoryUpdate,
};
use repo_metadata::repository::{RepositorySubscriber, SubscriberId};
use repo_metadata::{DirectoryWatcher, Repository, RepositoryUpdate};
use galaxyui_core::{ModelContext, SingletonEntity, WeakModelHandle};
use crate::{model::LspServerModel, types::WatchedFileChangeEvent, LspServerConfig};
use crate::model::LspServerModel;
use crate::types::WatchedFileChangeEvent;
use crate::LspServerConfig;
enum RepoWatchState {
NotWatching,
+1 -1
View File
@@ -3,6 +3,7 @@ use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
use command::r#async::Command;
@@ -12,7 +13,6 @@ use crate::install::{
};
use crate::language_server_candidate::{LanguageServerCandidate, LanguageServerMetadata};
use crate::CommandBuilder;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
const SERVER_NAME: &str = "clangd";
+2 -2
View File
@@ -1,12 +1,12 @@
use std::path::Path;
use std::sync::Arc;
use crate::language_server_candidate::{LanguageServerCandidate, LanguageServerMetadata};
use crate::CommandBuilder;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
use crate::install::fetch_latest_metadata_from_github;
use crate::language_server_candidate::{LanguageServerCandidate, LanguageServerMetadata};
use crate::CommandBuilder;
#[cfg_attr(not(feature = "local_fs"), allow(dead_code))]
pub struct GoPlsCandidate {
+6 -6
View File
@@ -1,16 +1,16 @@
use std::path::Path;
use std::sync::Arc;
#[cfg(feature = "local_fs")]
use anyhow::Context;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
use command::r#async::Command;
use crate::language_server_candidate::{LanguageServerCandidate, LanguageServerMetadata};
#[cfg(feature = "local_fs")]
use crate::supported_servers::CustomBinaryConfig;
use crate::CommandBuilder;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
use anyhow::Context;
#[cfg(feature = "local_fs")]
use command::r#async::Command;
#[cfg_attr(not(feature = "local_fs"), allow(dead_code))]
pub struct PyrightCandidate {
+14 -1
View File
@@ -1,11 +1,12 @@
use std::path::Path;
use std::sync::Arc;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
use crate::install::{fetch_latest_metadata_from_github, install_from_github, AssetKind};
use crate::language_server_candidate::{LanguageServerCandidate, LanguageServerMetadata};
use crate::CommandBuilder;
use async_trait::async_trait;
#[cfg_attr(not(feature = "local_fs"), allow(dead_code))]
pub struct RustAnalyzerCandidate {
@@ -136,6 +137,13 @@ impl LanguageServerCandidate for RustAnalyzerCandidate {
metadata: LanguageServerMetadata,
_executor: &CommandBuilder,
) -> anyhow::Result<()> {
anyhow::ensure!(
!cfg!(target_os = "freebsd"),
"rust-analyzer is not auto-installable on FreeBSD: upstream \
GitHub releases publish no FreeBSD asset. Install it via \
`rustup component add rust-analyzer` or `pkg install \
rust-analyzer` and warp will pick it up off PATH."
);
let asset_kind = AssetKind::from_filename(asset_name()).ok_or_else(|| {
anyhow::anyhow!("Unsupported archive format for asset: {}", asset_name())
})?;
@@ -144,6 +152,11 @@ impl LanguageServerCandidate for RustAnalyzerCandidate {
}
async fn fetch_latest_server_metadata(&self) -> anyhow::Result<LanguageServerMetadata> {
anyhow::ensure!(
!cfg!(target_os = "freebsd"),
"rust-analyzer release metadata is unavailable on FreeBSD: \
upstream GitHub releases publish no FreeBSD asset."
);
fetch_latest_metadata_from_github(
&self.client,
"rust-lang",
@@ -1,14 +1,16 @@
use std::path::Path;
use std::sync::Arc;
#[cfg(feature = "local_fs")]
use anyhow::Context;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
use command::r#async::Command;
use crate::language_server_candidate::{LanguageServerCandidate, LanguageServerMetadata};
#[cfg(feature = "local_fs")]
use crate::supported_servers::CustomBinaryConfig;
use crate::CommandBuilder;
use async_trait::async_trait;
#[cfg(feature = "local_fs")]
use anyhow::Context;
#[cfg_attr(not(feature = "local_fs"), allow(dead_code))]
pub struct TypeScriptLanguageServerCandidate {
+18 -24
View File
@@ -1,39 +1,33 @@
use std::{
collections::HashMap,
path::{Path, PathBuf},
sync::{Arc, Mutex},
};
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use crate::{
config::{lsp_uri_to_path, path_to_lsp_uri, LanguageId},
types::{
CodeActionData, CompletionResult, FileEdits, HoverResult, Location, LspDefinitionLocation,
PrepareRenameResult, Range, ReferenceLocation, RenameResult, SignatureHelpResult,
TextDocumentContentChangeEvent, TextEdit, WatchedFileChangeEvent,
},
LspServerLogLevel,
};
use anyhow::Result;
use galaxy_util::on_cancel::OnCancelFutureExt;
use globset::{Glob, GlobMatcher};
use jsonrpc::{JsonRpcService, RequestId, ServerNotificationEvent};
use lsp_types::notification::{self, Notification};
use lsp_types::request::{self, Request};
use lsp_types::{
notification::{self, Notification},
request::{self, Request},
CancelParams, CodeActionContext, CodeActionParams, CompletionContext, CompletionItem,
CompletionParams, CompletionTriggerKind, DidChangeTextDocumentParams,
DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions,
DidCloseTextDocumentParams, DidOpenTextDocumentParams, DocumentFormattingParams,
FileChangeType, FileSystemWatcher, FormattingOptions, GlobPattern, GotoDefinitionParams,
GotoDefinitionResponse, HoverParams, InitializeParams, InitializedParams, NumberOrString,
OneOf, Position, Range as LspRange, ReferenceParams, RegistrationParams, RelativePattern,
RenameParams, SignatureHelpParams, TextDocumentIdentifier, TextDocumentItem,
CancelParams, DidChangeTextDocumentParams, DidChangeWatchedFilesParams,
DidChangeWatchedFilesRegistrationOptions, DidCloseTextDocumentParams,
DidOpenTextDocumentParams, DocumentFormattingParams, FileChangeType, FileSystemWatcher,
FormattingOptions, GlobPattern, GotoDefinitionParams, GotoDefinitionResponse, HoverParams,
InitializeParams, InitializedParams, NumberOrString, OneOf, Position, ReferenceParams,
RegistrationParams, RelativePattern, TextDocumentIdentifier, TextDocumentItem,
TextDocumentPositionParams, UnregistrationParams, VersionedTextDocumentIdentifier, WatchKind,
};
use serde_json::Value;
#[cfg(not(target_arch = "wasm32"))]
use simple_logger::SimpleLogger;
use crate::config::{lsp_uri_to_path, path_to_lsp_uri, LanguageId};
use crate::types::{
HoverResult, LspDefinitionLocation, ReferenceLocation, TextDocumentContentChangeEvent,
TextEdit, WatchedFileChangeEvent,
};
use crate::LspServerLogLevel;
/// Tracks the sync state for an open document.
#[derive(Debug, Clone)]
pub struct DocumentSyncState {
+9 -8
View File
@@ -1,5 +1,14 @@
#[cfg(not(target_arch = "wasm32"))]
use std::path::PathBuf;
use std::sync::Arc;
#[cfg(not(target_arch = "wasm32"))]
use command::r#async::Command;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
use crate::servers::clangd::ClangdCandidate;
use crate::servers::go::GoPlsCandidate;
use crate::servers::pyright::PyrightCandidate;
@@ -8,14 +17,6 @@ use crate::servers::typescript_language_server::TypeScriptLanguageServerCandidat
#[cfg(not(target_arch = "wasm32"))]
use crate::CommandBuilder;
use crate::{LanguageId, LanguageServerCandidate};
#[cfg(not(target_arch = "wasm32"))]
use command::r#async::Command;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
#[cfg(not(target_arch = "wasm32"))]
use std::path::PathBuf;
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
/// Configuration for a custom LSP binary installation.
///
+4 -8
View File
@@ -3,17 +3,13 @@ use std::sync::Arc;
use async_process::{Child, ChildStdin, ChildStdout, Stdio};
use async_trait::async_trait;
use command::r#async::Command;
use futures::future::FutureExt;
use futures::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, BufWriter};
use futures::lock::Mutex;
use futures::{
future::FutureExt,
io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, BufWriter},
};
use galaxyui::r#async::{
executor::{Background, BackgroundTask},
Timer,
};
use jsonrpc::Transport;
use simple_logger::SimpleLogger;
use galaxyui_core::r#async::executor::{Background, BackgroundTask};
use galaxyui_core::r#async::Timer;
/// Transport implementation for LSP communication over process stdin/stdout.
/// Also manages the LSP server process lifecycle with graceful shutdown capabilities.