coc-sonarlint 0.0.17 → 0.0.19
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/lib/index.js +302 -47
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -12101,6 +12101,10 @@ var NeedCompilationDatabaseRequest;
|
|
|
12101
12101
|
"sonarlint/needCompilationDatabase"
|
|
12102
12102
|
);
|
|
12103
12103
|
})(NeedCompilationDatabaseRequest || (NeedCompilationDatabaseRequest = {}));
|
|
12104
|
+
var IsOpenInEditor;
|
|
12105
|
+
((IsOpenInEditor2) => {
|
|
12106
|
+
IsOpenInEditor2.type = new coc2.RequestType("sonarlint/isOpenInEditor");
|
|
12107
|
+
})(IsOpenInEditor || (IsOpenInEditor = {}));
|
|
12104
12108
|
var ShouldAnalyseFileCheck;
|
|
12105
12109
|
((ShouldAnalyseFileCheck2) => {
|
|
12106
12110
|
ShouldAnalyseFileCheck2.type = new coc2.RequestType("sonarlint/shouldAnalyseFile");
|
|
@@ -12313,7 +12317,7 @@ var DidCreateBinding;
|
|
|
12313
12317
|
// src/index.ts
|
|
12314
12318
|
var ChildProcess = __toESM(require("child_process"));
|
|
12315
12319
|
var import_coc3 = require("coc.nvim");
|
|
12316
|
-
var
|
|
12320
|
+
var coc14 = __toESM(require("coc.nvim"));
|
|
12317
12321
|
|
|
12318
12322
|
// src/settings/settings.ts
|
|
12319
12323
|
var import_coc = require("coc.nvim");
|
|
@@ -13756,6 +13760,235 @@ async function showCompilationDatabaseOptions(paths) {
|
|
|
13756
13760
|
return void 0;
|
|
13757
13761
|
}
|
|
13758
13762
|
|
|
13763
|
+
// src/util/showMessage.ts
|
|
13764
|
+
var coc12 = __toESM(require("coc.nvim"));
|
|
13765
|
+
async function showSslCertificateConfirmationDialog(cert) {
|
|
13766
|
+
const trust = "Trust";
|
|
13767
|
+
const dontTrust = "Don't trust";
|
|
13768
|
+
const fingerprints = cert.sha256Fingerprint === "" ? "" : `FINGERPRINTS
|
|
13769
|
+
|
|
13770
|
+
SHA-256:
|
|
13771
|
+
${cert.sha256Fingerprint}
|
|
13772
|
+
|
|
13773
|
+
SHA-1:
|
|
13774
|
+
${cert.sha1Fingerprint}
|
|
13775
|
+
`;
|
|
13776
|
+
const dialogResponse = await coc12.window.showWarningMessage(`
|
|
13777
|
+
SonarLint found untrusted server's certificate
|
|
13778
|
+
|
|
13779
|
+
Issued to:
|
|
13780
|
+
${cert.issuedTo}
|
|
13781
|
+
|
|
13782
|
+
Issued by:
|
|
13783
|
+
${cert.issuedBy}
|
|
13784
|
+
|
|
13785
|
+
VALIDITY PERIOD
|
|
13786
|
+
|
|
13787
|
+
Valid from: ${cert.validFrom}
|
|
13788
|
+
|
|
13789
|
+
Valid to: ${cert.validTo}
|
|
13790
|
+
|
|
13791
|
+
${fingerprints}
|
|
13792
|
+
If you trust the certificate, it will be saved in truststore ${cert.truststorePath}
|
|
13793
|
+
|
|
13794
|
+
Default password: changeit
|
|
13795
|
+
|
|
13796
|
+
Consider removing connection if you don't trust the certificate
|
|
13797
|
+
`, dontTrust, trust);
|
|
13798
|
+
return dialogResponse == trust;
|
|
13799
|
+
}
|
|
13800
|
+
|
|
13801
|
+
// src/settings/connectionsettings.ts
|
|
13802
|
+
var coc13 = __toESM(require("coc.nvim"));
|
|
13803
|
+
var SONARLINT_CATEGORY2 = "sonarlint";
|
|
13804
|
+
var CONNECTIONS_SECTION = "connectedMode.connections";
|
|
13805
|
+
var SONARQUBE = "sonarqube";
|
|
13806
|
+
var SONARCLOUD = "sonarcloud";
|
|
13807
|
+
var SONARQUBE_CONNECTIONS_CATEGORY = `${SONARLINT_CATEGORY2}.${CONNECTIONS_SECTION}.${SONARQUBE}`;
|
|
13808
|
+
var SONARCLOUD_CONNECTIONS_CATEGORY = `${SONARLINT_CATEGORY2}.${CONNECTIONS_SECTION}.${SONARCLOUD}`;
|
|
13809
|
+
var ConnectionSettingsService = class {
|
|
13810
|
+
constructor(client) {
|
|
13811
|
+
this.client = client;
|
|
13812
|
+
this.secretStorage = /* @__PURE__ */ new Map();
|
|
13813
|
+
this.connectionCheckResults = /* @__PURE__ */ new Map();
|
|
13814
|
+
const qubeConnections = this.getSonarQubeConnections();
|
|
13815
|
+
qubeConnections.forEach((connection) => {
|
|
13816
|
+
this.secretStorage.set(connection.serverUrl, connection.token);
|
|
13817
|
+
});
|
|
13818
|
+
const cloudConnections = this.getSonarCloudConnections();
|
|
13819
|
+
cloudConnections.forEach((connection) => {
|
|
13820
|
+
this.secretStorage.set(connection.organizationKey, connection.token);
|
|
13821
|
+
});
|
|
13822
|
+
}
|
|
13823
|
+
async storeUpdatedConnectionToken(connection, token) {
|
|
13824
|
+
const tokenStorageKey = getTokenStorageKey(connection);
|
|
13825
|
+
const existingToken = this.secretStorage.get(tokenStorageKey);
|
|
13826
|
+
if (token && (!existingToken || existingToken !== token)) {
|
|
13827
|
+
await this.storeServerToken(tokenStorageKey, token);
|
|
13828
|
+
return true;
|
|
13829
|
+
}
|
|
13830
|
+
return false;
|
|
13831
|
+
}
|
|
13832
|
+
async storeServerToken(serverUrlOrOrganizationKey, token) {
|
|
13833
|
+
if (token) {
|
|
13834
|
+
this.secretStorage.set(serverUrlOrOrganizationKey, token);
|
|
13835
|
+
}
|
|
13836
|
+
}
|
|
13837
|
+
async getServerToken(serverUrlOrOrganizationKey) {
|
|
13838
|
+
return this.secretStorage.get(serverUrlOrOrganizationKey);
|
|
13839
|
+
}
|
|
13840
|
+
async hasTokenForConnection(connection) {
|
|
13841
|
+
return this.hasTokenForServer(getTokenStorageKey(connection));
|
|
13842
|
+
}
|
|
13843
|
+
async hasTokenForServer(serverUrlOrOrganizationKey) {
|
|
13844
|
+
try {
|
|
13845
|
+
const serverToken = await this.getServerToken(serverUrlOrOrganizationKey);
|
|
13846
|
+
return serverToken !== void 0;
|
|
13847
|
+
} catch (errorWhileFetchingToken) {
|
|
13848
|
+
return false;
|
|
13849
|
+
}
|
|
13850
|
+
}
|
|
13851
|
+
async deleteTokenForConnection(connection) {
|
|
13852
|
+
return this.deleteTokenForServer(getTokenStorageKey(connection));
|
|
13853
|
+
}
|
|
13854
|
+
async deleteTokenForServer(serverUrlOrOrganizationKey) {
|
|
13855
|
+
return new Promise(() => {
|
|
13856
|
+
this.secretStorage.delete(serverUrlOrOrganizationKey);
|
|
13857
|
+
});
|
|
13858
|
+
}
|
|
13859
|
+
async addSonarQubeConnection(connection) {
|
|
13860
|
+
const connections = this.getSonarQubeConnections();
|
|
13861
|
+
const newConnection = { serverUrl: connection.serverUrl };
|
|
13862
|
+
if (connection.connectionId !== void 0) {
|
|
13863
|
+
newConnection.connectionId = connection.connectionId;
|
|
13864
|
+
}
|
|
13865
|
+
if (connection.disableNotifications) {
|
|
13866
|
+
newConnection.disableNotifications = true;
|
|
13867
|
+
}
|
|
13868
|
+
await this.storeUpdatedConnectionToken(connection, connection.token);
|
|
13869
|
+
connections.push(newConnection);
|
|
13870
|
+
await coc13.workspace.getConfiguration().update(SONARQUBE_CONNECTIONS_CATEGORY, connections);
|
|
13871
|
+
return newConnection.connectionId;
|
|
13872
|
+
}
|
|
13873
|
+
async updateSonarQubeConnection(connection) {
|
|
13874
|
+
const connections = this.getSonarQubeConnections();
|
|
13875
|
+
const connectionToUpdate = connections.find((c) => c.connectionId === connection.connectionId);
|
|
13876
|
+
if (!connectionToUpdate) {
|
|
13877
|
+
throw new Error(`Could not find connection '${connection.connectionId}' to update`);
|
|
13878
|
+
}
|
|
13879
|
+
connectionToUpdate.serverUrl = connection.serverUrl;
|
|
13880
|
+
if (connection.disableNotifications) {
|
|
13881
|
+
connectionToUpdate.disableNotifications = true;
|
|
13882
|
+
} else {
|
|
13883
|
+
delete connectionToUpdate.disableNotifications;
|
|
13884
|
+
}
|
|
13885
|
+
const didUpdateToken = await this.storeUpdatedConnectionToken(connection, connection.token);
|
|
13886
|
+
if (didUpdateToken && connection.connectionId && connection.token) {
|
|
13887
|
+
await this.client.onTokenUpdate(connection.connectionId, connection.token);
|
|
13888
|
+
}
|
|
13889
|
+
delete connectionToUpdate.token;
|
|
13890
|
+
this.setSonarQubeConnections(connections);
|
|
13891
|
+
}
|
|
13892
|
+
getSonarQubeConnections() {
|
|
13893
|
+
return coc13.workspace.getConfiguration(SONARLINT_CATEGORY2).get(`${CONNECTIONS_SECTION}.${SONARQUBE}`) || [];
|
|
13894
|
+
}
|
|
13895
|
+
setSonarQubeConnections(sqConnections) {
|
|
13896
|
+
coc13.workspace.getConfiguration().update(SONARQUBE_CONNECTIONS_CATEGORY, sqConnections, coc13.ConfigurationTarget.Global);
|
|
13897
|
+
}
|
|
13898
|
+
getSonarCloudConnections() {
|
|
13899
|
+
return coc13.workspace.getConfiguration(SONARLINT_CATEGORY2).get(`${CONNECTIONS_SECTION}.${SONARCLOUD}`) || [];
|
|
13900
|
+
}
|
|
13901
|
+
setSonarCloudConnections(scConnections) {
|
|
13902
|
+
coc13.workspace.getConfiguration().update(SONARCLOUD_CONNECTIONS_CATEGORY, scConnections);
|
|
13903
|
+
}
|
|
13904
|
+
async addSonarCloudConnection(connection) {
|
|
13905
|
+
const connections = this.getSonarCloudConnections();
|
|
13906
|
+
const newConnection = { organizationKey: connection.organizationKey };
|
|
13907
|
+
if (connection.connectionId !== void 0) {
|
|
13908
|
+
newConnection.connectionId = connection.connectionId;
|
|
13909
|
+
}
|
|
13910
|
+
if (connection.disableNotifications) {
|
|
13911
|
+
newConnection.disableNotifications = true;
|
|
13912
|
+
}
|
|
13913
|
+
await this.storeUpdatedConnectionToken(connection, connection.token);
|
|
13914
|
+
connections.push(newConnection);
|
|
13915
|
+
}
|
|
13916
|
+
async updateSonarCloudConnection(connection) {
|
|
13917
|
+
const connections = this.getSonarCloudConnections();
|
|
13918
|
+
const connectionToUpdate = connections.find((c) => c.connectionId === connection.connectionId);
|
|
13919
|
+
if (!connectionToUpdate) {
|
|
13920
|
+
throw new Error(`Could not find connection '${connection.connectionId}' to update`);
|
|
13921
|
+
}
|
|
13922
|
+
connectionToUpdate.organizationKey = connection.organizationKey;
|
|
13923
|
+
if (connection.disableNotifications) {
|
|
13924
|
+
connectionToUpdate.disableNotifications = true;
|
|
13925
|
+
} else {
|
|
13926
|
+
delete connectionToUpdate.disableNotifications;
|
|
13927
|
+
}
|
|
13928
|
+
const didUpdateToken = await this.storeUpdatedConnectionToken(connection, connection.token);
|
|
13929
|
+
if (didUpdateToken && connection.connectionId && connection.token) {
|
|
13930
|
+
await this.client.onTokenUpdate(connection.connectionId, connection.token);
|
|
13931
|
+
}
|
|
13932
|
+
delete connectionToUpdate.token;
|
|
13933
|
+
coc13.workspace.getConfiguration().update(SONARCLOUD_CONNECTIONS_CATEGORY, connections, coc13.ConfigurationTarget.Global);
|
|
13934
|
+
}
|
|
13935
|
+
async addTokensFromSettingsToSecureStorage(sqConnections, scConnections) {
|
|
13936
|
+
await Promise.all(
|
|
13937
|
+
[...sqConnections, ...scConnections].map(async (c) => {
|
|
13938
|
+
if (c.token !== void 0 && !await this.hasTokenForConnection(c)) {
|
|
13939
|
+
await this.storeUpdatedConnectionToken(c, c.token);
|
|
13940
|
+
c.token = void 0;
|
|
13941
|
+
}
|
|
13942
|
+
})
|
|
13943
|
+
);
|
|
13944
|
+
await updateConfigIfNotEmpty(sqConnections, SONARQUBE_CONNECTIONS_CATEGORY);
|
|
13945
|
+
await updateConfigIfNotEmpty(scConnections, SONARCLOUD_CONNECTIONS_CATEGORY);
|
|
13946
|
+
}
|
|
13947
|
+
async loadSonarQubeConnection(connectionId) {
|
|
13948
|
+
const allSonarQubeConnections = this.getSonarQubeConnections();
|
|
13949
|
+
const loadedConnection = allSonarQubeConnections.find((c) => c.connectionId === connectionId);
|
|
13950
|
+
if (loadedConnection) {
|
|
13951
|
+
loadedConnection.token = await this.getServerToken(loadedConnection.serverUrl);
|
|
13952
|
+
}
|
|
13953
|
+
return loadedConnection;
|
|
13954
|
+
}
|
|
13955
|
+
async loadSonarCloudConnection(connectionId) {
|
|
13956
|
+
const allSonarCloudConnections = this.getSonarCloudConnections();
|
|
13957
|
+
const loadedConnection = allSonarCloudConnections.find((c) => c.connectionId === connectionId);
|
|
13958
|
+
if (loadedConnection) {
|
|
13959
|
+
loadedConnection.token = await this.getServerToken(loadedConnection.organizationKey);
|
|
13960
|
+
}
|
|
13961
|
+
return loadedConnection;
|
|
13962
|
+
}
|
|
13963
|
+
async generateToken(baseServerUrl) {
|
|
13964
|
+
const { token } = await this.client.generateToken(baseServerUrl);
|
|
13965
|
+
if (!token) {
|
|
13966
|
+
coc13.window.showWarningMessage(`Could not automatically generate server token for generation params: ${baseServerUrl}`);
|
|
13967
|
+
}
|
|
13968
|
+
return token;
|
|
13969
|
+
}
|
|
13970
|
+
async checkNewConnection(token, serverOrOrganization, isSonarQube) {
|
|
13971
|
+
return this.client.checkNewConnection(token, serverOrOrganization, isSonarQube);
|
|
13972
|
+
}
|
|
13973
|
+
reportConnectionCheckResult(connectionCheckResult) {
|
|
13974
|
+
this.connectionCheckResults.set(connectionCheckResult.connectionId, connectionCheckResult);
|
|
13975
|
+
}
|
|
13976
|
+
getStatusForConnection(connectionId) {
|
|
13977
|
+
return this.connectionCheckResults.get(connectionId);
|
|
13978
|
+
}
|
|
13979
|
+
};
|
|
13980
|
+
function isSonarQubeConnection(connection) {
|
|
13981
|
+
return connection.serverUrl !== void 0;
|
|
13982
|
+
}
|
|
13983
|
+
function getTokenStorageKey(connection) {
|
|
13984
|
+
return isSonarQubeConnection(connection) ? connection.serverUrl : connection.organizationKey;
|
|
13985
|
+
}
|
|
13986
|
+
async function updateConfigIfNotEmpty(connections, configCategory) {
|
|
13987
|
+
if (connections.length > 0) {
|
|
13988
|
+
await coc13.workspace.getConfiguration().update(configCategory, connections);
|
|
13989
|
+
}
|
|
13990
|
+
}
|
|
13991
|
+
|
|
13759
13992
|
// src/index.ts
|
|
13760
13993
|
var DOCUMENT_SELECTOR = [
|
|
13761
13994
|
{
|
|
@@ -13771,14 +14004,15 @@ var DOCUMENT_SELECTOR = [
|
|
|
13771
14004
|
}
|
|
13772
14005
|
];
|
|
13773
14006
|
var languageClient;
|
|
14007
|
+
var connectionSettingsService;
|
|
13774
14008
|
var allRulesTreeDataProvider;
|
|
13775
14009
|
var allRulesView;
|
|
13776
14010
|
var floatDescriptionFactory;
|
|
13777
14011
|
async function runJavaServer(context) {
|
|
13778
14012
|
return resolveRequirements(context).catch((error) => {
|
|
13779
|
-
|
|
14013
|
+
coc14.window.showErrorMessage(error.message, error.label).then((selection) => {
|
|
13780
14014
|
if (error.label && error.label === selection && error.command) {
|
|
13781
|
-
|
|
14015
|
+
coc14.commands.executeCommand(error.command, error.commandParam);
|
|
13782
14016
|
}
|
|
13783
14017
|
});
|
|
13784
14018
|
throw error;
|
|
@@ -13805,8 +14039,8 @@ async function activate(context) {
|
|
|
13805
14039
|
setExtensionContext(context);
|
|
13806
14040
|
initLogOutput(context);
|
|
13807
14041
|
const serverOptions = () => runJavaServer(context);
|
|
13808
|
-
const pythonWatcher =
|
|
13809
|
-
const sharedConnectedModeConfigurationWatcher =
|
|
14042
|
+
const pythonWatcher = coc14.workspace.createFileSystemWatcher("**/*.py");
|
|
14043
|
+
const sharedConnectedModeConfigurationWatcher = coc14.workspace.createFileSystemWatcher("**/.sonarlint/*.json");
|
|
13810
14044
|
context.subscriptions.push(pythonWatcher);
|
|
13811
14045
|
context.subscriptions.push(sharedConnectedModeConfigurationWatcher);
|
|
13812
14046
|
const clientOptions = {
|
|
@@ -13821,10 +14055,10 @@ async function activate(context) {
|
|
|
13821
14055
|
productKey: "vscode",
|
|
13822
14056
|
productName: "SonarLint",
|
|
13823
14057
|
productVersion: "1.0.0",
|
|
13824
|
-
showVerboseLogs:
|
|
14058
|
+
showVerboseLogs: coc14.workspace.getConfiguration().get("sonarlint.output.showVerboseLogs", false),
|
|
13825
14059
|
platform: getPlatform2(),
|
|
13826
14060
|
architecture: process.arch,
|
|
13827
|
-
clientNodePath:
|
|
14061
|
+
clientNodePath: coc14.workspace.getConfiguration().get("sonarlint.pathToNodeExecutable")
|
|
13828
14062
|
};
|
|
13829
14063
|
},
|
|
13830
14064
|
outputChannel: getLogOutput(),
|
|
@@ -13836,13 +14070,14 @@ async function activate(context) {
|
|
|
13836
14070
|
serverOptions,
|
|
13837
14071
|
clientOptions
|
|
13838
14072
|
);
|
|
14073
|
+
connectionSettingsService = new ConnectionSettingsService(languageClient);
|
|
13839
14074
|
await languageClient.start();
|
|
13840
|
-
|
|
14075
|
+
coc14.services.registerLanguageClient(languageClient);
|
|
13841
14076
|
allRulesTreeDataProvider = new AllRulesTreeDataProvider(
|
|
13842
14077
|
() => languageClient.listAllRules(),
|
|
13843
14078
|
/* @__PURE__ */ new Map()
|
|
13844
14079
|
);
|
|
13845
|
-
allRulesView =
|
|
14080
|
+
allRulesView = coc14.window.createTreeView("Sonarlint rules", {
|
|
13846
14081
|
bufhidden: "hide",
|
|
13847
14082
|
treeDataProvider: allRulesTreeDataProvider
|
|
13848
14083
|
});
|
|
@@ -13860,14 +14095,14 @@ async function activate(context) {
|
|
|
13860
14095
|
});
|
|
13861
14096
|
context.subscriptions.push(floatDescriptionFactory);
|
|
13862
14097
|
installCustomRequestHandlers();
|
|
13863
|
-
|
|
14098
|
+
coc14.workspace.onDidChangeConfiguration(async (event) => {
|
|
13864
14099
|
if (event.affectsConfiguration("sonarlint.rules")) {
|
|
13865
14100
|
allRulesTreeDataProvider.refresh();
|
|
13866
14101
|
}
|
|
13867
14102
|
});
|
|
13868
14103
|
registerCommands(context);
|
|
13869
14104
|
context.subscriptions.push(
|
|
13870
|
-
|
|
14105
|
+
coc14.extensions.onDidActiveExtension(() => {
|
|
13871
14106
|
installClasspathListener(languageClient);
|
|
13872
14107
|
})
|
|
13873
14108
|
);
|
|
@@ -13875,54 +14110,54 @@ async function activate(context) {
|
|
|
13875
14110
|
}
|
|
13876
14111
|
function registerCommands(context) {
|
|
13877
14112
|
context.subscriptions.push(
|
|
13878
|
-
|
|
14113
|
+
coc14.commands.registerCommand(Commands.SHOW_ALL_LOCATIONS, showAllLocations)
|
|
13879
14114
|
);
|
|
13880
14115
|
context.subscriptions.push(
|
|
13881
|
-
|
|
14116
|
+
coc14.commands.registerCommand(Commands.CLEAR_LOCATIONS, clearLocations)
|
|
13882
14117
|
);
|
|
13883
14118
|
context.subscriptions.push(
|
|
13884
|
-
|
|
14119
|
+
coc14.commands.registerCommand(Commands.DEACTIVATE_RULE, toggleRule("off"))
|
|
13885
14120
|
);
|
|
13886
14121
|
context.subscriptions.push(
|
|
13887
|
-
|
|
14122
|
+
coc14.commands.registerCommand(Commands.ACTIVATE_RULE, toggleRule("on"))
|
|
13888
14123
|
);
|
|
13889
14124
|
context.subscriptions.push(
|
|
13890
|
-
|
|
14125
|
+
coc14.commands.registerCommand(Commands.TOGGLE_RULE, toggleRule())
|
|
13891
14126
|
);
|
|
13892
14127
|
context.subscriptions.push(
|
|
13893
|
-
|
|
14128
|
+
coc14.commands.registerCommand(Commands.SHOW_ALL_RULES, async () => {
|
|
13894
14129
|
allRulesTreeDataProvider.filter();
|
|
13895
14130
|
await showRulesView("Sonarlint all rules");
|
|
13896
14131
|
})
|
|
13897
14132
|
);
|
|
13898
14133
|
context.subscriptions.push(
|
|
13899
|
-
|
|
14134
|
+
coc14.commands.registerCommand(Commands.SHOW_ACTIVE_RULES, async () => {
|
|
13900
14135
|
allRulesTreeDataProvider.filter("on");
|
|
13901
14136
|
await showRulesView("Sonarlint active rules");
|
|
13902
14137
|
})
|
|
13903
14138
|
);
|
|
13904
14139
|
context.subscriptions.push(
|
|
13905
|
-
|
|
14140
|
+
coc14.commands.registerCommand(Commands.SHOW_INACTIVE_RULES, async () => {
|
|
13906
14141
|
allRulesTreeDataProvider.filter("off");
|
|
13907
14142
|
await showRulesView("Sonarlint inactive rules");
|
|
13908
14143
|
})
|
|
13909
14144
|
);
|
|
13910
14145
|
context.subscriptions.push(
|
|
13911
|
-
|
|
14146
|
+
coc14.commands.registerCommand(
|
|
13912
14147
|
Commands.OPEN_RULE_BY_KEY,
|
|
13913
14148
|
async (ruleKey) => {
|
|
13914
14149
|
if (!ruleKey || ruleKey.length == 0) {
|
|
13915
|
-
|
|
14150
|
+
coc14.window.showWarningMessage(`Provided rule key was emtpy or was invalid`);
|
|
13916
14151
|
return;
|
|
13917
14152
|
}
|
|
13918
14153
|
allRulesTreeDataProvider.filter();
|
|
13919
14154
|
await showRulesView(`Sonarlint rules for rule ${ruleKey}`);
|
|
13920
14155
|
const indexOfSeparator = ruleKey.indexOf(":");
|
|
13921
14156
|
const language = indexOfSeparator > 0 ? ruleKey.substring(0, indexOfSeparator) : null;
|
|
13922
|
-
const type = indexOfSeparator > 0 && language ? new RuleNode({ key: languageKeyDeNormalization(language) + ":" + ruleKey.substring(indexOfSeparator + 1).toLowerCase() }, language) : new LanguageNode(ruleKey,
|
|
14157
|
+
const type = indexOfSeparator > 0 && language ? new RuleNode({ key: languageKeyDeNormalization(language) + ":" + ruleKey.substring(indexOfSeparator + 1).toLowerCase() }, language) : new LanguageNode(ruleKey, coc14.TreeItemCollapsibleState.Collapsed);
|
|
13923
14158
|
let node = await allRulesTreeDataProvider.getTreeItem(type);
|
|
13924
14159
|
if (type instanceof RuleNode && language) {
|
|
13925
|
-
const pnode = new LanguageNode(language.toLowerCase(),
|
|
14160
|
+
const pnode = new LanguageNode(language.toLowerCase(), coc14.TreeItemCollapsibleState.Expanded);
|
|
13926
14161
|
allRulesTreeDataProvider.register(pnode);
|
|
13927
14162
|
if (node === type) {
|
|
13928
14163
|
await allRulesTreeDataProvider.getChildren(pnode);
|
|
@@ -13930,17 +14165,17 @@ function registerCommands(context) {
|
|
|
13930
14165
|
}
|
|
13931
14166
|
await allRulesView?.reveal(node, { select: true, focus: true, expand: true });
|
|
13932
14167
|
} else if (type instanceof LanguageNode) {
|
|
13933
|
-
node.collapsibleState =
|
|
14168
|
+
node.collapsibleState = coc14.TreeItemCollapsibleState.Expanded;
|
|
13934
14169
|
allRulesTreeDataProvider.register(node);
|
|
13935
14170
|
await allRulesView?.reveal(node, { select: true, focus: true, expand: true });
|
|
13936
14171
|
} else {
|
|
13937
|
-
|
|
14172
|
+
coc14.window.showWarningMessage(`Unable to find or resolve rule id ${ruleKey}`);
|
|
13938
14173
|
}
|
|
13939
14174
|
}
|
|
13940
14175
|
)
|
|
13941
14176
|
);
|
|
13942
14177
|
context.subscriptions.push(
|
|
13943
|
-
|
|
14178
|
+
coc14.commands.registerCommand(
|
|
13944
14179
|
Commands.SHOW_HOTSPOT_RULE_DESCRIPTION,
|
|
13945
14180
|
(hotspot) => languageClient.showHotspotRuleDescription(
|
|
13946
14181
|
hotspot.ruleKey,
|
|
@@ -13950,32 +14185,32 @@ function registerCommands(context) {
|
|
|
13950
14185
|
)
|
|
13951
14186
|
);
|
|
13952
14187
|
context.subscriptions.push(
|
|
13953
|
-
|
|
13954
|
-
const key = await
|
|
13955
|
-
await
|
|
14188
|
+
coc14.commands.registerCommand(Commands.FIND_RULE_BY_KEY, async () => {
|
|
14189
|
+
const key = await coc14.window.requestInput("Enter rule key", "");
|
|
14190
|
+
await coc14.commands.executeCommand(Commands.OPEN_RULE_BY_KEY, key);
|
|
13956
14191
|
})
|
|
13957
14192
|
);
|
|
13958
14193
|
context.subscriptions.push(
|
|
13959
|
-
|
|
14194
|
+
coc14.commands.registerCommand(
|
|
13960
14195
|
Commands.SHOW_SONARLINT_OUTPUT,
|
|
13961
14196
|
() => showLogOutput()
|
|
13962
14197
|
)
|
|
13963
14198
|
);
|
|
13964
14199
|
context.subscriptions.push(
|
|
13965
|
-
|
|
14200
|
+
coc14.commands.registerCommand(
|
|
13966
14201
|
Commands.CONFIGURE_COMPILATION_DATABASE,
|
|
13967
14202
|
() => void configureCompilationDatabase()
|
|
13968
14203
|
)
|
|
13969
14204
|
);
|
|
13970
14205
|
context.subscriptions.push(
|
|
13971
|
-
|
|
14206
|
+
coc14.commands.registerCommand(Commands.ENABLE_VERBOSE_LOGS, () => updateVerboseLogging(true))
|
|
13972
14207
|
);
|
|
13973
14208
|
context.subscriptions.push(
|
|
13974
|
-
|
|
14209
|
+
coc14.commands.registerCommand(Commands.INSTALL_MANAGED_JRE, () => {
|
|
13975
14210
|
installManagedJre(context, function() {
|
|
13976
|
-
|
|
14211
|
+
coc14.window.showInformationMessage(`Downloaded & installed a managed jre`);
|
|
13977
14212
|
}, function() {
|
|
13978
|
-
|
|
14213
|
+
coc14.window.showErrorMessage(`Unable to download managed jre`);
|
|
13979
14214
|
});
|
|
13980
14215
|
})
|
|
13981
14216
|
);
|
|
@@ -13987,7 +14222,7 @@ function installCustomRequestHandlers() {
|
|
|
13987
14222
|
);
|
|
13988
14223
|
languageClient.onRequest(ListFilesInFolderRequest.type, (params) => {
|
|
13989
14224
|
const files = [];
|
|
13990
|
-
const ignored =
|
|
14225
|
+
const ignored = coc14.workspace.getConfiguration().get("sonarlint.listFilesFoldersExclusions", []);
|
|
13991
14226
|
const folderCrawler = (dir) => {
|
|
13992
14227
|
let elements = [];
|
|
13993
14228
|
try {
|
|
@@ -14012,7 +14247,7 @@ function installCustomRequestHandlers() {
|
|
|
14012
14247
|
}
|
|
14013
14248
|
}
|
|
14014
14249
|
};
|
|
14015
|
-
folderCrawler(
|
|
14250
|
+
folderCrawler(coc14.Uri.parse(params.folderUri).fsPath);
|
|
14016
14251
|
return { foundFiles: files };
|
|
14017
14252
|
});
|
|
14018
14253
|
languageClient.onRequest(
|
|
@@ -14031,6 +14266,26 @@ function installCustomRequestHandlers() {
|
|
|
14031
14266
|
ShouldAnalyseFileCheck.type,
|
|
14032
14267
|
(params) => shouldAnalyseFile(params.uri)
|
|
14033
14268
|
);
|
|
14269
|
+
languageClient.onRequest(
|
|
14270
|
+
(void 0).type,
|
|
14271
|
+
(fileUri) => isOpenInEditor(fileUri)
|
|
14272
|
+
);
|
|
14273
|
+
languageClient.onRequest(
|
|
14274
|
+
SslCertificateConfirmation.type,
|
|
14275
|
+
(cert) => showSslCertificateConfirmationDialog(cert)
|
|
14276
|
+
);
|
|
14277
|
+
languageClient.onRequest(
|
|
14278
|
+
GetTokenForServer.type,
|
|
14279
|
+
(serverId) => connectionSettingsService.getServerToken(serverId)
|
|
14280
|
+
);
|
|
14281
|
+
languageClient.onNotification(ReportConnectionCheckResult.type, (result) => {
|
|
14282
|
+
connectionSettingsService.reportConnectionCheckResult(result);
|
|
14283
|
+
if (result.success) {
|
|
14284
|
+
coc14.window.showInformationMessage(`Connection for sonar qube/cloud with id '${result.connectionId}' was successful!`);
|
|
14285
|
+
} else {
|
|
14286
|
+
coc14.window.showErrorMessage(`Connection with id '${result.connectionId}' failed, due to ${result.reason}. Please check your settings.`);
|
|
14287
|
+
}
|
|
14288
|
+
});
|
|
14034
14289
|
languageClient.onRequest(
|
|
14035
14290
|
CanShowMissingRequirementNotification.type,
|
|
14036
14291
|
() => {
|
|
@@ -14039,24 +14294,24 @@ function installCustomRequestHandlers() {
|
|
|
14039
14294
|
);
|
|
14040
14295
|
languageClient.onNotification(
|
|
14041
14296
|
ShowSonarLintOutputNotification.type,
|
|
14042
|
-
() => void
|
|
14297
|
+
() => void coc14.commands.executeCommand(Commands.SHOW_SONARLINT_OUTPUT)
|
|
14043
14298
|
);
|
|
14044
14299
|
languageClient.onNotification(
|
|
14045
14300
|
OpenJavaHomeSettingsNotification.type,
|
|
14046
|
-
() => void
|
|
14301
|
+
() => void coc14.commands.executeCommand(Commands.OPEN_SETTINGS, JAVA_HOME_CONFIG)
|
|
14047
14302
|
);
|
|
14048
14303
|
languageClient.onNotification(
|
|
14049
14304
|
OpenPathToNodeSettingsNotification.type,
|
|
14050
|
-
() => void
|
|
14305
|
+
() => void coc14.commands.executeCommand(
|
|
14051
14306
|
Commands.OPEN_SETTINGS,
|
|
14052
14307
|
"sonarlint.pathToNodeExecutable"
|
|
14053
14308
|
)
|
|
14054
14309
|
);
|
|
14055
14310
|
languageClient.onNotification(
|
|
14056
14311
|
BrowseToNotification.type,
|
|
14057
|
-
(browseTo) => void
|
|
14312
|
+
(browseTo) => void coc14.commands.executeCommand(
|
|
14058
14313
|
Commands.OPEN_BROWSER,
|
|
14059
|
-
|
|
14314
|
+
coc14.Uri.parse(browseTo)
|
|
14060
14315
|
)
|
|
14061
14316
|
);
|
|
14062
14317
|
if (isNotificationEnabled() !== false) {
|
|
@@ -14084,18 +14339,18 @@ async function showAllLocations(issue) {
|
|
|
14084
14339
|
locations.push({ uri: loc.uri, range });
|
|
14085
14340
|
})
|
|
14086
14341
|
);
|
|
14087
|
-
const quickFixList = await
|
|
14088
|
-
await
|
|
14089
|
-
let openCommand = await
|
|
14342
|
+
const quickFixList = await coc14.workspace.getQuickfixList(locations);
|
|
14343
|
+
await coc14.nvim.call("setqflist", [quickFixList]);
|
|
14344
|
+
let openCommand = await coc14.nvim.getVar(
|
|
14090
14345
|
"coc_quickfix_open_command"
|
|
14091
14346
|
);
|
|
14092
|
-
|
|
14347
|
+
coc14.nvim.command(
|
|
14093
14348
|
typeof openCommand === "string" ? openCommand : "copen",
|
|
14094
14349
|
true
|
|
14095
14350
|
);
|
|
14096
14351
|
}
|
|
14097
14352
|
async function clearLocations() {
|
|
14098
|
-
await
|
|
14353
|
+
await coc14.nvim.call("setqflist", [[], "r"]);
|
|
14099
14354
|
}
|
|
14100
14355
|
function deactivate() {
|
|
14101
14356
|
if (!languageClient) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-sonarlint",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Coc sonar lint language server extension client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -309,7 +309,7 @@
|
|
|
309
309
|
"sonarlint.listFilesFoldersExclusions": {
|
|
310
310
|
"order": 13,
|
|
311
311
|
"type": "array",
|
|
312
|
-
"default": [
|
|
312
|
+
"default": [
|
|
313
313
|
"node_modules",
|
|
314
314
|
"target",
|
|
315
315
|
".settings",
|