Skip to content

Commit 93ebc1f

Browse files
committed
Замена абстрактного сервер контекста на использование ObjectProvider
1 parent 780fbf3 commit 93ebc1f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import lombok.extern.slf4j.Slf4j;
3434
import org.apache.commons.io.FileUtils;
3535
import org.eclipse.lsp4j.TextDocumentItem;
36-
import org.springframework.beans.factory.annotation.Lookup;
36+
import org.springframework.beans.factory.ObjectProvider;
3737
import org.springframework.stereotype.Component;
3838

3939
import javax.annotation.CheckForNull;
@@ -55,7 +55,8 @@
5555
@Slf4j
5656
@Component
5757
@RequiredArgsConstructor
58-
public abstract class ServerContext {
58+
public class ServerContext {
59+
private final ObjectProvider<DocumentContext> documentContextProvider;
5960
private final WorkDoneProgressHelper workDoneProgressHelper;
6061
private final Map<URI, DocumentContext> documents = Collections.synchronizedMap(new HashMap<>());
6162
private final Lazy<Configuration> configurationMetadata = new Lazy<>(this::computeConfigurationMetadata);
@@ -177,9 +178,6 @@ public Configuration getConfiguration() {
177178
return configurationMetadata.getOrCompute();
178179
}
179180

180-
@Lookup
181-
protected abstract DocumentContext lookupDocumentContext(URI absoluteURI);
182-
183181
@SneakyThrows
184182
private DocumentContext createDocumentContext(File file) {
185183
String content = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
@@ -189,7 +187,7 @@ private DocumentContext createDocumentContext(File file) {
189187
private DocumentContext createDocumentContext(URI uri, String content, int version) {
190188
URI absoluteURI = Absolute.uri(uri);
191189

192-
var documentContext = lookupDocumentContext(absoluteURI);
190+
var documentContext = documentContextProvider.getObject(absoluteURI);
193191
documentContext.rebuild(content, version);
194192

195193
documents.put(absoluteURI, documentContext);

0 commit comments

Comments
 (0)