Source:
<code>public void fill(final Menu menu, int index) { final MenuItem item = new MenuItem(menu, SWT.NONE, index); item.setEnabled(false); if (infos.isEmpty()){ item.setText(Messages.notImplemented); return; } item.setText(Messages.computing); CodeActionContext context = new CodeActionContext(Collections.emptyList()); CodeActionParams params = new CodeActionParams(); params.setTextDocument(new TextDocumentIdentifier(infos.get(0).getFileUri().toString())); params.setRange(this.range); params.setContext(context); Set<CompletableFuture<?>> runningFutures = new HashSet<>(); for (LSPDocumentInfo info : this.infos) { final CompletableFuture<List<? extends Command>> codeActions = info.getLanguageClient().getTextDocumentService().codeAction(params); runningFutures.add(codeActions); codeActions.whenComplete(new BiConsumer<List<? extends Command>, Throwable>() { @Override public void accept(List<? extends Command> t, Throwable u) { runningFutures.remove(codeActions); UIJob job = new UIJob(menu.getDisplay(), Messages.updateCodeActions_menu) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (u != null) { final MenuItem item = new MenuItem(menu, SWT.NONE, index); item.setText(u.getMessage()); item.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEC_FIELD_ERROR)); item.setEnabled(false); } else if(t != null) { for (Command command : t) { if (command != null) { final MenuItem item = new MenuItem(menu, SWT.NONE, index); item.setText(command.getTitle()); item.setEnabled(false); } } } if (menu.getItemCount() == 1) { <START> item.setText(Messages.notImplemented); <END> }else { item.dispose(); } return Status.OK_STATUS; } }; job.schedule(); } }); } super.fill(menu, index); }</code><technical_language>new item created operation returns empty list of commands (ie codeaction is avalaible there). In case "Not implemented" "no code action available"</technical_language>

Target:
public void fill(final Menu menu, int index) { final MenuItem item = new MenuItem(menu, SWT.NONE, index); item.setEnabled(false); if (infos.isEmpty()){ item.setText(Messages.notImplemented); return; } item.setText(Messages.computing); CodeActionContext context = new CodeActionContext(Collections.emptyList()); CodeActionParams params = new CodeActionParams(); params.setTextDocument(new TextDocumentIdentifier(infos.get(0).getFileUri().toString())); params.setRange(this.range); params.setContext(context); Set<CompletableFuture<?>> runningFutures = new HashSet<>(); for (LSPDocumentInfo info : this.infos) { final CompletableFuture<List<? extends Command>> codeActions = info.getLanguageClient().getTextDocumentService().codeAction(params); runningFutures.add(codeActions); codeActions.whenComplete(new BiConsumer<List<? extends Command>, Throwable>() { @Override public void accept(List<? extends Command> t, Throwable u) { runningFutures.remove(codeActions); UIJob job = new UIJob(menu.getDisplay(), Messages.updateCodeActions_menu) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (u != null) { final MenuItem item = new MenuItem(menu, SWT.NONE, index); item.setText(u.getMessage()); item.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEC_FIELD_ERROR)); item.setEnabled(false); } else if(t != null) { for (Command command : t) { if (command != null) { final MenuItem item = new MenuItem(menu, SWT.NONE, index); item.setText(command.getTitle()); item.setEnabled(false); } } } if (menu.getItemCount() == 1) { item.setText(Messages.codeActions_emptyMenu); }else { item.dispose(); } return Status.OK_STATUS; } }; job.schedule(); } }); } super.fill(menu, index); }