pub struct LspProcessClient { /* private fields */ }Expand description
Client for communicating with an LSP server process.
Manages the lifecycle of the server process and handles all communication.
Implements LspClient so it can be plugged directly into a CodeEditor.
§Examples
use std::sync::mpsc;
use iced_code_editor::{LspProcessClient, LspEvent};
let (tx, rx) = mpsc::channel::<LspEvent>();
let client = LspProcessClient::new_with_server(
"file:///home/user/project",
tx,
"lua-language-server",
);Implementations§
Source§impl LspProcessClient
impl LspProcessClient
Sourcepub fn new_with_server(
root_uri: &str,
events: Sender<LspEvent>,
server_key: &str,
) -> Result<Self, String>
pub fn new_with_server( root_uri: &str, events: Sender<LspEvent>, server_key: &str, ) -> Result<Self, String>
Creates a new LSP client connected to the specified server.
§Arguments
root_uri— the root URI of the workspace (e.g."file:///home/user/project")events— channel to sendLspEvents back to the applicationserver_key— key identifying the LSP server (e.g."lua-language-server")
§Errors
Returns an error string when the server key is not recognised, when the server binary cannot be found, or when the process cannot be spawned.
§Examples
use std::sync::mpsc;
use iced_code_editor::{LspProcessClient, LspEvent};
let (tx, _rx) = mpsc::channel::<LspEvent>();
let client = LspProcessClient::new_with_server(
"file:///tmp/project",
tx,
"lua-language-server",
);
assert!(client.is_ok());Trait Implementations§
Source§impl Drop for LspProcessClient
Sends shutdown/exit notifications and kills the process on drop.
impl Drop for LspProcessClient
Sends shutdown/exit notifications and kills the process on drop.
Source§impl LspClient for LspProcessClient
impl LspClient for LspProcessClient
Source§fn did_open(&mut self, document: &LspDocument, text: &str)
fn did_open(&mut self, document: &LspDocument, text: &str)
Notifies the client that a document was opened.
Source§fn did_change(&mut self, document: &LspDocument, changes: &[LspTextChange])
fn did_change(&mut self, document: &LspDocument, changes: &[LspTextChange])
Notifies the client that the document changed.
Source§fn did_save(&mut self, document: &LspDocument, text: &str)
fn did_save(&mut self, document: &LspDocument, text: &str)
Notifies the client that the document was saved.
Source§fn did_close(&mut self, document: &LspDocument)
fn did_close(&mut self, document: &LspDocument)
Notifies the client that the document was closed.
Source§fn request_hover(&mut self, document: &LspDocument, position: LspPosition)
fn request_hover(&mut self, document: &LspDocument, position: LspPosition)
Requests hover information at the given position.
Source§fn request_completion(&mut self, document: &LspDocument, position: LspPosition)
fn request_completion(&mut self, document: &LspDocument, position: LspPosition)
Requests completion items at the given position.
Source§fn request_definition(&mut self, document: &LspDocument, position: LspPosition)
fn request_definition(&mut self, document: &LspDocument, position: LspPosition)
Requests the definition location(s) for the symbol at the given position. Read more
Auto Trait Implementations§
impl !Freeze for LspProcessClient
impl !RefUnwindSafe for LspProcessClient
impl Send for LspProcessClient
impl Sync for LspProcessClient
impl Unpin for LspProcessClient
impl UnsafeUnpin for LspProcessClient
impl !UnwindSafe for LspProcessClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more