1use std::path::Path;
2
3use crate::error::AftError;
4pub use crate::symbols::{Range, Symbol, SymbolMatch};
5
6pub trait LanguageProvider {
10 fn resolve_symbol(&self, file: &Path, name: &str) -> Result<Vec<SymbolMatch>, AftError>;
12
13 fn list_symbols(&self, file: &Path) -> Result<Vec<Symbol>, AftError>;
15
16 fn as_any(&self) -> &dyn std::any::Any;
18}
19
20pub struct StubProvider;
24
25impl LanguageProvider for StubProvider {
26 fn resolve_symbol(&self, _file: &Path, _name: &str) -> Result<Vec<SymbolMatch>, AftError> {
27 Err(AftError::InvalidRequest {
28 message: "no language provider configured".to_string(),
29 })
30 }
31
32 fn list_symbols(&self, _file: &Path) -> Result<Vec<Symbol>, AftError> {
33 Err(AftError::InvalidRequest {
34 message: "no language provider configured".to_string(),
35 })
36 }
37
38 fn as_any(&self) -> &dyn std::any::Any {
39 self
40 }
41}