pub struct PythonCompletionProvider;Expand description
Python-specific completion provider (fallback)
This is a fallback provider for Python code when external LSP (pylsp) is unavailable.
§Behavior
Generates Python-specific completions including:
- Python keywords (def, class, if, for, while, try, except, etc.)
- Python-specific snippets (function definitions, class definitions, etc.)
- Python decorators (@property, @staticmethod, @classmethod, etc.)
- Python type hints (List, Dict, Set, Optional, Union, etc.)
- Python context managers (open, lock, transaction, etc.)
- Available symbols from code context
§When Used
- External LSP (pylsp) is not configured
- pylsp is not installed or fails to start
- pylsp 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 Python completions, install and configure pylsp:
pip install python-lsp-serverThen configure it in lsp-servers.yaml:
servers:
python:
- language: python
executable: pylsp
enabled: trueSee https://github.com/moabualruz/ricecoder/wiki/External-LSP-Configuration.md for details.
Trait Implementations§
Source§impl CompletionProvider for PythonCompletionProvider
impl CompletionProvider for PythonCompletionProvider
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 PythonCompletionProvider
impl RefUnwindSafe for PythonCompletionProvider
impl Send for PythonCompletionProvider
impl Sync for PythonCompletionProvider
impl Unpin for PythonCompletionProvider
impl UnwindSafe for PythonCompletionProvider
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