coc-sonarlint 0.0.0-development → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Svetlozar Iliev
3
+ Copyright (c) 2022 asmodeus812
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -90,7 +90,7 @@ Note: if you are using Microsoft compiler, the environment should be ready to bu
90
90
 
91
91
  ### Java analysis specific requirements
92
92
 
93
- To enable the support for Java analysis, you need the coc-java extension
93
+ To enable the support for Java analysis, you need the coc-java or any coc-java compliant extension
94
94
 
95
95
  ### Jupyter notebooks
96
96
 
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -4978,6 +4977,10 @@ var javaApiTooLowAlreadyLogged = false;
4978
4977
  var javaServerInLightWeightModeAlreadyLogged = false;
4979
4978
  function installClasspathListener(languageClient2) {
4980
4979
  const extension2 = getJavaExtension();
4980
+ if (!extension2) {
4981
+ coc8.window.showWarningMessage(`Unable to find any compliant java extension installed in the coc runtime`);
4982
+ return;
4983
+ }
4981
4984
  if (extension2?.isActive) {
4982
4985
  if (!classpathChangeListener) {
4983
4986
  const extensionApi = extension2.exports;
@@ -4990,11 +4993,9 @@ function installClasspathListener(languageClient2) {
4990
4993
  logToSonarLintOutput(`Installed classpath listener for java`);
4991
4994
  }
4992
4995
  }
4993
- } else {
4994
- if (classpathChangeListener) {
4995
- classpathChangeListener.dispose();
4996
- classpathChangeListener = void 0;
4997
- }
4996
+ } else if (classpathChangeListener) {
4997
+ classpathChangeListener.dispose();
4998
+ classpathChangeListener = void 0;
4998
4999
  }
4999
5000
  }
5000
5001
  function newServerModeChangeListener(languageClient2) {
@@ -5019,11 +5020,9 @@ function installServerModeChangeListener(languageClient2) {
5019
5020
  }
5020
5021
  logToSonarLintOutput(`Installed server mode listener for java`);
5021
5022
  }
5022
- } else {
5023
- if (serverModeListener) {
5024
- serverModeListener.dispose();
5025
- serverModeListener = void 0;
5026
- }
5023
+ } else if (serverModeListener) {
5024
+ serverModeListener.dispose();
5025
+ serverModeListener = void 0;
5027
5026
  }
5028
5027
  }
5029
5028
  function isJavaApiRecentEnough(apiVersion) {
@@ -5041,6 +5040,10 @@ function isJavaApiRecentEnough(apiVersion) {
5041
5040
  async function getJavaConfig(languageClient2, fileUri) {
5042
5041
  const extension2 = getJavaExtension();
5043
5042
  try {
5043
+ if (!extension2) {
5044
+ coc8.window.showWarningMessage(`Unable to find any compliant java extension installed in the coc runtime`);
5045
+ return;
5046
+ }
5044
5047
  const extensionApi = await extension2?.activate();
5045
5048
  if (extensionApi && isJavaApiRecentEnough(extensionApi.apiVersion)) {
5046
5049
  installClasspathListener(languageClient2);
@@ -5069,7 +5072,7 @@ async function getJavaConfig(languageClient2, fileUri) {
5069
5072
  };
5070
5073
  }
5071
5074
  } catch (error) {
5072
- console.error(error);
5075
+ coc8.window.showErrorMessage(JSON.stringify(error));
5073
5076
  }
5074
5077
  }
5075
5078
  function javaConfigDisabledInLightWeightMode() {
@@ -5082,7 +5085,11 @@ function javaConfigDisabledInLightWeightMode() {
5082
5085
  return void 0;
5083
5086
  }
5084
5087
  function getJavaExtension() {
5085
- return coc8.extensions.getExtensionById("coc-java");
5088
+ const java = coc8.extensions.getExtensionById("coc-java");
5089
+ if (!java || java == null || java === void 0) {
5090
+ return coc8.extensions.getExtensionById("coc-java-dev");
5091
+ }
5092
+ return java;
5086
5093
  }
5087
5094
 
5088
5095
  // src/rules/rulepanel.ts
@@ -5496,22 +5503,22 @@ function installCustomRequestHandlers(context) {
5496
5503
  );
5497
5504
  languageClient.onNotification(
5498
5505
  ShowSonarLintOutputNotification.type,
5499
- () => coc11.commands.executeCommand(Commands.SHOW_SONARLINT_OUTPUT)
5506
+ () => void coc11.commands.executeCommand(Commands.SHOW_SONARLINT_OUTPUT)
5500
5507
  );
5501
5508
  languageClient.onNotification(
5502
5509
  OpenJavaHomeSettingsNotification.type,
5503
- () => coc11.commands.executeCommand(Commands.OPEN_SETTINGS, JAVA_HOME_CONFIG)
5510
+ () => void coc11.commands.executeCommand(Commands.OPEN_SETTINGS, JAVA_HOME_CONFIG)
5504
5511
  );
5505
5512
  languageClient.onNotification(
5506
5513
  OpenPathToNodeSettingsNotification.type,
5507
- () => coc11.commands.executeCommand(
5514
+ () => void coc11.commands.executeCommand(
5508
5515
  Commands.OPEN_SETTINGS,
5509
5516
  "sonarlint.pathToNodeExecutable"
5510
5517
  )
5511
5518
  );
5512
5519
  languageClient.onNotification(
5513
5520
  BrowseToNotification.type,
5514
- (browseTo) => coc11.commands.executeCommand(
5521
+ (browseTo) => void coc11.commands.executeCommand(
5515
5522
  Commands.OPEN_BROWSER,
5516
5523
  coc11.Uri.parse(browseTo)
5517
5524
  )
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "coc-sonarlint",
3
- "version": "0.0.0-development",
3
+ "version": "0.0.2",
4
4
  "description": "sonarlint for coc.nvim",
5
- "author": "Svetlozar Iliev <svetlozar321@gmail.com>",
5
+ "author": "asmodeus812 <svetlozar321@gmail.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/index.js",
8
8
  "keywords": [