Skip to content

find_symbol can return stale/incorrect information (observed for Clojure/LSP) #1593

Description

@opcode81
INFO  2026-06-22 15:51:24,654 [Task-291:FindSymbolTool] serena.tools.tools_base:_log_tool_application:266 - find_symbol: name_path_pattern='make-nested', depth=0, relative_path='common/src/app/common/test_model/comp/nodes.cljc', include_body=True, include_info=False, include_kinds=[], exclude_kinds=[], substring_matching=False, max_matches=-1, max_answer_chars=-1, session_id='73791df82be0'; session_id: 73791df82be0
INFO  2026-06-22 15:51:24,666 [Task-291:FindSymbolTool] serena.tools.tools_base:task:383 - Result: [{"name_path": "make-nested", "kind": "Function", "relative_path": "common/src/app/common/test_model/comp/nodes.cljc", "body_location": {"start_line": 206, "end_line": 215}, "body": ";;        next `make-nested`) will instantiate. Advances to the new OUTER component\n;;        with each `make-nested`.\n;;     :nesting-count — how many `make-nested` layers were applied.\n;;\n;; \"corresponds to\" between layers is resolved by following the :shape-ref chain\n;; (a copy shape refs the main shape it mirrors); within these single-file setups\n;; the chain resolves in the local page objects, so a local walk suffices.\n;; ===========================================================================\n\n(defn- ref-chain-ids"}]
INFO  2026-06-22 15:51:24,666 [Task-291:FindSymbolTool] solidlsp.ls:_save_raw_document_symbols_cache:2900 - Saving updated raw document symbols cache to /home/penpot/penpot/.serena/cache/clojure/raw_document_symbols.pkl
INFO  2026-06-22 15:51:24,694 [Task-291:FindSymbolTool] solidlsp.ls:_save_document_symbols_cache:2970 - Saving updated document symbols cache to /home/penpot/penpot/.serena/cache/clojure/document_symbols.pkl

Observe that the body being returned for make-nested is not a body at all - but, suspiciously, a comment mentioning the function.
The true location of the function is not line 206 but line 454.

Interestingly, the language server must have been explicitly invoked to process the file in question, as the two subsequent log messages clearly indicate that the symbol cache was updated.
So this might be a language server bug - or a bug in Serena where occurrences in comments are treated as symbol definitions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions