Skip to content

Commit

Permalink
Add tooltip rendering #7
Browse files Browse the repository at this point in the history
  • Loading branch information
SpontanCombust committed May 21, 2024
1 parent 1ff8a2f commit 26e64ee
Show file tree
Hide file tree
Showing 5 changed files with 579 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/analysis/src/symbol_analysis/symbol_table/marcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ impl<'a> SymbolTableMarcher<'a> {
self.march(|symtab| symtab.get(path))
}

#[inline]
pub fn get_with_containing(self, path: &SymbolPath) -> Option<(&'a SymbolTable, &'a SymbolVariant)> {
self.march(|symtab| {
if let Some(symvar) = symtab.get(path) {
Some((symtab, symvar))
} else {
None
}
})
}

#[inline]
pub fn locate(self, path: &SymbolPath) -> Option<SymbolLocation> {
self.march(|symtab| symtab.locate(path))
Expand Down Expand Up @@ -181,7 +192,7 @@ impl<'a> Iterator for StateHierarchy<'a> {

if let Some(current_state_sym) = self.marcher.clone().get(&self.current_state_path).and_then(|v| v.try_as_state_ref()) {
self.current_state_path.clear();

//FIXME switch to using `base_state_path` when that is possible
if let Some(base_state_name) = &current_state_sym.base_state_name {
for class in self.marcher.clone().class_hierarchy(current_state_sym.parent_class_path()) {
for state in self.marcher.clone().class_states(class.path()) {
Expand Down
5 changes: 5 additions & 0 deletions crates/lsp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ impl LanguageServer for Backend {
async fn goto_type_definition(&self, params: lsp::request::GotoTypeDefinitionParams) -> Result<Option<lsp::request::GotoTypeDefinitionResponse>> {
providers::goto::goto_type_definition(self, params).await
}


async fn hover(&self, params: lsp::HoverParams) -> Result<Option<lsp::Hover>> {
providers::hover::hover(self, params).await
}
}


Expand Down
Loading

0 comments on commit 26e64ee

Please sign in to comment.