aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/caches.odin10
-rw-r--r--src/server/documents.odin2
-rw-r--r--src/server/requests.odin14
3 files changed, 17 insertions, 9 deletions
diff --git a/src/server/caches.odin b/src/server/caches.odin
index 640677f..2bb4b7f 100644
--- a/src/server/caches.odin
+++ b/src/server/caches.odin
@@ -12,8 +12,10 @@ FileResolveCache :: struct {
file_resolve_cache: FileResolveCache
resolve_entire_file :: proc(document: ^common.Document) {
- file_resolve_cache.files[document.uri.uri] = analysis.resolve_entire_file(
- document,
- common.scratch_allocator(document.allocator),
- )
+ if document.uri.uri not_in file_resolve_cache.files {
+ file_resolve_cache.files[document.uri.uri] = analysis.resolve_entire_file(
+ document,
+ common.scratch_allocator(document.allocator),
+ )
+ }
}
diff --git a/src/server/documents.odin b/src/server/documents.odin
index 9c70035..3ac8cdc 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -323,6 +323,8 @@ parse_document :: proc(document: ^common.Document, config: ^common.Config) -> ([
free_all(common.scratch_allocator(document.allocator))
+ delete_key(&file_resolve_cache.files, document.uri.uri)
+
context.allocator = common.scratch_allocator(document.allocator)
//have to cheat the parser since it really wants to parse an entire package with the new changes...
diff --git a/src/server/requests.odin b/src/server/requests.odin
index 62ef3b1..8b988cc 100644
--- a/src/server/requests.odin
+++ b/src/server/requests.odin
@@ -816,11 +816,13 @@ notification_did_save :: proc (params: json.Value, id: RequestId, config: ^commo
log.errorf("error in parse file for indexing %v", fullpath)
}
- for key, value in index.indexer.dynamic_index.collection.symbols {
- if value.uri == uri.uri {
- index.free_symbol(value, context.allocator)
- index.indexer.dynamic_index.collection.symbols[key] = {}
- }
+ for k, v in &index.indexer.dynamic_index.collection.packages {
+ for k2, v2 in &v {
+ if v2.uri == uri.uri {
+ index.free_symbol(v2, context.allocator)
+ v[k2] = {}
+ }
+ }
}
if ret := index.collect_symbols(&index.indexer.dynamic_index.collection, file, uri.uri); ret != .None {
@@ -995,6 +997,8 @@ request_inlay_hint :: proc (params: json.Value, id: RequestId, config: ^common.C
hints: []InlayHint
+ resolve_entire_file(document)
+
if cache_symbols, ok := file_resolve_cache.files[document.uri.uri]; ok {
hints, ok = get_inlay_hints(document, cache_symbols)
}