@Test void testDidCloseDisposeDiagnostics() { Communications spyCommunications = spy(Communications.class); DidCloseTextDocumentParams closedDocument = new DidCloseTextDocumentParams(new TextDocumentIdentifier(DOCUMENT_URI)); service.didClose(closedDocument); assertEquals(Collections.EMPTY_MAP, closeGetter(service)); verify(spyCommunications, atMost(1)).publishDiagnostics(Map.of(DOCUMENT_URI, List.of())); }
@Override public void didClose(DidCloseTextDocumentParams params) { String uri = params.getTextDocument().getUri(); LOG.info(String.format("Document closing invoked on URI %s", uri)); communications.publishDiagnostics(Map.of(uri, List.of())); docs.remove(uri); }
MyTextDocumentService implements TextDocumentService, EventObserver<RunAnalysisEvent> { @Override public void didClose(DidCloseTextDocumentParams params) { String uri = params.getTextDocument().getUri(); LOG.info(String.format("Document closing invoked on URI %s", uri)); communications.publishDiagnostics(Map.of(uri, List.of())); docs.remove(uri); } }
MyTextDocumentService implements TextDocumentService, EventObserver<RunAnalysisEvent> { @Override public void didClose(DidCloseTextDocumentParams params) { String uri = params.getTextDocument().getUri(); LOG.info(String.format("Document closing invoked on URI %s", uri)); communications.publishDiagnostics(Map.of(uri, List.of())); docs.remove(uri); } @Inject @Builder  MyTextDocumentService(
      Communications communications,
      LanguageEngineFacade engine,
      Formations formations,
      Completions completions,
      Occurrences occurrences,
      DataBusBroker dataBus,
      CodeActions actions); }
MyTextDocumentService implements TextDocumentService, EventObserver<RunAnalysisEvent> { @Override public void didClose(DidCloseTextDocumentParams params) { String uri = params.getTextDocument().getUri(); LOG.info(String.format("Document closing invoked on URI %s", uri)); communications.publishDiagnostics(Map.of(uri, List.of())); docs.remove(uri); } @Inject @Builder  MyTextDocumentService(
      Communications communications,
      LanguageEngineFacade engine,
      Formations formations,
      Completions completions,
      Occurrences occurrences,
      DataBusBroker dataBus,
      CodeActions actions); @Override CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(
      CompletionParams params); @Override CompletableFuture<CompletionItem> resolveCompletionItem(CompletionItem unresolved); @Override CompletableFuture<List<? extends Location>> definition(
      TextDocumentPositionParams position); @Override CompletableFuture<List<? extends Location>> references(ReferenceParams params); @Override CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(
      TextDocumentPositionParams position); @Override CompletableFuture<List<? extends TextEdit>> formatting(DocumentFormattingParams params); @Override CompletableFuture<List<Either<Command, CodeAction>>> codeAction(CodeActionParams params); @Override void didOpen(DidOpenTextDocumentParams params); @Override void didChange(DidChangeTextDocumentParams params); @Override void didClose(DidCloseTextDocumentParams params); @Override void didSave(DidSaveTextDocumentParams params); @Override void observerCallback(@Nonnull RunAnalysisEvent event); @Override CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> documentSymbol(DocumentSymbolParams params); }
MyTextDocumentService implements TextDocumentService, EventObserver<RunAnalysisEvent> { @Override public void didClose(DidCloseTextDocumentParams params) { String uri = params.getTextDocument().getUri(); LOG.info(String.format("Document closing invoked on URI %s", uri)); communications.publishDiagnostics(Map.of(uri, List.of())); docs.remove(uri); } @Inject @Builder  MyTextDocumentService(
      Communications communications,
      LanguageEngineFacade engine,
      Formations formations,
      Completions completions,
      Occurrences occurrences,
      DataBusBroker dataBus,
      CodeActions actions); @Override CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(
      CompletionParams params); @Override CompletableFuture<CompletionItem> resolveCompletionItem(CompletionItem unresolved); @Override CompletableFuture<List<? extends Location>> definition(
      TextDocumentPositionParams position); @Override CompletableFuture<List<? extends Location>> references(ReferenceParams params); @Override CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(
      TextDocumentPositionParams position); @Override CompletableFuture<List<? extends TextEdit>> formatting(DocumentFormattingParams params); @Override CompletableFuture<List<Either<Command, CodeAction>>> codeAction(CodeActionParams params); @Override void didOpen(DidOpenTextDocumentParams params); @Override void didChange(DidChangeTextDocumentParams params); @Override void didClose(DidCloseTextDocumentParams params); @Override void didSave(DidSaveTextDocumentParams params); @Override void observerCallback(@Nonnull RunAnalysisEvent event); @Override CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> documentSymbol(DocumentSymbolParams params);  }