aboutsummaryrefslogtreecommitdiff
path: root/src/server/caches.odin
blob: 4acc3afe84071c69c68911e3f94383ff723315a0 (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
package server

import "shared:common"

import "core:time"

//Used in semantic tokens and inlay hints to handle the entire file being resolved.
FileResolveCache :: struct {
	files: map[string]map[uintptr]SymbolAndNode,
}

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] = resolve_entire_file(
			document,
			"",
			.None,
			common.scratch_allocator(document.allocator),
		)
	}	

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


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

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

build_cache: BuildCache