Skip to content

Commit a2e699a

Browse files
committed
fix crash when failed to load document becomes lsp synced
fixes #2609
1 parent 0e289f5 commit a2e699a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/DocumentStore.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,13 +1377,15 @@ fn createAndStoreDocument(
13771377
store: *DocumentStore,
13781378
uri: Uri,
13791379
/// Takes ownership.
1380+
/// `file_source == .text` implies `options.lsp_synced == true`.
13801381
file_source: FileSource,
13811382
options: CreateAndStoreOptions,
13821383
) ReadFileError!*Handle {
13831384
const tracy_zone = tracy.trace(@src());
13841385
defer tracy_zone.end();
13851386

13861387
std.debug.assert(!(options.lsp_synced and !options.override));
1388+
std.debug.assert(!(options.lsp_synced and file_source == .uri));
13871389

13881390
switch (file_source) {
13891391
.text => {},
@@ -1422,7 +1424,7 @@ fn createAndStoreDocument(
14221424
} else |err| {
14231425
const retry = switch (err) {
14241426
error.Canceled => true,
1425-
else => false,
1427+
else => file_source == .text,
14261428
};
14271429
if (options.override and !retry) return err;
14281430
previous_err = err;

0 commit comments

Comments
 (0)