sdedic commented on code in PR #7555:
URL: https://github.com/apache/netbeans/pull/7555#discussion_r1671022054
##########
java/java.lsp.server/vscode/src/jdk/validation/extensionUtils.ts:
##########
@@ -0,0 +1,18 @@
+import * as vscode from 'vscode';
+import { client as nblsClient } from '../../extension';
+
+const RH_EXTENSION_ID = 'redhat.java';
+
+export function isRHExtensionActive(): boolean {
+ const rh = vscode.extensions.getExtension(RH_EXTENSION_ID);
+ return rh ? true : false;
+}
+
+export async function waitForNblsCommandToBeAvailable(command: string) {
+ await nblsClient;
+ const commands = await vscode.commands.getCommands();
+
+ if (!commands.includes(command)) {
Review Comment:
The check for a particular command seems no longer needed .... the client
will either start and the promise fullfills, or the client fails, the promise
fais - which causes `await nblsClient` to throw an error on itself. If the
client initializes, but fails to register the command for whatever reason,
vscode's `commands.executeCommand()` will throw an error. So no other explicit
throw is necessary, IMHO.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists