pub struct LspTool { /* private fields */ }Expand description
LSP Tool for code intelligence
Provides access to Language Server Protocol features:
- Go to definition
- Find references
- Hover information
- Code completion
- Diagnostics
Requirements: 7.1, 7.2, 7.3, 7.4, 7.5, 7.6
Implementations§
Source§impl LspTool
impl LspTool
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new LspTool without a callback
Note: Without a callback, the tool will return an error when executed.
Use with_callback to set up the LSP handler.
Sourcepub fn with_callback(self, callback: LspCallback) -> Self
pub fn with_callback(self, callback: LspCallback) -> Self
Set the callback for LSP operations
Sourcepub fn with_supported_extensions(self, extensions: Vec<String>) -> Self
pub fn with_supported_extensions(self, extensions: Vec<String>) -> Self
Set supported file extensions
Sourcepub fn has_callback(&self) -> bool
pub fn has_callback(&self) -> bool
Check if a callback is configured
Sourcepub fn is_extension_supported(&self, path: &Path) -> bool
pub fn is_extension_supported(&self, path: &Path) -> bool
Check if a file extension is supported
Sourcepub async fn execute_operation(
&self,
operation: LspOperation,
path: &Path,
position: Option<Position>,
) -> Result<LspResult, ToolError>
pub async fn execute_operation( &self, operation: LspOperation, path: &Path, position: Option<Position>, ) -> Result<LspResult, ToolError>
Execute an LSP operation
Sourcepub async fn goto_definition(
&self,
path: &Path,
position: Position,
) -> Result<Vec<Location>, ToolError>
pub async fn goto_definition( &self, path: &Path, position: Position, ) -> Result<Vec<Location>, ToolError>
Go to definition
Requirements: 7.1
Sourcepub async fn find_references(
&self,
path: &Path,
position: Position,
) -> Result<Vec<Location>, ToolError>
pub async fn find_references( &self, path: &Path, position: Position, ) -> Result<Vec<Location>, ToolError>
Find references
Requirements: 7.2
Sourcepub async fn hover(
&self,
path: &Path,
position: Position,
) -> Result<Option<HoverInfo>, ToolError>
pub async fn hover( &self, path: &Path, position: Position, ) -> Result<Option<HoverInfo>, ToolError>
Get hover information
Requirements: 7.3
Sourcepub async fn completions(
&self,
path: &Path,
position: Position,
) -> Result<Vec<CompletionItem>, ToolError>
pub async fn completions( &self, path: &Path, position: Position, ) -> Result<Vec<CompletionItem>, ToolError>
Get completions
Requirements: 7.4
Sourcepub async fn diagnostics(
&self,
path: &Path,
) -> Result<Vec<Diagnostic>, ToolError>
pub async fn diagnostics( &self, path: &Path, ) -> Result<Vec<Diagnostic>, ToolError>
Get diagnostics
Requirements: 7.5
Sourcepub async fn document_symbols(
&self,
path: &Path,
) -> Result<Vec<DocumentSymbol>, ToolError>
pub async fn document_symbols( &self, path: &Path, ) -> Result<Vec<DocumentSymbol>, ToolError>
Get document symbols
Requirements: 7.6
Sourcepub async fn workspace_symbols(
&self,
path: &Path,
) -> Result<Vec<WorkspaceSymbol>, ToolError>
pub async fn workspace_symbols( &self, path: &Path, ) -> Result<Vec<WorkspaceSymbol>, ToolError>
Search workspace symbols
Requirements: 7.7
Sourcepub async fn goto_implementation(
&self,
path: &Path,
position: Position,
) -> Result<Vec<Location>, ToolError>
pub async fn goto_implementation( &self, path: &Path, position: Position, ) -> Result<Vec<Location>, ToolError>
Go to implementation
Requirements: 7.8
Sourcepub async fn prepare_call_hierarchy(
&self,
path: &Path,
position: Position,
) -> Result<Vec<CallHierarchyItem>, ToolError>
pub async fn prepare_call_hierarchy( &self, path: &Path, position: Position, ) -> Result<Vec<CallHierarchyItem>, ToolError>
Prepare call hierarchy
Requirements: 7.9
Sourcepub async fn incoming_calls(
&self,
path: &Path,
position: Position,
) -> Result<Vec<CallHierarchyIncomingCall>, ToolError>
pub async fn incoming_calls( &self, path: &Path, position: Position, ) -> Result<Vec<CallHierarchyIncomingCall>, ToolError>
Get incoming calls
Requirements: 7.10
Sourcepub async fn outgoing_calls(
&self,
path: &Path,
position: Position,
) -> Result<Vec<CallHierarchyOutgoingCall>, ToolError>
pub async fn outgoing_calls( &self, path: &Path, position: Position, ) -> Result<Vec<CallHierarchyOutgoingCall>, ToolError>
Get outgoing calls
Requirements: 7.11
Trait Implementations§
Source§impl Tool for LspTool
impl Tool for LspTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
params: Value,
context: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
params: Value,
context: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn check_permissions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_params: &'life1 Value,
_context: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = PermissionCheckResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn check_permissions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_params: &'life1 Value,
_context: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = PermissionCheckResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn dynamic_description(&self) -> Option<String>
fn dynamic_description(&self) -> Option<String>
Source§fn get_definition(&self) -> ToolDefinition
fn get_definition(&self) -> ToolDefinition
Source§fn options(&self) -> ToolOptions
fn options(&self) -> ToolOptions
Auto Trait Implementations§
impl Freeze for LspTool
impl !RefUnwindSafe for LspTool
impl Send for LspTool
impl Sync for LspTool
impl Unpin for LspTool
impl UnsafeUnpin for LspTool
impl !UnwindSafe for LspTool
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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<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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.