pub struct GoCompletionProvider;Expand description
Go-specific completion provider (fallback)
This is a fallback provider for Go code when external LSP (gopls) is unavailable.
§Behavior
Generates Go-specific completions including:
- Go keywords (package, import, func, const, var, type, struct, interface, etc.)
- Go-specific snippets (function templates, interface definitions, etc.)
- Go built-in functions (make, new, append, copy, delete, len, cap, etc.)
- Available symbols from code context
§When Used
- External LSP (gopls) is not configured
- gopls is not installed or fails to start
- gopls times out or becomes unresponsive
§Limitations
- No type inference or semantic analysis
- Cannot resolve imports or dependencies
- No project-aware completions
- Cannot determine variable scope or type information
- Limited to hardcoded keywords and patterns
§Recommended Configuration
For production-quality Go completions, install and configure gopls:
go install github.com/golang/tools/gopls@latestThen configure it in lsp-servers.yaml:
servers:
go:
- language: go
executable: gopls
args: ["serve"]
enabled: trueSee https://github.com/moabualruz/ricecoder/wiki/External-LSP-Configuration.md for details.
Trait Implementations§
Source§impl CompletionProvider for GoCompletionProvider
impl CompletionProvider for GoCompletionProvider
Source§fn generate_completions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_code: &'life1 str,
_position: Position,
context: &'life2 CompletionContext,
) -> Pin<Box<dyn Future<Output = CompletionResult<Vec<CompletionItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn generate_completions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_code: &'life1 str,
_position: Position,
context: &'life2 CompletionContext,
) -> Pin<Box<dyn Future<Output = CompletionResult<Vec<CompletionItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generate completions for this language Read more
Auto Trait Implementations§
impl Freeze for GoCompletionProvider
impl RefUnwindSafe for GoCompletionProvider
impl Send for GoCompletionProvider
impl Sync for GoCompletionProvider
impl Unpin for GoCompletionProvider
impl UnwindSafe for GoCompletionProvider
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