From 5fd35f7efebe3b8e3a77c3f184b6c51dd77f1312 Mon Sep 17 00:00:00 2001 From: maxxnino <34153891+maxxnino@users.noreply.github.com> Date: Sat, 16 Oct 2021 12:05:34 +0900 Subject: [PATCH] Fix zigtools/zls#389 --- src/DocumentStore.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/DocumentStore.zig b/src/DocumentStore.zig index 1ba8bce..9fd18ba 100644 --- a/src/DocumentStore.zig +++ b/src/DocumentStore.zig @@ -291,6 +291,12 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: [:0]u8) anyerror!*Ha } } + // Check if the build file already exists + if (self.handles.get(build_file_uri)) |build_file_handle| { + candidate = build_file_handle.is_build_file.?; + break; + } + // Read the build file, create a new document, set the candidate to the new build file. const build_file_text = try build_file.readToEndAllocOptions( self.allocator,