#![deny(missing_docs)]
#![cfg_attr(
all(not(target_arch = "wasm32"), not(feature = "runtime-tokio")),
allow(dead_code)
)]
#[cfg(all(target_arch = "wasm32", not(feature = "wasm")))]
compile_error!(
"the wasm32 target requires the `wasm` feature; \
build with `--no-default-features --features worker-channel`, \
or `--no-default-features --features wasm` plus your transports"
);
#[cfg(all(feature = "worker-channel", not(target_arch = "wasm32")))]
compile_error!("the `worker-channel` feature requires the wasm32 target");
#[cfg(all(target_arch = "wasm32", feature = "tcp"))]
compile_error!("the `tcp` feature is not supported on the wasm32 target");
#[cfg(all(target_arch = "wasm32", feature = "websocket"))]
compile_error!("the `websocket` feature is not supported on the wasm32 target");
#[cfg(all(target_arch = "wasm32", feature = "testing"))]
compile_error!("the `testing` feature requires a native target");
mod builder;
mod capability;
mod client;
#[cfg(any(feature = "runtime-tokio", target_arch = "wasm32"))]
mod client_endpoint;
#[cfg(any(feature = "runtime-tokio", target_arch = "wasm32"))]
mod client_progress;
mod codec;
mod context;
mod documents;
#[cfg(any(feature = "runtime-tokio", target_arch = "wasm32"))]
mod engine;
mod error;
mod failure;
pub mod features;
mod file_provider;
#[cfg(all(feature = "fuzzing", not(target_arch = "wasm32")))]
#[doc(hidden)]
pub mod fuzzing;
mod progress;
#[cfg(feature = "proposed")]
pub mod proposed;
mod raw;
mod resource_policy;
mod runtime;
mod service;
#[cfg(any(feature = "runtime-tokio", target_arch = "wasm32"))]
mod session;
mod sync;
mod telemetry;
#[cfg(all(feature = "testing", not(target_arch = "wasm32")))]
pub mod testing;
mod transport;
mod uri_key;
mod workspace;
#[cfg(all(test, not(target_arch = "wasm32")))]
mod test_util;
pub mod types {
pub use gen_lsp_types::*;
pub use gen_lsp_types::{
ApplyWorkspaceEditResult as ApplyWorkspaceEditResponse,
CodeActionResponse as CodeActionOrCommand, Contents as HoverContents,
DefinitionParams as GotoDefinitionParams, DefinitionResponse as GotoDefinitionResponse,
DiagnosticProvider as DiagnosticServerCapabilities,
DocumentColorOptions as ColorProviderOptions,
DocumentDiagnosticReport as DocumentDiagnosticReportResult, Label as InlayHintLabel,
PrepareRenameResult as PrepareRenameResponse, ReferenceOptions as ReferencesOptions,
Save as TextDocumentSyncSaveOptions, SemanticTokenModifiers as SemanticTokenModifier,
SemanticTokenTypes as SemanticTokenType, SemanticTokens as SemanticTokensRangeResult,
SemanticTokens as SemanticTokensResult,
SemanticTokensDeltaResponse as SemanticTokensFullDeltaResult,
TextDocumentSync as TextDocumentSyncCapability, Tooltip as InlayHintTooltip,
WorkspaceDiagnosticReport as WorkspaceDiagnosticReportResult,
WorkspaceOptions as WorkspaceServerCapabilities,
};
pub mod request {
use serde::Serialize;
use serde::de::DeserializeOwned;
pub trait Request {
type Params: DeserializeOwned + Serialize + Send + Sync + 'static;
type Result: DeserializeOwned + Serialize + Send + Sync + 'static;
const METHOD: &'static str;
}
impl<T: gen_lsp_types::Request> Request for T {
type Params = T::Params;
type Result = T::Result;
const METHOD: &'static str = T::METHOD.as_str();
}
pub use gen_lsp_types::{
ApplyWorkspaceEditRequest as ApplyWorkspaceEdit,
CallHierarchyIncomingCallsRequest as CallHierarchyIncomingCalls,
CallHierarchyOutgoingCallsRequest as CallHierarchyOutgoingCalls,
CallHierarchyPrepareRequest as CallHierarchyPrepare, CodeActionRequest,
CodeActionResolveRequest, CodeLensRefreshRequest as CodeLensRefresh, CodeLensRequest,
CodeLensResolveRequest as CodeLensResolve, ColorPresentationRequest,
CompletionRequest as Completion, CompletionResolveRequest as ResolveCompletionItem,
ConfigurationRequest as WorkspaceConfiguration,
DeclarationParams as GotoDeclarationParams, DeclarationRequest as GotoDeclaration,
DeclarationResponse as GotoDeclarationResponse, DefinitionRequest as GotoDefinition,
DiagnosticRefreshRequest as WorkspaceDiagnosticRefresh,
DocumentColorRequest as DocumentColor, DocumentDiagnosticRequest,
DocumentFormattingRequest as Formatting, DocumentHighlightRequest, DocumentLinkRequest,
DocumentLinkResolveRequest as DocumentLinkResolve,
DocumentOnTypeFormattingRequest as OnTypeFormatting,
DocumentRangeFormattingRequest as RangeFormatting, DocumentSymbolRequest,
ExecuteCommandRequest as ExecuteCommand, FoldingRangeRefreshRequest,
FoldingRangeRequest, HoverRequest, ImplementationParams as GotoImplementationParams,
ImplementationRequest as GotoImplementation,
ImplementationResponse as GotoImplementationResponse, InlayHintRefreshRequest,
InlayHintRequest, InlayHintResolveRequest, InlineValueRefreshRequest,
InlineValueRequest, LinkedEditingRangeRequest as LinkedEditingRange, MonikerRequest,
PrepareRenameRequest, ReferencesRequest as References,
RegistrationRequest as RegisterCapability, RenameRequest as Rename,
SelectionRangeRequest, SemanticTokensDeltaRequest as SemanticTokensFullDeltaRequest,
SemanticTokensRangeRequest, SemanticTokensRefreshRequest as SemanticTokensRefresh,
SemanticTokensRequest as SemanticTokensFullRequest,
ShowDocumentRequest as ShowDocument, ShowMessageRequest, ShutdownRequest as Shutdown,
SignatureHelpRequest, TextDocumentContentRefreshRequest,
TypeDefinitionParams as GotoTypeDefinitionParams,
TypeDefinitionRequest as GotoTypeDefinition,
TypeDefinitionResponse as GotoTypeDefinitionResponse,
TypeHierarchyPrepareRequest as TypeHierarchyPrepare,
TypeHierarchySubtypesRequest as TypeHierarchySubtypes,
TypeHierarchySupertypesRequest as TypeHierarchySupertypes,
UnregistrationRequest as UnregisterCapability,
WillCreateFilesRequest as WillCreateFiles, WillDeleteFilesRequest as WillDeleteFiles,
WillRenameFilesRequest as WillRenameFiles,
WillSaveTextDocumentWaitUntilRequest as WillSaveWaitUntil,
WorkDoneProgressCreateRequest as WorkDoneProgressCreate, WorkspaceDiagnosticRequest,
WorkspaceFoldersRequest, WorkspaceSymbolRequest,
WorkspaceSymbolResolveRequest as WorkspaceSymbolResolve,
};
}
pub mod notification {
use serde::Serialize;
use serde::de::DeserializeOwned;
pub trait Notification {
type Params: DeserializeOwned + Serialize + Send + Sync + 'static;
const METHOD: &'static str;
}
impl<T: gen_lsp_types::Notification> Notification for T {
type Params = T::Params;
const METHOD: &'static str = T::METHOD.as_str();
}
pub use gen_lsp_types::{
CancelNotification as Cancel,
DidChangeConfigurationNotification as DidChangeConfiguration,
DidChangeTextDocumentNotification as DidChangeTextDocument,
DidChangeWatchedFilesNotification as DidChangeWatchedFiles,
DidChangeWorkspaceFoldersNotification as DidChangeWorkspaceFolders,
DidCloseTextDocumentNotification as DidCloseTextDocument,
DidCreateFilesNotification as DidCreateFiles,
DidDeleteFilesNotification as DidDeleteFiles,
DidOpenTextDocumentNotification as DidOpenTextDocument,
DidRenameFilesNotification as DidRenameFiles,
DidSaveTextDocumentNotification as DidSaveTextDocument, ExitNotification as Exit,
InitializedNotification as Initialized, LogMessageNotification as LogMessage,
LogTraceNotification as LogTrace, ProgressNotification as Progress,
PublishDiagnosticsNotification as PublishDiagnostics, SetTraceNotification as SetTrace,
ShowMessageNotification as ShowMessage, TelemetryEventNotification as TelemetryEvent,
WillSaveTextDocumentNotification as WillSaveTextDocument,
WorkDoneProgressCancelNotification as WorkDoneProgressCancel,
};
}
}
#[cfg(doctest)]
mod markdown {
#[doc = include_str!("../../../README.md")]
pub struct Readme;
#[doc = include_str!("../../../docs/guides/features-and-workspace.md")]
pub struct FeaturesAndWorkspaceGuide;
#[doc = include_str!("../../../docs/guides/outgoing-client.md")]
pub struct OutgoingClientGuide;
#[doc = include_str!("../../../docs/guides/client-adoption.md")]
pub struct ClientAdoptionGuide;
#[doc = include_str!("../../../docs/guides/transports.md")]
pub struct TransportsGuide;
#[doc = include_str!("../../../docs/guides/testing.md")]
pub struct TestingGuide;
}
#[doc(hidden)]
pub use builder::SharedHandler;
pub use builder::{InitializeRegistrar, Server, ServerBuilder};
pub use client::{ClientHandle, TelemetryEventParams};
#[cfg(any(feature = "runtime-tokio", target_arch = "wasm32"))]
pub use client_endpoint::{Client, ClientBuilder, ClientConnection, ClientContext, ServerHandle};
pub use context::ServerContext;
pub use documents::{Document, DocumentsView, PositionEncoding};
#[cfg(any(feature = "runtime-tokio", target_arch = "wasm32"))]
pub use engine::Outcome;
pub use error::{BuildError, ClientError, Error, LspError, ProgressError, Result};
pub use failure::{
ConnectionDirection, ConnectionFailure, ConnectionFailureCategory, ConnectionFailureContext,
ConnectionRequestId,
};
pub use features::{FeatureSpec, NotificationFeatureSpec};
#[cfg(target_arch = "wasm32")]
pub use file_provider::EmptyFileProvider;
pub use file_provider::{FileProvider, MemoryFileProvider};
#[cfg(all(not(target_arch = "wasm32"), feature = "runtime-tokio"))]
pub use file_provider::{OsFileProvider, OsFileProviderBuilder};
pub use progress::{ProgressHandle, ProgressOptions};
pub use raw::{JsonRpcError, RawMessage, RequestId};
pub use resource_policy::{ResourcePolicy, ResourcePolicyField};
#[doc(hidden)]
pub use runtime::{TaskFuture, TaskSend};
pub use service::{CallKind, IncomingCall, Layer, Next, ServiceFuture, ServiceResult};
#[cfg(all(feature = "stdio", not(target_arch = "wasm32")))]
pub use transport::{
ChildConnection, ChildError, ChildOutput, StdioBuilder, StdioReader, StdioTransport,
StdioWriter, stdio,
};
#[cfg(all(feature = "tcp", not(target_arch = "wasm32")))]
pub use transport::{TcpBuilder, TcpReader, TcpTransport, TcpWriter, tcp};
pub use transport::{Transport, TransportError, TransportReader, TransportWriter};
#[cfg(all(feature = "websocket", not(target_arch = "wasm32")))]
pub use transport::{
WebSocketBuilder, WebSocketReader, WebSocketTransport, WebSocketWriter, websocket,
};
#[cfg(all(feature = "worker-channel", target_arch = "wasm32"))]
pub use transport::{
WorkerChannelBuilder, WorkerChannelReader, WorkerChannelTransport, WorkerChannelWriter,
worker_channel,
};
pub use workspace::{Workspace, WorkspaceError};
pub use tokio_util::sync::CancellationToken;
pub const DEFAULT_CONCURRENCY_LIMIT: usize = 64;