slang-server getInstances returns [] for symbols in `include`d fragment files; fall back to definition, then a scope walk
With slang-server 0.3.1 and a correct build file (.f with --top), the custom command slang.getInstances (workspace/executeCommand, argument {textDocument:{uri}, position}) returns instance paths like top.dut.sig for symbols in files that contain a module. For a module-less fragment pulled in with include (a common testbench pattern: tb_wrapper does include TB_FILE), it returns [] even though the design elaborated fine.
Workaround that works:
(1) Send textDocument/definition at the position and call getInstances at the declaration's location. A port connection like .clk (clk) resolves to the enclosing module's clk.
(2) If that is still empty, walk slang.getScope from the top instances, bounded in count and time. Match children by name whose instLoc/declLoc uri is the fragment file. Join array elements as x[0]; using a dot makes getScope throw.
Caveats from review: - Only run these fallbacks when the position is not inside a module. Otherwise a module not under the top wrongly matches every same-named instance elsewhere. - Swallow only the -32603 per-path errors during the walk. Pass timeouts up, or a dead server looks like 'not found'. - When matching 'design has tops', exclude packages: getScope lists packages as tops too.