From 3ae01fd63bb146bc69019970e33139048cfa776c Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Fri, 27 Dec 2024 16:12:32 +0100 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=D1=80=D0=B8=D0=B9=20=D0=BD=D0=B0=20=D0=B1=D1=83=D0=B4=D1=83?= =?UTF-8?q?=D1=89=D0=B5=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../languageserver/references/AnnotationReferenceFinder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java index 7916aa8cd2..96988a0e41 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java @@ -74,6 +74,11 @@ public void handleDocumentContextChange(DocumentContextContentChangedEvent event } private void findAndRegisterAnnotation(DocumentContext documentContext) { + // In normal case this method may be called twice per each document context: + // 1. When the document context is created during the server context population or document opening + // 2. When server context is fully populated. + // This can lead to the situation when annotations registered from opened documents are cleared after populateContext step. + // Due to limitation of mechanism to only OS files, we can leave it as is for now, but it should be refactored in the future. if (documentContext.getFileType() != FileType.OS) { return; }