|
48 | 48 | import org.eclipse.lsp4j.HoverOptions; |
49 | 49 | import org.eclipse.lsp4j.InitializeParams; |
50 | 50 | import org.eclipse.lsp4j.InitializeResult; |
| 51 | +import org.eclipse.lsp4j.InitializedParams; |
51 | 52 | import org.eclipse.lsp4j.InlayHintRegistrationOptions; |
52 | 53 | import org.eclipse.lsp4j.ReferenceOptions; |
53 | 54 | import org.eclipse.lsp4j.RenameCapabilities; |
@@ -108,13 +109,6 @@ public CompletableFuture<InitializeResult> initialize(InitializeParams params) { |
108 | 109 |
|
109 | 110 | setConfigurationRoot(params); |
110 | 111 |
|
111 | | - var factory = new NamedForkJoinWorkerThreadFactory("populate-context-"); |
112 | | - var executorService = new ForkJoinPool(ForkJoinPool.getCommonPoolParallelism(), factory, null, true); |
113 | | - CompletableFuture |
114 | | - .runAsync(context::populateContext, executorService) |
115 | | - .thenAccept(unused -> executorService.shutdown()) |
116 | | - ; |
117 | | - |
118 | 112 | var capabilities = new ServerCapabilities(); |
119 | 113 | capabilities.setTextDocumentSync(getTextDocumentSyncOptions()); |
120 | 114 | capabilities.setDocumentRangeFormattingProvider(getDocumentRangeFormattingProvider()); |
@@ -163,6 +157,20 @@ private void setConfigurationRoot(InitializeParams params) { |
163 | 157 | context.setConfigurationRoot(configurationRoot); |
164 | 158 | } |
165 | 159 |
|
| 160 | + @Override |
| 161 | + public void initialized(InitializedParams params) { |
| 162 | + var factory = new NamedForkJoinWorkerThreadFactory("populate-context-"); |
| 163 | + var executorService = new ForkJoinPool(ForkJoinPool.getCommonPoolParallelism(), factory, null, true); |
| 164 | + CompletableFuture |
| 165 | + .runAsync(context::populateContext, executorService) |
| 166 | + .whenComplete((unused, throwable) -> { |
| 167 | + executorService.shutdown(); |
| 168 | + if (throwable != null) { |
| 169 | + LOGGER.error("Error populating context", throwable); |
| 170 | + } |
| 171 | + }); |
| 172 | + } |
| 173 | + |
166 | 174 | @Override |
167 | 175 | public CompletableFuture<Object> shutdown() { |
168 | 176 | shutdownWasCalled = true; |
|
0 commit comments