diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-09 13:26:48 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-09 13:29:42 -0400 |
| commit | d7d113f5b20c791523fdb7b32b2107dc88b34317 (patch) | |
| tree | bebc5095a5f554d00554407fdc33751906f6f36f | |
| parent | 674d5703cc7ba004b4270119a168771543498138 (diff) | |
Find symbols in all workspaces and set TTL to 20s
| -rw-r--r-- | src/server/workspace_symbols.odin | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/src/server/workspace_symbols.odin b/src/server/workspace_symbols.odin index c4ce9c6..11e7a8a 100644 --- a/src/server/workspace_symbols.odin +++ b/src/server/workspace_symbols.odin @@ -39,50 +39,52 @@ walk_dir :: proc(info: os.File_Info, in_err: os.Errno, user_data: rawptr) -> (er } get_workspace_symbols :: proc(query: string) -> (workspace_symbols: []WorkspaceSymbol, ok: bool) { - if time.since(cache.time) > 15 * time.Second { + if time.since(cache.time) > 20 * time.Second { for pkg in cache.pkgs { delete(pkg) } clear(&cache.pkgs) - workspace := common.config.workspace_folders[0] - uri := common.parse_uri(workspace.uri, context.temp_allocator) or_return - pkgs := make([dynamic]string, 0, context.temp_allocator) + for workspace in common.config.workspace_folders { + uri := common.parse_uri(workspace.uri, context.temp_allocator) or_return + pkgs := make([dynamic]string, 0, context.temp_allocator) - filepath.walk(uri.path, walk_dir, &pkgs) + filepath.walk(uri.path, walk_dir, &pkgs) - _pkg: for pkg in pkgs { - matches, err := filepath.glob(fmt.tprintf("%v/*.odin", pkg), context.temp_allocator) + _pkg: for pkg in pkgs { + matches, err := filepath.glob(fmt.tprintf("%v/*.odin", pkg), context.temp_allocator) - if len(matches) == 0 { - continue - } - - for exclude_path in common.config.profile.exclude_path { - exclude_forward, _ := filepath.to_slash(exclude_path, context.temp_allocator) + if len(matches) == 0 { + continue + } - if exclude_forward[len(exclude_forward) - 2:] == "**" { - lower_pkg := strings.to_lower(pkg) - lower_exclude := strings.to_lower(exclude_forward[:len(exclude_forward) - 3]) - if strings.contains(lower_pkg, lower_exclude) { - continue _pkg - } - } else { - lower_pkg := strings.to_lower(pkg) - lower_exclude := strings.to_lower(exclude_forward) - if lower_pkg == lower_exclude { - continue _pkg + for exclude_path in common.config.profile.exclude_path { + exclude_forward, _ := filepath.to_slash(exclude_path, context.temp_allocator) + + if exclude_forward[len(exclude_forward) - 2:] == "**" { + lower_pkg := strings.to_lower(pkg) + lower_exclude := strings.to_lower(exclude_forward[:len(exclude_forward) - 3]) + if strings.contains(lower_pkg, lower_exclude) { + continue _pkg + } + } else { + lower_pkg := strings.to_lower(pkg) + lower_exclude := strings.to_lower(exclude_forward) + if lower_pkg == lower_exclude { + continue _pkg + } } } - } - try_build_package(pkg) - append(&cache.pkgs, strings.clone(pkg, context.allocator)) + try_build_package(pkg) + append(&cache.pkgs, strings.clone(pkg, context.allocator)) + } } cache.time = time.now() } - symbols := make([dynamic]WorkspaceSymbol, 0, 100, context.temp_allocator) - if results, ok := fuzzy_search(query, cache.pkgs[:], "", resolve_fields = false, limit = 100); ok { + limit :: 100 + symbols := make([dynamic]WorkspaceSymbol, 0, limit, context.temp_allocator) + if results, ok := fuzzy_search(query, cache.pkgs[:], "", resolve_fields = false, limit = limit); ok { for result in results { symbol := WorkspaceSymbol { name = result.symbol.name, |