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