diff --git a/indexer/index_reference_visitor.cpp b/indexer/index_reference_visitor.cpp index b8eba3f..d141401 100644 --- a/indexer/index_reference_visitor.cpp +++ b/indexer/index_reference_visitor.cpp @@ -5,7 +5,7 @@ namespace diplomat::index bool ReferenceVisitor::_add_reference_from_stx(const slang::SourceRange & loc, const std::string_view& name) { - spdlog::info(" Found reference for name {}", name); + spdlog::debug(" Found reference for name {}", name); IndexRange node_loc(loc,*_sm); IndexFile* parent_file = _index->add_file(node_loc.start.file); diff --git a/indexer/index_scope.cpp b/indexer/index_scope.cpp index 1495596..5b9d63b 100644 --- a/indexer/index_scope.cpp +++ b/indexer/index_scope.cpp @@ -114,6 +114,7 @@ namespace diplomat::index { { const IndexScope* lu_scope = this; std::vector ret; + bool keep_going = false; do { for(auto& symb : std::views::values(lu_scope->_content)) { @@ -121,9 +122,16 @@ namespace diplomat::index { } if(lu_scope->get_parent_access()) + { lu_scope = lu_scope->_parent; + keep_going = true; + } + else + { + keep_going = false; + } - } while (lu_scope->get_parent_access()); + } while (keep_going); return ret; } diff --git a/lsp-server/diplomat/src/diplomat_lsp_binds.cpp b/lsp-server/diplomat/src/diplomat_lsp_binds.cpp index 59db863..d591d0c 100755 --- a/lsp-server/diplomat/src/diplomat_lsp_binds.cpp +++ b/lsp-server/diplomat/src/diplomat_lsp_binds.cpp @@ -90,6 +90,7 @@ json DiplomatLSP::_h_completion(slsp::types::CompletionParams params) if(trigger_scope) { + spdlog::info("Required completion on valid scope"); for(const di::IndexSymbol* symb : trigger_scope->get_visible_symbols() ) { if(symb->get_source_location().value_or(trigger_location) > trigger_location) @@ -97,12 +98,15 @@ json DiplomatLSP::_h_completion(slsp::types::CompletionParams params) CompletionItem record; record.label = symb->get_name(); + record.kind = CompletionItemKind::CompletionItemKind_Variable; result.items.push_back(record); } } else { // Propose symbols from the whole file. + + spdlog::info("Required completion on full file"); for(const auto& symb : _index->get_file(trigger_location.file)->get_symbols() ) { if(symb->get_source_location().value_or(trigger_location) > trigger_location) @@ -110,10 +114,13 @@ json DiplomatLSP::_h_completion(slsp::types::CompletionParams params) CompletionItem record; record.label = symb->get_name(); + record.kind = CompletionItemKind::CompletionItemKind_Variable; result.items.push_back(record); } } + spdlog::info(" Returned {} propositions",result.items.size()); + return result; } @@ -733,4 +740,4 @@ json DiplomatLSP::_h_list_symbols(json& params) // } return ret; -} \ No newline at end of file +}