pub struct LuaLanguage { /* private fields */ }Expand description
A language defined by a Lua configuration file.
Build with LuaLanguage::from_path and hand it to
increparse_lsp::serve:
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let language = increparse_lua::LuaLanguage::from_path("minilang.lua")?;
increparse_lsp::serve(language)
}Implementations§
Source§impl LuaLanguage
impl LuaLanguage
Sourcepub fn from_path(
path: impl AsRef<Path>,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub fn from_path( path: impl AsRef<Path>, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Loads a language definition from a Lua file.
Trait Implementations§
Source§impl Language<LuaCtx> for LuaLanguage
impl Language<LuaCtx> for LuaLanguage
Source§fn supports_symbols(&self) -> bool
fn supports_symbols(&self) -> bool
Runtime hook for symbol support; defaults to
SUPPORTS_SYMBOLS.Source§fn diagnostic(
&self,
doc: &Document<LuaCtx>,
node: FailedNode<'_, LuaCtx>,
) -> Option<Diagnostic>
fn diagnostic( &self, doc: &Document<LuaCtx>, node: FailedNode<'_, LuaCtx>, ) -> Option<Diagnostic>
Renders the diagnostic for a failing region, or
None to stay
silent (e.g. for contexts whose failure is expected). Read moreSource§fn symbols(&self, doc: &Document<LuaCtx>) -> Vec<DocumentSymbol>
fn symbols(&self, doc: &Document<LuaCtx>) -> Vec<DocumentSymbol>
The document symbols for the outline view. Only consulted when
supports_symbols is true.Source§const SUPPORTS_SYMBOLS: bool = false
const SUPPORTS_SYMBOLS: bool = false
Source§fn encoding(&self) -> PositionEncoding
fn encoding(&self) -> PositionEncoding
The position encoding to negotiate with the client.
Defaults to UTF-16, the LSP default and what most clients use.
Source§fn extra_diagnostics(&self, doc: &Document<C>) -> Vec<Diagnostic>
fn extra_diagnostics(&self, doc: &Document<C>) -> Vec<Diagnostic>
Diagnostics that do not come from parse failures — lint-rule
violations, style warnings, anything computed from the settled
document rather than a failing tree node. Merged into the same
publishDiagnostics notification, after the parse diagnostics.Source§fn supports_hover(&self) -> bool
fn supports_hover(&self) -> bool
Runtime hook for hover support; defaults to
false.Source§fn supports_definition(&self) -> bool
fn supports_definition(&self) -> bool
Runtime hook for go-to-definition support; defaults to
false.Source§fn supports_completion(&self) -> bool
fn supports_completion(&self) -> bool
Runtime hook for completion support; defaults to
false.Source§fn supports_code_actions(&self) -> bool
fn supports_code_actions(&self) -> bool
Runtime hook for code-action support (the editor’s quickfix
lightbulb); defaults to
false.Source§fn code_action(&self, doc: &Document<C>, range: Range) -> Vec<CodeAction>
fn code_action(&self, doc: &Document<C>, range: Range) -> Vec<CodeAction>
Code actions for the given range — typically quickfixes for the
diagnostics published there. The skeleton dispatches
textDocument/codeAction when
supports_code_actions is true.Source§fn definition(&self, doc: &Document<C>, offset: usize) -> Option<Vec<Location>>
fn definition(&self, doc: &Document<C>, offset: usize) -> Option<Vec<Location>>
Definition locations for the byte
offset in doc, or None.Source§fn completion(
&self,
doc: &Document<C>,
offset: usize,
) -> Option<CompletionResponse>
fn completion( &self, doc: &Document<C>, offset: usize, ) -> Option<CompletionResponse>
Completions for the byte
offset in doc, or None.Auto Trait Implementations§
impl !Freeze for LuaLanguage
impl !RefUnwindSafe for LuaLanguage
impl !UnwindSafe for LuaLanguage
impl Send for LuaLanguage
impl Sync for LuaLanguage
impl Unpin for LuaLanguage
impl UnsafeUnpin for LuaLanguage
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> 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