aboutsummaryrefslogtreecommitdiff
path: root/src/server/caches.odin
blob: d2866246de3dd52bc5fe5631cb486861d35c7851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package server

import "src:common"

import "core:time"

//Used in semantic tokens and inlay hints to handle the entire file being resolved.

FileResolve :: struct {
	symbols: map[uintptr]SymbolAndNode,
}


FileResolveCache :: struct {
	files: map[string]FileResolve,
}

file_resolve_cache: FileResolveCache

resolve_entire_file_cached :: proc(
	document: ^Document,
) -> map[uintptr]SymbolAndNode {
	if document.uri.uri not_in file_resolve_cache.files {
		file_resolve_cache.files[document.uri.uri] = FileResolve {
			symbols = resolve_entire_file(
				document,
				"",
				.None,
				false,
				common.scratch_allocator(document.allocator),
			),
		}
	}

	return file_resolve_cache.files[document.uri.uri].symbols
}

BuildCache :: struct {
	loaded_pkgs: map[string]PackageCacheInfo,
}

PackageCacheInfo :: struct {
	timestamp: time.Time,
}

build_cache: BuildCache