diff --git a/kclvm/sema/src/core/symbol.rs b/kclvm/sema/src/core/symbol.rs index 853c8e67f..ac877df99 100644 --- a/kclvm/sema/src/core/symbol.rs +++ b/kclvm/sema/src/core/symbol.rs @@ -507,6 +507,17 @@ impl SymbolData { symbol_ref, ); } + + for (id, _) in self.values.iter() { + let symbol_ref = SymbolRef { + id, + kind: SymbolKind::Function, + }; + self.symbols_info.fully_qualified_name_map.insert( + self.get_fully_qualified_name(symbol_ref).unwrap(), + symbol_ref, + ); + } } pub fn alloc_package_symbol(&mut self, pkg: PackageSymbol) -> SymbolRef { diff --git a/kclvm/tools/src/LSP/src/document_symbol.rs b/kclvm/tools/src/LSP/src/document_symbol.rs index 7aae5434e..29b466b5d 100644 --- a/kclvm/tools/src/LSP/src/document_symbol.rs +++ b/kclvm/tools/src/LSP/src/document_symbol.rs @@ -130,6 +130,7 @@ fn symbol_kind_to_document_symbol_kind(kind: KCLSymbolKind) -> Option Some(SymbolKind::STRUCT), KCLSymbolKind::Attribute => Some(SymbolKind::PROPERTY), KCLSymbolKind::Value => Some(SymbolKind::VARIABLE), + KCLSymbolKind::Function => Some(SymbolKind::FUNCTION), KCLSymbolKind::Package => Some(SymbolKind::PACKAGE), KCLSymbolKind::TypeAlias => Some(SymbolKind::TYPE_PARAMETER), KCLSymbolKind::Unresolved => Some(SymbolKind::NULL), diff --git a/kclvm/tools/src/LSP/src/semantic_token.rs b/kclvm/tools/src/LSP/src/semantic_token.rs index 635b3ea82..bb290e9a6 100644 --- a/kclvm/tools/src/LSP/src/semantic_token.rs +++ b/kclvm/tools/src/LSP/src/semantic_token.rs @@ -16,6 +16,7 @@ pub const LEGEND_TYPE: &[SemanticTokenType] = &[ SemanticTokenType::MACRO, SemanticTokenType::COMMENT, SemanticTokenType::PARAMETER, + SemanticTokenType::FUNCTION, ]; pub(crate) struct KCLSemanticToken { @@ -63,6 +64,7 @@ pub(crate) fn get_kind(ty: SymbolKind, symbol: &KCLSymbol, gs: &GlobalState) -> SymbolKind::Package => Some(type_index(SemanticTokenType::NAMESPACE)), SymbolKind::TypeAlias => Some(type_index(SemanticTokenType::TYPE)), SymbolKind::Value => Some(type_index(SemanticTokenType::VARIABLE)), + SymbolKind::Function => Some(type_index(SemanticTokenType::FUNCTION)), SymbolKind::Rule => Some(type_index(SemanticTokenType::MACRO)), SymbolKind::Unresolved => match &symbol.get_definition() { Some(def_ref) => match gs.get_symbols().get_symbol(*def_ref) {