JavaScriptLanguageService

Struct JavaScriptLanguageService 

Source
pub struct JavaScriptLanguageService<V: Vfs> { /* private fields */ }

Implementations§

Source§

impl<V: Vfs> JavaScriptLanguageService<V>

Source

pub fn new(vfs: V) -> Self

Trait Implementations§

Source§

impl<V: Vfs + Send + Sync + 'static + WritableVfs> LanguageService for JavaScriptLanguageService<V>

Source§

type Lang = JavaScriptLanguage

Source§

type Vfs = V

Source§

fn vfs(&self) -> &Self::Vfs

Get the underlying VFS.
Source§

fn workspace(&self) -> &WorkspaceManager

Get the workspace manager.
Source§

fn get_root( &self, uri: &str, ) -> impl Future<Output = Option<RedNode<'_, JavaScriptLanguage>>> + Send + '_

Helper to get the root red node of a file. Implementations should override this to provide actual parsing/caching.
Source§

fn get_source(&self, uri: &str) -> Option<Box<dyn Source + Sync + Send>>

Helper to get source from VFS.
Source§

fn with_root<'a, R, F>( &'a self, uri: &'a str, f: F, ) -> impl Future<Output = Option<R>> + Send + 'a
where R: Send, F: FnOnce(RedNode<'a, Self::Lang>) -> R + Send + 'a,

Helper to run logic with the root node.
Source§

fn with_roots<'a, R, F>( &'a self, uris: Vec<String>, f: F, ) -> impl Future<Output = Vec<R>> + Send + 'a
where R: Send + 'static, F: Fn(RedNode<'a, Self::Lang>) -> R + Send + Sync + 'a,

Helper to run logic with multiple root nodes in parallel.
Source§

fn hover( &self, _uri: &str, _range: Range<usize>, ) -> impl Future<Output = Option<Hover>> + Send

Provide hover information. Defaults to None.
Source§

fn folding_ranges( &self, _uri: &str, ) -> impl Future<Output = Vec<FoldingRange>> + Send

Provide folding ranges. Defaults to empty.
Source§

fn document_symbols( &self, _uri: &str, ) -> impl Future<Output = Vec<StructureItem>> + Send

Provide document symbols. Defaults to empty.
Source§

fn workspace_symbols( &self, _query: &str, ) -> impl Future<Output = Vec<WorkspaceSymbol>> + Send

Search for symbols in the entire workspace.
Source§

fn list_all_files( &self, root_uri: &str, ) -> impl Future<Output = Vec<String>> + Send

Helper to list all files recursively.
Source§

fn definition<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Vec<LocationRange>> + Send + 'a

Find definition. Defaults to empty.
Source§

fn references<'a>( &'a self, _uri: &'a str, _range: Range<usize>, ) -> impl Future<Output = Vec<LocationRange>> + Send + 'a

Find references. Defaults to empty.
Source§

fn rename<'a>( &'a self, _uri: &'a str, _range: Range<usize>, _new_name: String, ) -> impl Future<Output = Option<WorkspaceEdit>> + Send + 'a

Rename a symbol.
Source§

fn completion<'a>( &'a self, _uri: &'a str, _position: usize, ) -> impl Future<Output = Vec<CompletionItem>> + Send + 'a

Provide completion items. Defaults to empty.
Source§

fn diagnostics<'a>( &'a self, _uri: &'a str, ) -> impl Future<Output = Vec<Diagnostic>> + Send + 'a

Provide diagnostics for a file. Defaults to empty.
Source§

fn initialize<'a>( &'a self, _params: InitializeParams, ) -> impl Future<Output = ()> + Send + 'a

Called when the language server is initialized.
Source§

fn initialized<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a

Called when the language server is initialized (notification).
Source§

fn shutdown<'a>(&'a self) -> impl Future<Output = ()> + Send + 'a

Called when the language server is shut down.
Source§

fn did_save<'a>(&'a self, _uri: &'a str) -> impl Future<Output = ()> + Send + 'a

Called when a file is saved.
Source§

fn did_close<'a>( &'a self, _uri: &'a str, ) -> impl Future<Output = ()> + Send + 'a

Called when a file is closed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LanguageServiceExt for T
where T: LanguageService,

Source§

fn into_axum_router(self) -> Router
where Self: Sized + 'static,

Converts the language service into an Axum router.
Source§

impl<S> OakMcpService for S
where S: LanguageService + 'static, <S as LanguageService>::Vfs: WritableVfs,

Source§

fn into_mcp_server(self) -> McpServer<Self>

Convert this service into an Oak MCP server.
Source§

fn into_mcp_axum_router(self) -> Router

Create an Axum router for this MCP service.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,