coc-sonarlint 0.0.3 → 0.0.4

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.
Files changed (2) hide show
  1. package/lib/index.js +250 -211
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -3789,7 +3789,7 @@ module.exports = __toCommonJS(src_exports);
3789
3789
  var import_path = __toESM(require("path"));
3790
3790
 
3791
3791
  // src/util/util.ts
3792
- var vscode = __toESM(require("coc.nvim"));
3792
+ var coc = __toESM(require("coc.nvim"));
3793
3793
  var ANALYSIS_EXCLUDES = "sonarlint.analysisExcludesStandalone";
3794
3794
  function startedInDebugMode(process2) {
3795
3795
  const args = process2.execArgv;
@@ -3798,7 +3798,7 @@ function startedInDebugMode(process2) {
3798
3798
  }
3799
3799
  return false;
3800
3800
  }
3801
- var extension = vscode.extensions.getExtensionById("SonarSource.sonarlint-vscode");
3801
+ var extension = coc.extensions.getExtensionById("SonarSource.sonarlint-vscode");
3802
3802
  var packageJson = extension?.packageJSON;
3803
3803
  var extensionPath;
3804
3804
  var extensionContext;
@@ -3864,327 +3864,327 @@ function shouldAnalyseFile(fileUriStr) {
3864
3864
  if (!isOpen) {
3865
3865
  return { shouldBeAnalysed: false, reason: "Skipping analysis for the file preview: " };
3866
3866
  }
3867
- const fileUri = vscode.Uri.parse(fileUriStr);
3868
- const workspaceFolderConfig = vscode.workspace.getConfiguration();
3867
+ const fileUri = coc.Uri.parse(fileUriStr);
3868
+ const workspaceFolderConfig = coc.workspace.getConfiguration();
3869
3869
  const excludes = workspaceFolderConfig.get(ANALYSIS_EXCLUDES);
3870
3870
  const excludesArray = excludes?.split(",").map((it) => it.trim());
3871
- const filteredFile = getFilesNotMatchedGlobPatterns([fileUri], excludesArray || []);
3871
+ const filteredFile = getFilesNotMatchedGlobPatterns([fileUri], excludesArray ?? []);
3872
3872
  return { shouldBeAnalysed: filteredFile.length === 1, reason: "Skipping analysis for the excluded file: " };
3873
3873
  }
3874
3874
  function filterOutFilesIgnoredForAnalysis(fileUris) {
3875
- const workspaceFolderConfig = vscode.workspace.getConfiguration();
3875
+ const workspaceFolderConfig = coc.workspace.getConfiguration();
3876
3876
  const excludes = workspaceFolderConfig.get(ANALYSIS_EXCLUDES);
3877
3877
  const excludesArray = excludes?.split(",").map((it) => it.trim());
3878
- const filteredFiles = getFilesNotMatchedGlobPatterns(fileUris.map((it) => vscode.Uri.parse(it)), excludesArray || []).map((it) => it.toString());
3878
+ const filteredFiles = getFilesNotMatchedGlobPatterns(fileUris.map((it) => coc.Uri.parse(it)), excludesArray ?? []).map((it) => it.toString());
3879
3879
  return { fileUris: filteredFiles };
3880
3880
  }
3881
3881
  function isOpenInEditor(fileUri) {
3882
- const url = vscode.Uri.parse(fileUri);
3882
+ const url = coc.Uri.parse(fileUri);
3883
3883
  const codeFileUri = url.toString();
3884
- return vscode.workspace.textDocuments.some((d) => d.uri.toString() === codeFileUri);
3884
+ return coc.workspace.textDocuments.some((d) => d.uri.toString() === codeFileUri);
3885
3885
  }
3886
3886
 
3887
3887
  // src/lsp/protocol.ts
3888
- var coc = __toESM(require("coc.nvim"));
3888
+ var coc2 = __toESM(require("coc.nvim"));
3889
3889
  var ShowRuleDescriptionNotification;
3890
3890
  ((ShowRuleDescriptionNotification2) => {
3891
- ShowRuleDescriptionNotification2.type = new coc.NotificationType(
3891
+ ShowRuleDescriptionNotification2.type = new coc2.NotificationType(
3892
3892
  "sonarlint/showRuleDescription"
3893
3893
  );
3894
3894
  })(ShowRuleDescriptionNotification || (ShowRuleDescriptionNotification = {}));
3895
3895
  var SuggestBindingNotification;
3896
3896
  ((SuggestBindingNotification2) => {
3897
- SuggestBindingNotification2.type = new coc.NotificationType(
3897
+ SuggestBindingNotification2.type = new coc2.NotificationType(
3898
3898
  "sonarlint/suggestBinding"
3899
3899
  );
3900
3900
  })(SuggestBindingNotification || (SuggestBindingNotification = {}));
3901
3901
  var ListFilesInFolderRequest;
3902
3902
  ((ListFilesInFolderRequest2) => {
3903
- ListFilesInFolderRequest2.type = new coc.RequestType("sonarlint/listFilesInFolder");
3903
+ ListFilesInFolderRequest2.type = new coc2.RequestType("sonarlint/listFilesInFolder");
3904
3904
  })(ListFilesInFolderRequest || (ListFilesInFolderRequest = {}));
3905
3905
  var ShowHotspotRuleDescriptionNotification;
3906
3906
  ((ShowHotspotRuleDescriptionNotification2) => {
3907
- ShowHotspotRuleDescriptionNotification2.type = new coc.NotificationType(
3907
+ ShowHotspotRuleDescriptionNotification2.type = new coc2.NotificationType(
3908
3908
  "sonarlint/showHotspotRuleDescription"
3909
3909
  );
3910
3910
  })(ShowHotspotRuleDescriptionNotification || (ShowHotspotRuleDescriptionNotification = {}));
3911
3911
  var GetJavaConfigRequest;
3912
3912
  ((GetJavaConfigRequest2) => {
3913
- GetJavaConfigRequest2.type = new coc.RequestType(
3913
+ GetJavaConfigRequest2.type = new coc2.RequestType(
3914
3914
  "sonarlint/getJavaConfig"
3915
3915
  );
3916
3916
  })(GetJavaConfigRequest || (GetJavaConfigRequest = {}));
3917
3917
  var ScmCheckRequest;
3918
3918
  ((ScmCheckRequest2) => {
3919
- ScmCheckRequest2.type = new coc.RequestType(
3919
+ ScmCheckRequest2.type = new coc2.RequestType(
3920
3920
  "sonarlint/isIgnoredByScm"
3921
3921
  );
3922
3922
  })(ScmCheckRequest || (ScmCheckRequest = {}));
3923
3923
  var ShowNotificationForFirstSecretsIssueNotification;
3924
3924
  ((ShowNotificationForFirstSecretsIssueNotification2) => {
3925
- ShowNotificationForFirstSecretsIssueNotification2.type = new coc.NotificationType(
3925
+ ShowNotificationForFirstSecretsIssueNotification2.type = new coc2.NotificationType(
3926
3926
  "sonarlint/showNotificationForFirstSecretsIssue"
3927
3927
  );
3928
3928
  })(ShowNotificationForFirstSecretsIssueNotification || (ShowNotificationForFirstSecretsIssueNotification = {}));
3929
3929
  var ShowSonarLintOutputNotification;
3930
3930
  ((ShowSonarLintOutputNotification2) => {
3931
- ShowSonarLintOutputNotification2.type = new coc.NotificationType("sonarlint/showSonarLintOutput");
3931
+ ShowSonarLintOutputNotification2.type = new coc2.NotificationType("sonarlint/showSonarLintOutput");
3932
3932
  })(ShowSonarLintOutputNotification || (ShowSonarLintOutputNotification = {}));
3933
3933
  var OpenJavaHomeSettingsNotification;
3934
3934
  ((OpenJavaHomeSettingsNotification2) => {
3935
- OpenJavaHomeSettingsNotification2.type = new coc.NotificationType(
3935
+ OpenJavaHomeSettingsNotification2.type = new coc2.NotificationType(
3936
3936
  "sonarlint/openJavaHomeSettings"
3937
3937
  );
3938
3938
  })(OpenJavaHomeSettingsNotification || (OpenJavaHomeSettingsNotification = {}));
3939
3939
  var OpenPathToNodeSettingsNotification;
3940
3940
  ((OpenPathToNodeSettingsNotification2) => {
3941
- OpenPathToNodeSettingsNotification2.type = new coc.NotificationType(
3941
+ OpenPathToNodeSettingsNotification2.type = new coc2.NotificationType(
3942
3942
  "sonarlint/openPathToNodeSettings"
3943
3943
  );
3944
3944
  })(OpenPathToNodeSettingsNotification || (OpenPathToNodeSettingsNotification = {}));
3945
3945
  var BrowseToNotification;
3946
3946
  ((BrowseToNotification2) => {
3947
- BrowseToNotification2.type = new coc.NotificationType("sonarlint/browseTo");
3947
+ BrowseToNotification2.type = new coc2.NotificationType("sonarlint/browseTo");
3948
3948
  })(BrowseToNotification || (BrowseToNotification = {}));
3949
3949
  var OpenConnectionSettingsNotification;
3950
3950
  ((OpenConnectionSettingsNotification2) => {
3951
- OpenConnectionSettingsNotification2.type = new coc.NotificationType(
3951
+ OpenConnectionSettingsNotification2.type = new coc2.NotificationType(
3952
3952
  "sonarlint/openConnectionSettings"
3953
3953
  );
3954
3954
  })(OpenConnectionSettingsNotification || (OpenConnectionSettingsNotification = {}));
3955
3955
  var ShowHotspotNotification;
3956
3956
  ((ShowHotspotNotification2) => {
3957
- ShowHotspotNotification2.type = new coc.NotificationType(
3957
+ ShowHotspotNotification2.type = new coc2.NotificationType(
3958
3958
  "sonarlint/showHotspot"
3959
3959
  );
3960
3960
  })(ShowHotspotNotification || (ShowHotspotNotification = {}));
3961
3961
  var ShowIssueNotification;
3962
3962
  ((ShowIssueNotification2) => {
3963
- ShowIssueNotification2.type = new coc.NotificationType("sonarlint/showIssue");
3963
+ ShowIssueNotification2.type = new coc2.NotificationType("sonarlint/showIssue");
3964
3964
  })(ShowIssueNotification || (ShowIssueNotification = {}));
3965
3965
  var ShowIssueOrHotspotNotification;
3966
3966
  ((ShowIssueOrHotspotNotification2) => {
3967
- ShowIssueOrHotspotNotification2.type = new coc.NotificationType(
3967
+ ShowIssueOrHotspotNotification2.type = new coc2.NotificationType(
3968
3968
  "sonarlint/showIssueOrHotspot"
3969
3969
  );
3970
3970
  })(ShowIssueOrHotspotNotification || (ShowIssueOrHotspotNotification = {}));
3971
3971
  var SetReferenceBranchNameForFolderNotification;
3972
3972
  ((SetReferenceBranchNameForFolderNotification2) => {
3973
- SetReferenceBranchNameForFolderNotification2.type = new coc.NotificationType(
3973
+ SetReferenceBranchNameForFolderNotification2.type = new coc2.NotificationType(
3974
3974
  "sonarlint/setReferenceBranchNameForFolder"
3975
3975
  );
3976
3976
  })(SetReferenceBranchNameForFolderNotification || (SetReferenceBranchNameForFolderNotification = {}));
3977
3977
  var NeedCompilationDatabaseRequest;
3978
3978
  ((NeedCompilationDatabaseRequest2) => {
3979
- NeedCompilationDatabaseRequest2.type = new coc.NotificationType(
3979
+ NeedCompilationDatabaseRequest2.type = new coc2.NotificationType(
3980
3980
  "sonarlint/needCompilationDatabase"
3981
3981
  );
3982
3982
  })(NeedCompilationDatabaseRequest || (NeedCompilationDatabaseRequest = {}));
3983
3983
  var ShouldAnalyseFileCheck;
3984
3984
  ((ShouldAnalyseFileCheck2) => {
3985
- ShouldAnalyseFileCheck2.type = new coc.RequestType("sonarlint/shouldAnalyseFile");
3985
+ ShouldAnalyseFileCheck2.type = new coc2.RequestType("sonarlint/shouldAnalyseFile");
3986
3986
  })(ShouldAnalyseFileCheck || (ShouldAnalyseFileCheck = {}));
3987
3987
  var FilterOutExcludedFiles;
3988
3988
  ((FilterOutExcludedFiles2) => {
3989
- FilterOutExcludedFiles2.type = new coc.RequestType(
3989
+ FilterOutExcludedFiles2.type = new coc2.RequestType(
3990
3990
  "sonarlint/filterOutExcludedFiles"
3991
3991
  );
3992
3992
  })(FilterOutExcludedFiles || (FilterOutExcludedFiles = {}));
3993
3993
  var ReportConnectionCheckResult;
3994
3994
  ((ReportConnectionCheckResult2) => {
3995
- ReportConnectionCheckResult2.type = new coc.NotificationType(
3995
+ ReportConnectionCheckResult2.type = new coc2.NotificationType(
3996
3996
  "sonarlint/reportConnectionCheckResult"
3997
3997
  );
3998
3998
  })(ReportConnectionCheckResult || (ReportConnectionCheckResult = {}));
3999
3999
  var CheckConnection;
4000
4000
  ((CheckConnection2) => {
4001
- CheckConnection2.type = new coc.RequestType("sonarlint/checkConnection");
4001
+ CheckConnection2.type = new coc2.RequestType("sonarlint/checkConnection");
4002
4002
  })(CheckConnection || (CheckConnection = {}));
4003
4003
  var CheckLocalDetectionSupported;
4004
4004
  ((CheckLocalDetectionSupported2) => {
4005
- CheckLocalDetectionSupported2.type = new coc.RequestType("sonarlint/checkLocalDetectionSupported");
4005
+ CheckLocalDetectionSupported2.type = new coc2.RequestType("sonarlint/checkLocalDetectionSupported");
4006
4006
  })(CheckLocalDetectionSupported || (CheckLocalDetectionSupported = {}));
4007
4007
  var GetHotspotDetails;
4008
4008
  ((GetHotspotDetails2) => {
4009
- GetHotspotDetails2.type = new coc.RequestType("sonarlint/getHotspotDetails");
4009
+ GetHotspotDetails2.type = new coc2.RequestType("sonarlint/getHotspotDetails");
4010
4010
  })(GetHotspotDetails || (GetHotspotDetails = {}));
4011
4011
  var CanShowMissingRequirementNotification;
4012
4012
  ((CanShowMissingRequirementNotification2) => {
4013
- CanShowMissingRequirementNotification2.type = new coc.RequestType(
4013
+ CanShowMissingRequirementNotification2.type = new coc2.RequestType(
4014
4014
  "sonarlint/canShowMissingRequirementsNotification"
4015
4015
  );
4016
4016
  })(CanShowMissingRequirementNotification || (CanShowMissingRequirementNotification = {}));
4017
4017
  var MaybeShowWiderLanguageSupportNotification;
4018
4018
  ((MaybeShowWiderLanguageSupportNotification2) => {
4019
- MaybeShowWiderLanguageSupportNotification2.type = new coc.NotificationType(
4019
+ MaybeShowWiderLanguageSupportNotification2.type = new coc2.NotificationType(
4020
4020
  "sonarlint/maybeShowWiderLanguageSupportNotification"
4021
4021
  );
4022
4022
  })(MaybeShowWiderLanguageSupportNotification || (MaybeShowWiderLanguageSupportNotification = {}));
4023
4023
  var DidClasspathUpdateNotification;
4024
4024
  ((DidClasspathUpdateNotification2) => {
4025
- DidClasspathUpdateNotification2.type = new coc.NotificationType(
4025
+ DidClasspathUpdateNotification2.type = new coc2.NotificationType(
4026
4026
  "sonarlint/didClasspathUpdate"
4027
4027
  );
4028
4028
  })(DidClasspathUpdateNotification || (DidClasspathUpdateNotification = {}));
4029
4029
  var DidJavaServerModeChangeNotification;
4030
4030
  ((DidJavaServerModeChangeNotification2) => {
4031
- DidJavaServerModeChangeNotification2.type = new coc.NotificationType(
4031
+ DidJavaServerModeChangeNotification2.type = new coc2.NotificationType(
4032
4032
  "sonarlint/didJavaServerModeChange"
4033
4033
  );
4034
4034
  })(DidJavaServerModeChangeNotification || (DidJavaServerModeChangeNotification = {}));
4035
4035
  var DidLocalBranchNameChangeNotification;
4036
4036
  ((DidLocalBranchNameChangeNotification2) => {
4037
- DidLocalBranchNameChangeNotification2.type = new coc.NotificationType(
4037
+ DidLocalBranchNameChangeNotification2.type = new coc2.NotificationType(
4038
4038
  "sonarlint/didLocalBranchNameChange"
4039
4039
  );
4040
4040
  })(DidLocalBranchNameChangeNotification || (DidLocalBranchNameChangeNotification = {}));
4041
4041
  var ListAllRulesRequest;
4042
4042
  ((ListAllRulesRequest2) => {
4043
- ListAllRulesRequest2.type = new coc.RequestType0(
4043
+ ListAllRulesRequest2.type = new coc2.RequestType0(
4044
4044
  "sonarlint/listAllRules"
4045
4045
  );
4046
4046
  })(ListAllRulesRequest || (ListAllRulesRequest = {}));
4047
4047
  var GetTokenForServer;
4048
4048
  ((GetTokenForServer2) => {
4049
- GetTokenForServer2.type = new coc.RequestType(
4049
+ GetTokenForServer2.type = new coc2.RequestType(
4050
4050
  "sonarlint/getTokenForServer"
4051
4051
  );
4052
4052
  })(GetTokenForServer || (GetTokenForServer = {}));
4053
4053
  var OnTokenUpdate;
4054
4054
  ((OnTokenUpdate2) => {
4055
- OnTokenUpdate2.type = new coc.NotificationType(
4055
+ OnTokenUpdate2.type = new coc2.NotificationType(
4056
4056
  "sonarlint/onTokenUpdate"
4057
4057
  );
4058
4058
  })(OnTokenUpdate || (OnTokenUpdate = {}));
4059
4059
  var GetRemoteProjectsForConnection;
4060
4060
  ((GetRemoteProjectsForConnection2) => {
4061
- GetRemoteProjectsForConnection2.type = new coc.RequestType("sonarlint/getRemoteProjectsForConnection");
4061
+ GetRemoteProjectsForConnection2.type = new coc2.RequestType("sonarlint/getRemoteProjectsForConnection");
4062
4062
  })(GetRemoteProjectsForConnection || (GetRemoteProjectsForConnection = {}));
4063
4063
  var GetRemoteProjectNames;
4064
4064
  ((GetRemoteProjectNames2) => {
4065
- GetRemoteProjectNames2.type = new coc.RequestType("sonarlint/getRemoteProjectNames");
4065
+ GetRemoteProjectNames2.type = new coc2.RequestType("sonarlint/getRemoteProjectNames");
4066
4066
  })(GetRemoteProjectNames || (GetRemoteProjectNames = {}));
4067
4067
  var GenerateToken;
4068
4068
  ((GenerateToken2) => {
4069
- GenerateToken2.type = new coc.RequestType("sonarlint/generateToken");
4069
+ GenerateToken2.type = new coc2.RequestType("sonarlint/generateToken");
4070
4070
  })(GenerateToken || (GenerateToken = {}));
4071
4071
  var PublishHotspotsForFile;
4072
4072
  ((PublishHotspotsForFile2) => {
4073
- PublishHotspotsForFile2.type = new coc.NotificationType(
4073
+ PublishHotspotsForFile2.type = new coc2.NotificationType(
4074
4074
  "sonarlint/publishSecurityHotspots"
4075
4075
  );
4076
4076
  })(PublishHotspotsForFile || (PublishHotspotsForFile = {}));
4077
4077
  var ShowHotspotLocations;
4078
4078
  ((ShowHotspotLocations2) => {
4079
- ShowHotspotLocations2.type = new coc.RequestType("sonarlint/showHotspotLocations");
4079
+ ShowHotspotLocations2.type = new coc2.RequestType("sonarlint/showHotspotLocations");
4080
4080
  })(ShowHotspotLocations || (ShowHotspotLocations = {}));
4081
4081
  var OpenHotspotOnServer;
4082
4082
  ((OpenHotspotOnServer2) => {
4083
- OpenHotspotOnServer2.type = new coc.NotificationType(
4083
+ OpenHotspotOnServer2.type = new coc2.NotificationType(
4084
4084
  "sonarlint/openHotspotInBrowser"
4085
4085
  );
4086
4086
  })(OpenHotspotOnServer || (OpenHotspotOnServer = {}));
4087
4087
  var HelpAndFeedbackLinkClicked;
4088
4088
  ((HelpAndFeedbackLinkClicked2) => {
4089
- HelpAndFeedbackLinkClicked2.type = new coc.NotificationType(
4089
+ HelpAndFeedbackLinkClicked2.type = new coc2.NotificationType(
4090
4090
  "sonarlint/helpAndFeedbackLinkClicked"
4091
4091
  );
4092
4092
  })(HelpAndFeedbackLinkClicked || (HelpAndFeedbackLinkClicked = {}));
4093
4093
  var ScanFolderForHotspots;
4094
4094
  ((ScanFolderForHotspots2) => {
4095
- ScanFolderForHotspots2.type = new coc.NotificationType(
4095
+ ScanFolderForHotspots2.type = new coc2.NotificationType(
4096
4096
  "sonarlint/scanFolderForHotspots"
4097
4097
  );
4098
4098
  })(ScanFolderForHotspots || (ScanFolderForHotspots = {}));
4099
4099
  var ForgetFolderHotspots;
4100
4100
  ((ForgetFolderHotspots2) => {
4101
- ForgetFolderHotspots2.type = new coc.NotificationType(
4101
+ ForgetFolderHotspots2.type = new coc2.NotificationType(
4102
4102
  "sonarlint/forgetFolderHotspots"
4103
4103
  );
4104
4104
  })(ForgetFolderHotspots || (ForgetFolderHotspots = {}));
4105
4105
  var GetFilePatternsForAnalysis;
4106
4106
  ((GetFilePatternsForAnalysis2) => {
4107
- GetFilePatternsForAnalysis2.type = new coc.RequestType("sonarlint/listSupportedFilePatterns");
4107
+ GetFilePatternsForAnalysis2.type = new coc2.RequestType("sonarlint/listSupportedFilePatterns");
4108
4108
  })(GetFilePatternsForAnalysis || (GetFilePatternsForAnalysis = {}));
4109
4109
  var GetSuggestedBinding;
4110
4110
  ((GetSuggestedBinding2) => {
4111
- GetSuggestedBinding2.type = new coc.RequestType("sonarlint/getBindingSuggestion");
4111
+ GetSuggestedBinding2.type = new coc2.RequestType("sonarlint/getBindingSuggestion");
4112
4112
  })(GetSuggestedBinding || (GetSuggestedBinding = {}));
4113
4113
  var GetSharedConnectedModeConfigFileContents;
4114
4114
  ((GetSharedConnectedModeConfigFileContents2) => {
4115
- GetSharedConnectedModeConfigFileContents2.type = new coc.RequestType("sonarlint/getSharedConnectedModeFileContent");
4115
+ GetSharedConnectedModeConfigFileContents2.type = new coc2.RequestType("sonarlint/getSharedConnectedModeFileContent");
4116
4116
  })(GetSharedConnectedModeConfigFileContents || (GetSharedConnectedModeConfigFileContents = {}));
4117
4117
  var ReopenResolvedLocalIssues;
4118
4118
  ((ReopenResolvedLocalIssues2) => {
4119
- ReopenResolvedLocalIssues2.type = new coc.NotificationType(
4119
+ ReopenResolvedLocalIssues2.type = new coc2.NotificationType(
4120
4120
  "sonarlint/reopenResolvedLocalIssues"
4121
4121
  );
4122
4122
  })(ReopenResolvedLocalIssues || (ReopenResolvedLocalIssues = {}));
4123
4123
  var CheckIssueStatusChangePermitted;
4124
4124
  ((CheckIssueStatusChangePermitted2) => {
4125
- CheckIssueStatusChangePermitted2.type = new coc.RequestType("sonarlint/checkIssueStatusChangePermitted");
4125
+ CheckIssueStatusChangePermitted2.type = new coc2.RequestType("sonarlint/checkIssueStatusChangePermitted");
4126
4126
  })(CheckIssueStatusChangePermitted || (CheckIssueStatusChangePermitted = {}));
4127
4127
  var SetIssueStatus;
4128
4128
  ((SetIssueStatus2) => {
4129
- SetIssueStatus2.type = new coc.NotificationType(
4129
+ SetIssueStatus2.type = new coc2.NotificationType(
4130
4130
  "sonarlint/changeIssueStatus"
4131
4131
  );
4132
4132
  })(SetIssueStatus || (SetIssueStatus = {}));
4133
4133
  var AssistCreatingConnection;
4134
4134
  ((AssistCreatingConnection2) => {
4135
- AssistCreatingConnection2.type = new coc.RequestType("sonarlint/assistCreatingConnection");
4135
+ AssistCreatingConnection2.type = new coc2.RequestType("sonarlint/assistCreatingConnection");
4136
4136
  })(AssistCreatingConnection || (AssistCreatingConnection = {}));
4137
4137
  var AssistBinding;
4138
4138
  ((AssistBinding2) => {
4139
- AssistBinding2.type = new coc.RequestType("sonarlint/assistBinding");
4139
+ AssistBinding2.type = new coc2.RequestType("sonarlint/assistBinding");
4140
4140
  })(AssistBinding || (AssistBinding = {}));
4141
4141
  var ShowHotspotDetails;
4142
4142
  ((ShowHotspotDetails2) => {
4143
- ShowHotspotDetails2.type = new coc.NotificationType(
4143
+ ShowHotspotDetails2.type = new coc2.NotificationType(
4144
4144
  "sonarlint/showHotspotDetails"
4145
4145
  );
4146
4146
  })(ShowHotspotDetails || (ShowHotspotDetails = {}));
4147
4147
  var GetAllowedHotspotStatuses;
4148
4148
  ((GetAllowedHotspotStatuses2) => {
4149
- GetAllowedHotspotStatuses2.type = new coc.RequestType("sonarlint/getAllowedHotspotStatuses");
4149
+ GetAllowedHotspotStatuses2.type = new coc2.RequestType("sonarlint/getAllowedHotspotStatuses");
4150
4150
  })(GetAllowedHotspotStatuses || (GetAllowedHotspotStatuses = {}));
4151
4151
  var SetHotspotStatus;
4152
4152
  ((SetHotspotStatus2) => {
4153
- SetHotspotStatus2.type = new coc.NotificationType(
4153
+ SetHotspotStatus2.type = new coc2.NotificationType(
4154
4154
  "sonarlint/changeHotspotStatus"
4155
4155
  );
4156
4156
  })(SetHotspotStatus || (SetHotspotStatus = {}));
4157
4157
  var SslCertificateConfirmation;
4158
4158
  ((SslCertificateConfirmation2) => {
4159
- SslCertificateConfirmation2.type = new coc.RequestType("sonarlint/askSslCertificateConfirmation");
4159
+ SslCertificateConfirmation2.type = new coc2.RequestType("sonarlint/askSslCertificateConfirmation");
4160
4160
  })(SslCertificateConfirmation || (SslCertificateConfirmation = {}));
4161
4161
  var AnalyseOpenFileIgnoringExcludes;
4162
4162
  ((AnalyseOpenFileIgnoringExcludes2) => {
4163
- AnalyseOpenFileIgnoringExcludes2.type = new coc.NotificationType(
4163
+ AnalyseOpenFileIgnoringExcludes2.type = new coc2.NotificationType(
4164
4164
  "sonarlint/analyseOpenFileIgnoringExcludes"
4165
4165
  );
4166
4166
  })(AnalyseOpenFileIgnoringExcludes || (AnalyseOpenFileIgnoringExcludes = {}));
4167
4167
  var ShowSoonUnsupportedVersionMessage;
4168
4168
  ((ShowSoonUnsupportedVersionMessage2) => {
4169
- ShowSoonUnsupportedVersionMessage2.type = new coc.NotificationType(
4169
+ ShowSoonUnsupportedVersionMessage2.type = new coc2.NotificationType(
4170
4170
  "sonarlint/showSoonUnsupportedVersionMessage"
4171
4171
  );
4172
4172
  })(ShowSoonUnsupportedVersionMessage || (ShowSoonUnsupportedVersionMessage = {}));
4173
4173
  var SubmitNewCodeDefinition;
4174
4174
  ((SubmitNewCodeDefinition2) => {
4175
- SubmitNewCodeDefinition2.type = new coc.NotificationType(
4175
+ SubmitNewCodeDefinition2.type = new coc2.NotificationType(
4176
4176
  "sonarlint/submitNewCodeDefinition"
4177
4177
  );
4178
4178
  })(SubmitNewCodeDefinition || (SubmitNewCodeDefinition = {}));
4179
4179
  var SuggestConnection;
4180
4180
  ((SuggestConnection2) => {
4181
- SuggestConnection2.type = new coc.NotificationType(
4181
+ SuggestConnection2.type = new coc2.NotificationType(
4182
4182
  "sonarlint/suggestConnection"
4183
4183
  );
4184
4184
  })(SuggestConnection || (SuggestConnection = {}));
4185
4185
  var DidCreateBinding;
4186
4186
  ((DidCreateBinding2) => {
4187
- DidCreateBinding2.type = new coc.NotificationType(
4187
+ DidCreateBinding2.type = new coc2.NotificationType(
4188
4188
  "sonarlint/didCreateBinding"
4189
4189
  );
4190
4190
  })(DidCreateBinding || (DidCreateBinding = {}));
@@ -4192,7 +4192,7 @@ var DidCreateBinding;
4192
4192
  // src/index.ts
4193
4193
  var ChildProcess = __toESM(require("child_process"));
4194
4194
  var import_coc2 = require("coc.nvim");
4195
- var coc11 = __toESM(require("coc.nvim"));
4195
+ var coc12 = __toESM(require("coc.nvim"));
4196
4196
 
4197
4197
  // src/settings/settings.ts
4198
4198
  var import_coc = require("coc.nvim");
@@ -4221,10 +4221,10 @@ function getCurrentConfiguration() {
4221
4221
  }
4222
4222
 
4223
4223
  // src/util/logging.ts
4224
- var coc2 = __toESM(require("coc.nvim"));
4224
+ var coc3 = __toESM(require("coc.nvim"));
4225
4225
  var sonarlintOutput;
4226
4226
  function initLogOutput(context) {
4227
- sonarlintOutput = coc2.window.createOutputChannel("SonarLint");
4227
+ sonarlintOutput = coc3.window.createOutputChannel("SonarLint");
4228
4228
  context.subscriptions.push(sonarlintOutput);
4229
4229
  }
4230
4230
  function getLogOutput() {
@@ -4242,22 +4242,22 @@ function showLogOutput() {
4242
4242
  // src/lsp/server.ts
4243
4243
  var fs = __toESM(require("fs"));
4244
4244
  var Path = __toESM(require("path"));
4245
- var coc3 = __toESM(require("coc.nvim"));
4245
+ var coc4 = __toESM(require("coc.nvim"));
4246
4246
  var DEBUG = typeof v8debug === "object" || startedInDebugMode(process);
4247
4247
  function languageServerCommand(context, requirements) {
4248
4248
  let location = getSonarLintConfiguration().get("ls.directory");
4249
4249
  location = !location ? Path.resolve(__dirname, "../") : location;
4250
4250
  if (location) {
4251
- location = coc3.workspace.expand(location);
4251
+ location = coc4.workspace.expand(location);
4252
4252
  if (!fs.existsSync(location)) {
4253
4253
  logToSonarLintOutput(
4254
4254
  `Sonar can not start, invalid or non existent path was detected ${location}`
4255
4255
  );
4256
- coc3.window.showWarningMessage(`Sonar binaries were not found, check SonarLint output`);
4256
+ coc4.window.showWarningMessage(`Sonar binaries were not found, check SonarLint output`);
4257
4257
  return void 0;
4258
4258
  }
4259
4259
  } else {
4260
- coc3.window.showWarningMessage(`Sonar binaries directory could not be resolved at all`);
4260
+ coc4.window.showWarningMessage(`Sonar binaries directory could not be resolved at all`);
4261
4261
  return void 0;
4262
4262
  }
4263
4263
  const serverJar = Path.resolve(
@@ -4304,7 +4304,7 @@ function languageServerCommand(context, requirements) {
4304
4304
  return {
4305
4305
  command: javaExecutablePath,
4306
4306
  args: params,
4307
- transport: coc3.TransportKind.stdio
4307
+ transport: coc4.TransportKind.stdio
4308
4308
  };
4309
4309
  }
4310
4310
  function parseVMargs(params, vmargsLine) {
@@ -4333,7 +4333,7 @@ var import_find_java_home = __toESM(require_dist());
4333
4333
  var fse = __toESM(require_lib());
4334
4334
  var path = __toESM(require("path"));
4335
4335
  var import_path_exists = __toESM(require_path_exists2());
4336
- var coc4 = __toESM(require("coc.nvim"));
4336
+ var coc5 = __toESM(require("coc.nvim"));
4337
4337
 
4338
4338
  // src/util/commands.ts
4339
4339
  var Commands;
@@ -4386,7 +4386,7 @@ var Commands;
4386
4386
 
4387
4387
  // src/util/requirements.ts
4388
4388
  var REQUIRED_JAVA_VERSION = 17;
4389
- var isWindows = process.platform.indexOf("win") === 0;
4389
+ var isWindows = process.platform.startsWith("win");
4390
4390
  var JAVA_FILENAME = `java${isWindows ? ".exe" : ""}`;
4391
4391
  var JAVA_HOME_CONFIG = "sonarlint.ls.javaHome";
4392
4392
  async function resolveRequirements(context) {
@@ -4472,7 +4472,7 @@ function tryExplicitConfiguration() {
4472
4472
  return { source, javaHome };
4473
4473
  }
4474
4474
  function readJavaConfig() {
4475
- return coc4.workspace.getConfiguration().get(JAVA_HOME_CONFIG, "java");
4475
+ return coc5.workspace.getConfiguration().get(JAVA_HOME_CONFIG, "java");
4476
4476
  }
4477
4477
  function checkJavaVersion(javaHome) {
4478
4478
  return new Promise((resolve3, reject) => {
@@ -4525,7 +4525,7 @@ function openJREDownload(reject, cause) {
4525
4525
  message: cause,
4526
4526
  label: "Get the Java Runtime Environment",
4527
4527
  command: Commands.OPEN_BROWSER,
4528
- commandParam: coc4.Uri.parse(jreUrl)
4528
+ commandParam: coc5.Uri.parse(jreUrl)
4529
4529
  });
4530
4530
  }
4531
4531
  function invalidJavaHome(reject, cause) {
@@ -4544,12 +4544,12 @@ function invalidJavaHome(reject, cause) {
4544
4544
  }
4545
4545
 
4546
4546
  // src/lsp/client.ts
4547
- var coc6 = __toESM(require("coc.nvim"));
4547
+ var coc7 = __toESM(require("coc.nvim"));
4548
4548
 
4549
4549
  // src/util/uri.ts
4550
- var coc5 = __toESM(require("coc.nvim"));
4550
+ var coc6 = __toESM(require("coc.nvim"));
4551
4551
  function code2ProtocolConverter(value) {
4552
- if (/^win32/.test(process.platform)) {
4552
+ if (process.platform.startsWith("win32")) {
4553
4553
  return value.toString().replace(/%3A/i, ":");
4554
4554
  } else {
4555
4555
  return value.toString();
@@ -4557,7 +4557,7 @@ function code2ProtocolConverter(value) {
4557
4557
  }
4558
4558
 
4559
4559
  // src/lsp/client.ts
4560
- var SonarLintExtendedLanguageClient = class extends coc6.LanguageClient {
4560
+ var SonarLintExtendedLanguageClient = class extends coc7.LanguageClient {
4561
4561
  listAllRules() {
4562
4562
  return this.sendRequest(ListAllRulesRequest.type);
4563
4563
  }
@@ -4737,28 +4737,30 @@ function isAlpineLinux() {
4737
4737
  return false;
4738
4738
  }
4739
4739
  }
4740
- return !!fileContent && (fileContent.match(/^ID=([^\u001b\r\n]*)/m) || [])[1] === "alpine";
4740
+ return !!fileContent && (fileContent.match(/^ID=([^\u001b\r\n]*)/m) ?? [])[1] === "alpine";
4741
4741
  }
4742
4742
 
4743
4743
  // src/rules/rules.ts
4744
- var coc7 = __toESM(require("coc.nvim"));
4744
+ var coc8 = __toESM(require("coc.nvim"));
4745
4745
  function isActive(rule) {
4746
4746
  return rule.activeByDefault && rule.levelFromConfig !== "off" || rule.levelFromConfig === "on";
4747
4747
  }
4748
4748
  function actualLevel(rule) {
4749
4749
  return isActive(rule) ? "on" : "off";
4750
4750
  }
4751
- var LanguageNode = class extends coc7.TreeItem {
4751
+ var LanguageNode = class extends coc8.TreeItem {
4752
4752
  constructor(label, state) {
4753
- super(label, state || coc7.TreeItemCollapsibleState.Collapsed);
4754
- this.tooltip = "language";
4753
+ super(label, state);
4754
+ this.id = label.toLowerCase();
4755
+ this.tooltip = `Rules applicable for ${label} language`;
4755
4756
  }
4756
4757
  };
4757
- var RuleNode = class extends coc7.TreeItem {
4758
- constructor(rule) {
4758
+ var RuleNode = class extends coc8.TreeItem {
4759
+ constructor(rule, language) {
4759
4760
  super(rule.name);
4760
4761
  this.rule = rule;
4761
- this.id = rule.key.toUpperCase();
4762
+ this.language = language;
4763
+ this.id = rule.key.toLowerCase();
4762
4764
  this.tooltip = `Toggle rule ${rule.key} status`;
4763
4765
  this.description = `${rule.key} - ${actualLevel(rule)}`;
4764
4766
  this.command = {
@@ -4769,54 +4771,75 @@ var RuleNode = class extends coc7.TreeItem {
4769
4771
  }
4770
4772
  };
4771
4773
  var AllRulesTreeDataProvider = class {
4772
- constructor(allRulesProvider, elementStatus) {
4774
+ constructor(allRulesProvider, allRootsStates) {
4773
4775
  this.allRulesProvider = allRulesProvider;
4774
- this.elementStatus = elementStatus;
4775
- this._onDidChangeTreeData = new coc7.Emitter();
4776
+ this.allRootsStates = allRootsStates;
4777
+ this._onDidChangeTreeData = new coc8.Emitter();
4776
4778
  this.onDidChangeTreeData = this._onDidChangeTreeData.event;
4777
- }
4778
- getTreeItem(node) {
4779
- return node;
4779
+ this.allRoots = [];
4780
+ this.allChildren = /* @__PURE__ */ new Map();
4781
+ }
4782
+ async getTreeItem(node) {
4783
+ if (node instanceof RuleNode && node.id && this.allChildren.has(node.id)) {
4784
+ return this.allChildren.get(node.id)?.find((n) => n.id == node.id);
4785
+ } else if (node instanceof LanguageNode && this.allRoots.length > 0) {
4786
+ return this.allRoots?.find((n) => n.id == node.id);
4787
+ } else {
4788
+ return node;
4789
+ }
4780
4790
  }
4781
4791
  async getParent(node) {
4782
4792
  if (node instanceof LanguageNode) {
4783
4793
  return null;
4784
- } else {
4785
- const response = await this.getAllRules();
4786
- return Object.keys(response).filter(
4787
- (k) => response[k].findIndex(
4788
- (r) => r.key.toUpperCase() === node.rule.key.toUpperCase()
4789
- ) >= 0
4790
- ).map((l) => new LanguageNode(l, this.elementStatus.get(l))).pop();
4794
+ } else if (node instanceof RuleNode) {
4795
+ if (this.allRoots.length == 0) {
4796
+ await this.getChildren();
4797
+ }
4798
+ if (node?.language !== void 0) {
4799
+ return this.allRoots.find((n) => n.id == node.language);
4800
+ } else {
4801
+ const response = await this.getAllRules();
4802
+ const nodeKey = node.rule.key.toLowerCase();
4803
+ const languageNode = Object.keys(response).filter((k) => response[k].findIndex(
4804
+ (r) => r.key.toLowerCase() === nodeKey
4805
+ ) >= 0).map((l) => l.toLowerCase()).pop();
4806
+ return this.allRoots.find((n) => n.id == languageNode);
4807
+ }
4791
4808
  }
4792
4809
  }
4793
4810
  async getChildren(node) {
4794
- const localRuleConfig = coc7.workspace.getConfiguration("sonarlint.rules");
4795
- return this.getAllRules().then((response) => {
4796
- Object.keys(response).forEach(
4797
- (language) => response[language].sort(byName)
4798
- );
4799
- return response;
4800
- }).then((response) => {
4801
- if (node) {
4802
- return response[node.label].map((rule) => {
4803
- rule.levelFromConfig = localRuleConfig.get(rule.key, {})["level"];
4804
- return rule;
4805
- }).filter((r) => {
4806
- if (this.levelFilter === "on") {
4807
- return isActive(r);
4808
- } else if (this.levelFilter === "off") {
4809
- return !isActive(r);
4810
- } else {
4811
- return true;
4812
- }
4813
- }).map((rule) => new RuleNode(rule));
4811
+ let result;
4812
+ if (this.allRoots.length == 0 || node?.id && !this.allChildren.has(node.id)) {
4813
+ const localRuleConfig = coc8.workspace.getConfiguration("sonarlint.rules");
4814
+ result = await this.getAllRules().then((response) => {
4815
+ if (node) {
4816
+ return response[node.label].sort(byName).map((rule) => {
4817
+ rule.levelFromConfig = localRuleConfig.get(rule.key, {})["level"];
4818
+ return rule;
4819
+ }).filter((r) => {
4820
+ if (this.levelFilter === "on") {
4821
+ return isActive(r);
4822
+ } else if (this.levelFilter === "off") {
4823
+ return !isActive(r);
4824
+ } else {
4825
+ return true;
4826
+ }
4827
+ }).map((rule) => new RuleNode(rule, node.id?.toLowerCase()));
4828
+ } else {
4829
+ return Object.keys(response).sort().map(
4830
+ (language) => new LanguageNode(language, this.allRootsStates.get(language.toLowerCase()) ?? coc8.TreeItemCollapsibleState.Collapsed)
4831
+ );
4832
+ }
4833
+ });
4834
+ if (node instanceof LanguageNode && node.id) {
4835
+ this.allChildren.set(node.id, result);
4814
4836
  } else {
4815
- return Object.keys(response).sort().map(
4816
- (language) => new LanguageNode(language, this.elementStatus.get(language))
4817
- );
4837
+ this.allRoots = result;
4818
4838
  }
4819
- });
4839
+ } else {
4840
+ result = node instanceof LanguageNode && node.id ? this.allChildren.get(node.id) : this.allRoots;
4841
+ }
4842
+ return result;
4820
4843
  }
4821
4844
  async getAllRules() {
4822
4845
  if (this.allRules === void 0) {
@@ -4825,6 +4848,11 @@ var AllRulesTreeDataProvider = class {
4825
4848
  return this.allRules;
4826
4849
  }
4827
4850
  refresh() {
4851
+ let copy = { roots: this.allRoots, children: this.allChildren };
4852
+ delete copy.roots;
4853
+ delete copy.children;
4854
+ this.allRoots = [];
4855
+ this.allChildren = /* @__PURE__ */ new Map();
4828
4856
  this._onDidChangeTreeData.fire(void 0);
4829
4857
  }
4830
4858
  filter(level) {
@@ -4832,7 +4860,9 @@ var AllRulesTreeDataProvider = class {
4832
4860
  this.refresh();
4833
4861
  }
4834
4862
  register(element) {
4835
- this.elementStatus.set(element.label, element.collapsibleState);
4863
+ if (element instanceof LanguageNode) {
4864
+ this.allRootsStates.set(element.id, element.collapsibleState);
4865
+ }
4836
4866
  }
4837
4867
  };
4838
4868
  function byName(r1, r2) {
@@ -4842,45 +4872,54 @@ function toggleRule(level) {
4842
4872
  return async (ruleKey) => {
4843
4873
  const configuration = getSonarLintConfiguration();
4844
4874
  let rules = configuration.get("rules") || {};
4875
+ rules = { ...rules };
4845
4876
  if (typeof ruleKey === "string") {
4846
4877
  if (!level) {
4847
4878
  const current = rules[ruleKey] ? rules[ruleKey].level : void 0;
4848
4879
  level = !current || current == "on" ? "off" : "on";
4849
4880
  }
4850
- level = level == void 0 ? rules[ruleKey] : level;
4851
- rules = Object.assign({ [ruleKey]: { level } }, rules);
4852
- if (level === "off") {
4853
- const result = await coc7.window.showPrompt(
4881
+ let localLevel = !level ? rules[ruleKey] : level;
4882
+ rules = Object.assign({ [ruleKey]: { localLevel } }, rules);
4883
+ if (localLevel === "off") {
4884
+ const result = await coc8.window.showPrompt(
4854
4885
  `Are you sure you want to disable rule ${ruleKey}? `
4855
4886
  );
4856
4887
  if (!result) {
4857
4888
  return;
4858
4889
  }
4859
4890
  }
4860
- coc7.window.showWarningMessage(
4861
- `Changed level of rule ${ruleKey} to ${level}`
4891
+ coc8.window.showWarningMessage(
4892
+ `Changed level of rule ${ruleKey} to ${localLevel}`
4862
4893
  );
4863
4894
  return await configuration.update(
4864
4895
  "rules",
4865
4896
  rules,
4866
- coc7.ConfigurationTarget.Global
4897
+ coc8.ConfigurationTarget.Global
4867
4898
  );
4868
4899
  } else {
4869
4900
  const { key, activeByDefault } = ruleKey;
4901
+ let localLevel = level;
4870
4902
  if (!level) {
4871
4903
  const current = rules[key] ? rules[key].level : void 0;
4872
- level = current == "on" || activeByDefault ? "off" : "on";
4904
+ if (!current) {
4905
+ localLevel = activeByDefault === true ? "off" : "on";
4906
+ } else {
4907
+ localLevel = current === "on" ? "off" : "on";
4908
+ }
4873
4909
  }
4874
- if (level === "on" && !activeByDefault || level === "off" && activeByDefault) {
4875
- rules = Object.assign({ [key]: { level } }, rules);
4910
+ if (localLevel === "on" && !activeByDefault || localLevel === "off" && activeByDefault) {
4911
+ if (!rules[key]) {
4912
+ rules[key] = {};
4913
+ }
4914
+ rules[key].level = localLevel;
4876
4915
  } else {
4877
- rules = Object.assign({ [key]: void 0 }, rules);
4916
+ delete rules[key];
4878
4917
  }
4879
- coc7.window.showWarningMessage(`Changed level of rule ${key} to ${level}`);
4918
+ coc8.window.showWarningMessage(`Changed level of rule ${key} to ${localLevel}`);
4880
4919
  return await configuration.update(
4881
4920
  "rules",
4882
4921
  rules,
4883
- coc7.ConfigurationTarget.Global
4922
+ coc8.ConfigurationTarget.Global
4884
4923
  );
4885
4924
  }
4886
4925
  };
@@ -4985,7 +5024,7 @@ var assertValidOperator = (op) => {
4985
5024
  };
4986
5025
 
4987
5026
  // src/java/java.ts
4988
- var coc8 = __toESM(require("coc.nvim"));
5027
+ var coc9 = __toESM(require("coc.nvim"));
4989
5028
  var classpathChangeListener;
4990
5029
  var serverModeListener;
4991
5030
  var javaApiTooLowAlreadyLogged = false;
@@ -4993,7 +5032,7 @@ var javaServerInLightWeightModeAlreadyLogged = false;
4993
5032
  function installClasspathListener(languageClient2) {
4994
5033
  const extension2 = getJavaExtension();
4995
5034
  if (!extension2) {
4996
- coc8.window.showWarningMessage(`Unable to find any compliant java extension installed in the coc runtime`);
5035
+ coc9.window.showWarningMessage(`Unable to find any compliant java extension installed in the coc runtime`);
4997
5036
  return;
4998
5037
  }
4999
5038
  if (extension2?.isActive) {
@@ -5056,7 +5095,7 @@ async function getJavaConfig(languageClient2, fileUri) {
5056
5095
  const extension2 = getJavaExtension();
5057
5096
  try {
5058
5097
  if (!extension2) {
5059
- coc8.window.showWarningMessage(`Unable to find any compliant java extension installed in the coc runtime`);
5098
+ coc9.window.showWarningMessage(`Unable to find any compliant java extension installed in the coc runtime`);
5060
5099
  return;
5061
5100
  }
5062
5101
  const extensionApi = await extension2?.activate();
@@ -5087,7 +5126,7 @@ async function getJavaConfig(languageClient2, fileUri) {
5087
5126
  };
5088
5127
  }
5089
5128
  } catch (error) {
5090
- coc8.window.showErrorMessage(JSON.stringify(error));
5129
+ coc9.window.showErrorMessage(JSON.stringify(error));
5091
5130
  }
5092
5131
  }
5093
5132
  function javaConfigDisabledInLightWeightMode() {
@@ -5100,15 +5139,15 @@ function javaConfigDisabledInLightWeightMode() {
5100
5139
  return void 0;
5101
5140
  }
5102
5141
  function getJavaExtension() {
5103
- const java = coc8.extensions.getExtensionById("coc-java");
5142
+ const java = coc9.extensions.getExtensionById("coc-java");
5104
5143
  if (!java || java == null || java === void 0) {
5105
- return coc8.extensions.getExtensionById("coc-java-dev");
5144
+ return coc9.extensions.getExtensionById("coc-java-dev");
5106
5145
  }
5107
5146
  return java;
5108
5147
  }
5109
5148
 
5110
5149
  // src/rules/rulepanel.ts
5111
- var coc9 = __toESM(require("coc.nvim"));
5150
+ var coc10 = __toESM(require("coc.nvim"));
5112
5151
  function showRuleDescription(factory) {
5113
5152
  return (params) => {
5114
5153
  factory.show([
@@ -5161,7 +5200,7 @@ function computeHeading(tab, contextualDescription) {
5161
5200
  }
5162
5201
  function renderRuleParams(rule) {
5163
5202
  if (rule.parameters && rule.parameters.length > 0) {
5164
- const ruleParamsConfig = coc9.workspace.getConfiguration(
5203
+ const ruleParamsConfig = coc10.workspace.getConfiguration(
5165
5204
  `sonarlint.rules.${rule.key}.parameters`
5166
5205
  );
5167
5206
  return `Following parameter values can be set in the SonarLint:Rules user settings.
@@ -5186,7 +5225,7 @@ function renderRuleParam(param, config) {
5186
5225
  }
5187
5226
 
5188
5227
  // src/cfamily/cfamily.ts
5189
- var coc10 = __toESM(require("coc.nvim"));
5228
+ var coc11 = __toESM(require("coc.nvim"));
5190
5229
  var fs3 = __toESM(require("fs"));
5191
5230
  var path2 = __toESM(require("path"));
5192
5231
 
@@ -5206,33 +5245,33 @@ var FULL_PATH_TO_COMPILE_COMMANDS = `${SONARLINT_CATEGORY}.${PATH_TO_COMPILE_COM
5206
5245
  var DO_NOT_ASK_ABOUT_COMPILE_COMMANDS_FLAG = "doNotAskAboutCompileCommands";
5207
5246
  var remindMeLaterAboutCompileCommandsFlag = false;
5208
5247
  function showMessageAndUpdateConfig(compilationDbPath) {
5209
- coc10.window.showInformationMessage(
5248
+ coc11.window.showInformationMessage(
5210
5249
  `Analysis configured. Compilation database path is set to: ${compilationDbPath}`
5211
5250
  );
5212
5251
  const [pathForSettings, workspaceFolder] = tryRelativizeToWorkspaceFolder(compilationDbPath);
5213
5252
  if (workspaceFolder !== void 0) {
5214
- const config = coc10.workspace.getConfiguration(
5253
+ const config = coc11.workspace.getConfiguration(
5215
5254
  SONARLINT_CATEGORY,
5216
5255
  workspaceFolder.uri
5217
5256
  );
5218
5257
  return config.update(
5219
5258
  PATH_TO_COMPILE_COMMANDS,
5220
5259
  pathForSettings,
5221
- coc10.ConfigurationTarget.WorkspaceFolder
5260
+ coc11.ConfigurationTarget.WorkspaceFolder
5222
5261
  );
5223
5262
  }
5224
- return coc10.workspace.getConfiguration().update(
5263
+ return coc11.workspace.getConfiguration().update(
5225
5264
  FULL_PATH_TO_COMPILE_COMMANDS,
5226
5265
  pathForSettings,
5227
- coc10.ConfigurationTarget.Workspace
5266
+ coc11.ConfigurationTarget.Workspace
5228
5267
  );
5229
5268
  }
5230
5269
  function tryRelativizeToWorkspaceFolder(filePath) {
5231
5270
  if (!path2.isAbsolute(filePath)) {
5232
5271
  return [filePath, void 0];
5233
5272
  }
5234
- for (const folder of coc10.workspace.workspaceFolders || []) {
5235
- const folderPath = coc10.Uri.parse(folder.uri).fsPath;
5273
+ for (const folder of coc11.workspace.workspaceFolders || []) {
5274
+ const folderPath = coc11.Uri.parse(folder.uri).fsPath;
5236
5275
  if (filePath.startsWith(folderPath)) {
5237
5276
  const pathWithVariable = `\${workspaceFolder}${filePath.replace(folderPath, "")}`;
5238
5277
  return [pathWithVariable, folder];
@@ -5241,15 +5280,17 @@ function tryRelativizeToWorkspaceFolder(filePath) {
5241
5280
  return [filePath, void 0];
5242
5281
  }
5243
5282
  async function configureCompilationDatabase() {
5244
- const paths = (await coc10.workspace.findFiles(`**/compile_commands.json`)).filter((path3) => fs3.existsSync(path3.fsPath));
5283
+ const paths = (await coc11.workspace.findFiles(`**/compile_commands.json`)).filter((path3) => fs3.existsSync(path3.fsPath));
5245
5284
  if (paths.length === 0) {
5246
- coc10.window.showWarningMessage(`No compilation databases were found in the workspace
5285
+ coc11.window.showWarningMessage(
5286
+ `No compilation databases were found in the workspace
5247
5287
 
5248
- [How to generate compile commands](${SonarLintDocumentation.C_CPP_ANALYSIS})`);
5249
- coc10.workspace.getConfiguration().update(
5288
+ [How to generate compile commands](${SonarLintDocumentation.C_CPP_ANALYSIS})`
5289
+ );
5290
+ coc11.workspace.getConfiguration().update(
5250
5291
  FULL_PATH_TO_COMPILE_COMMANDS,
5251
5292
  void 0,
5252
- coc10.ConfigurationTarget.Workspace
5293
+ coc11.ConfigurationTarget.Workspace
5253
5294
  );
5254
5295
  } else {
5255
5296
  await showCompilationDatabaseOptions(paths);
@@ -5264,7 +5305,7 @@ function notifyMissingCompileCommands(context) {
5264
5305
  const configureCompileCommandsAction = "Configure compile commands";
5265
5306
  const message = `SonarLint is unable to analyze C and C++ file(s) because there is no configured compilation
5266
5307
  database.`;
5267
- coc10.window.showWarningMessage(
5308
+ coc11.window.showWarningMessage(
5268
5309
  message,
5269
5310
  configureCompileCommandsAction,
5270
5311
  remindMeLaterAction
@@ -5296,7 +5337,7 @@ async function showCompilationDatabaseOptions(paths) {
5296
5337
  index: i
5297
5338
  }));
5298
5339
  items.sort((i1, i2) => i1.label.localeCompare(i2.label));
5299
- const selection = await coc10.window.showQuickPick(items, {
5340
+ const selection = await coc11.window.showQuickPick(items, {
5300
5341
  placeholder: "Pick a compilation database"
5301
5342
  });
5302
5343
  if (selection) {
@@ -5322,9 +5363,9 @@ var allRulesView;
5322
5363
  var floatDescriptionFactory;
5323
5364
  async function runJavaServer(context) {
5324
5365
  return resolveRequirements(context).catch((error) => {
5325
- coc11.window.showErrorMessage(error.message, error.label).then((selection) => {
5366
+ coc12.window.showErrorMessage(error.message, error.label).then((selection) => {
5326
5367
  if (error.label && error.label === selection && error.command) {
5327
- coc11.commands.executeCommand(error.command, error.commandParam);
5368
+ coc12.commands.executeCommand(error.command, error.commandParam);
5328
5369
  }
5329
5370
  });
5330
5371
  throw error;
@@ -5353,8 +5394,8 @@ async function activate(context) {
5353
5394
  setExtensionContext(context);
5354
5395
  initLogOutput(context);
5355
5396
  const serverOptions = () => runJavaServer(context);
5356
- const pythonWatcher = coc11.workspace.createFileSystemWatcher("**/*.py");
5357
- const sharedConnectedModeConfigurationWatcher = coc11.workspace.createFileSystemWatcher("**/.sonarlint/*.json");
5397
+ const pythonWatcher = coc12.workspace.createFileSystemWatcher("**/*.py");
5398
+ const sharedConnectedModeConfigurationWatcher = coc12.workspace.createFileSystemWatcher("**/.sonarlint/*.json");
5358
5399
  context.subscriptions.push(pythonWatcher);
5359
5400
  context.subscriptions.push(sharedConnectedModeConfigurationWatcher);
5360
5401
  const clientOptions = {
@@ -5369,10 +5410,10 @@ async function activate(context) {
5369
5410
  productKey: "vscode",
5370
5411
  productName: "SonarLint coc",
5371
5412
  productVersion: "1.0.0",
5372
- showVerboseLogs: coc11.workspace.getConfiguration().get("sonarlint.output.showVerboseLogs", false),
5413
+ showVerboseLogs: coc12.workspace.getConfiguration().get("sonarlint.output.showVerboseLogs", false),
5373
5414
  platform: getPlatform(),
5374
5415
  architecture: process.arch,
5375
- clientNodePath: coc11.workspace.getConfiguration().get("sonarlint.pathToNodeExecutable")
5416
+ clientNodePath: coc12.workspace.getConfiguration().get("sonarlint.pathToNodeExecutable")
5376
5417
  };
5377
5418
  },
5378
5419
  outputChannel: getLogOutput(),
@@ -5396,14 +5437,14 @@ async function activate(context) {
5396
5437
  });
5397
5438
  context.subscriptions.push(floatDescriptionFactory);
5398
5439
  installCustomRequestHandlers(context);
5399
- coc11.workspace.onDidChangeConfiguration(async (event) => {
5440
+ coc12.workspace.onDidChangeConfiguration(async (event) => {
5400
5441
  if (event.affectsConfiguration("sonarlint.rules")) {
5401
5442
  allRulesTreeDataProvider.refresh();
5402
5443
  }
5403
5444
  });
5404
5445
  registerCommands(context);
5405
5446
  context.subscriptions.push(
5406
- coc11.extensions.onDidActiveExtension(() => {
5447
+ coc12.extensions.onDidActiveExtension(() => {
5407
5448
  installClasspathListener(languageClient);
5408
5449
  })
5409
5450
  );
@@ -5411,55 +5452,53 @@ async function activate(context) {
5411
5452
  }
5412
5453
  function registerCommands(context) {
5413
5454
  context.subscriptions.push(
5414
- coc11.commands.registerCommand(Commands.SHOW_ALL_LOCATIONS, showAllLocations)
5455
+ coc12.commands.registerCommand(Commands.SHOW_ALL_LOCATIONS, showAllLocations)
5415
5456
  );
5416
5457
  context.subscriptions.push(
5417
- coc11.commands.registerCommand(Commands.CLEAR_LOCATIONS, clearLocations)
5458
+ coc12.commands.registerCommand(Commands.CLEAR_LOCATIONS, clearLocations)
5418
5459
  );
5419
5460
  context.subscriptions.push(
5420
- coc11.commands.registerCommand(Commands.DEACTIVATE_RULE, toggleRule("off"))
5461
+ coc12.commands.registerCommand(Commands.DEACTIVATE_RULE, toggleRule("off"))
5421
5462
  );
5422
5463
  context.subscriptions.push(
5423
- coc11.commands.registerCommand(Commands.ACTIVATE_RULE, toggleRule("on"))
5464
+ coc12.commands.registerCommand(Commands.ACTIVATE_RULE, toggleRule("on"))
5424
5465
  );
5425
5466
  context.subscriptions.push(
5426
- coc11.commands.registerCommand(Commands.TOGGLE_RULE, toggleRule(void 0))
5467
+ coc12.commands.registerCommand(Commands.TOGGLE_RULE, toggleRule())
5427
5468
  );
5428
5469
  context.subscriptions.push(
5429
- coc11.commands.registerCommand(Commands.SHOW_ALL_RULES, async () => {
5430
- await prepareRulesTreeView("Displaying all rules");
5470
+ coc12.commands.registerCommand(Commands.SHOW_ALL_RULES, async () => {
5431
5471
  allRulesTreeDataProvider.filter();
5472
+ await prepareRulesTreeView("Displaying all rules");
5432
5473
  })
5433
5474
  );
5434
5475
  context.subscriptions.push(
5435
- coc11.commands.registerCommand(Commands.SHOW_ACTIVE_RULES, async () => {
5436
- await prepareRulesTreeView("Displaying active rules");
5476
+ coc12.commands.registerCommand(Commands.SHOW_ACTIVE_RULES, async () => {
5437
5477
  allRulesTreeDataProvider.filter("on");
5478
+ await prepareRulesTreeView("Displaying active rules");
5438
5479
  })
5439
5480
  );
5440
5481
  context.subscriptions.push(
5441
- coc11.commands.registerCommand(Commands.SHOW_INACTIVE_RULES, async () => {
5442
- await prepareRulesTreeView("Displaying inactive rules");
5482
+ coc12.commands.registerCommand(Commands.SHOW_INACTIVE_RULES, async () => {
5443
5483
  allRulesTreeDataProvider.filter("off");
5484
+ await prepareRulesTreeView("Displaying inactive rules");
5444
5485
  })
5445
5486
  );
5446
5487
  context.subscriptions.push(
5447
- coc11.commands.registerCommand(
5488
+ coc12.commands.registerCommand(
5448
5489
  Commands.OPEN_RULE_BY_KEY,
5449
5490
  async (ruleKey) => {
5450
- await coc11.commands.executeCommand(Commands.SHOW_ALL_RULES);
5451
- await allRulesView?.reveal(
5452
- new RuleNode({ key: ruleKey.toUpperCase() }),
5453
- {
5454
- focus: true,
5455
- expand: true
5456
- }
5457
- );
5491
+ await prepareRulesTreeView(`Displaying rules for ${ruleKey}`);
5492
+ const type = ruleKey.indexOf(":") >= 0 ? new RuleNode({ key: ruleKey.toLowerCase() }) : new LanguageNode(ruleKey.toLowerCase(), coc12.TreeItemCollapsibleState.Collapsed);
5493
+ const node = await allRulesTreeDataProvider.getTreeItem(type);
5494
+ node.collapsibleState = coc12.TreeItemCollapsibleState.Expanded;
5495
+ allRulesTreeDataProvider.register(node);
5496
+ await allRulesView?.reveal(node, { select: true, focus: true, expand: true });
5458
5497
  }
5459
5498
  )
5460
5499
  );
5461
5500
  context.subscriptions.push(
5462
- coc11.commands.registerCommand(
5501
+ coc12.commands.registerCommand(
5463
5502
  Commands.SHOW_HOTSPOT_RULE_DESCRIPTION,
5464
5503
  (hotspot) => languageClient.showHotspotRuleDescription(
5465
5504
  hotspot.ruleKey,
@@ -5469,25 +5508,25 @@ function registerCommands(context) {
5469
5508
  )
5470
5509
  );
5471
5510
  context.subscriptions.push(
5472
- coc11.commands.registerCommand(Commands.FIND_RULE_BY_KEY, async () => {
5473
- const key = await coc11.window.requestInput("Enter rule key: ", "");
5474
- await coc11.commands.executeCommand(Commands.OPEN_RULE_BY_KEY, key);
5511
+ coc12.commands.registerCommand(Commands.FIND_RULE_BY_KEY, async () => {
5512
+ const key = await coc12.window.requestInput("Enter rule key", "");
5513
+ await coc12.commands.executeCommand(Commands.OPEN_RULE_BY_KEY, key);
5475
5514
  })
5476
5515
  );
5477
5516
  context.subscriptions.push(
5478
- coc11.commands.registerCommand(
5517
+ coc12.commands.registerCommand(
5479
5518
  Commands.SHOW_SONARLINT_OUTPUT,
5480
5519
  () => showLogOutput()
5481
5520
  )
5482
5521
  );
5483
5522
  context.subscriptions.push(
5484
- coc11.commands.registerCommand(
5523
+ coc12.commands.registerCommand(
5485
5524
  Commands.CONFIGURE_COMPILATION_DATABASE,
5486
5525
  configureCompilationDatabase
5487
5526
  )
5488
5527
  );
5489
5528
  context.subscriptions.push(
5490
- coc11.commands.registerCommand(
5529
+ coc12.commands.registerCommand(
5491
5530
  Commands.ENABLE_VERBOSE_LOGS,
5492
5531
  () => enableVerboseLogs()
5493
5532
  )
@@ -5522,24 +5561,24 @@ function installCustomRequestHandlers(context) {
5522
5561
  );
5523
5562
  languageClient.onNotification(
5524
5563
  ShowSonarLintOutputNotification.type,
5525
- () => void coc11.commands.executeCommand(Commands.SHOW_SONARLINT_OUTPUT)
5564
+ () => void coc12.commands.executeCommand(Commands.SHOW_SONARLINT_OUTPUT)
5526
5565
  );
5527
5566
  languageClient.onNotification(
5528
5567
  OpenJavaHomeSettingsNotification.type,
5529
- () => void coc11.commands.executeCommand(Commands.OPEN_SETTINGS, JAVA_HOME_CONFIG)
5568
+ () => void coc12.commands.executeCommand(Commands.OPEN_SETTINGS, JAVA_HOME_CONFIG)
5530
5569
  );
5531
5570
  languageClient.onNotification(
5532
5571
  OpenPathToNodeSettingsNotification.type,
5533
- () => void coc11.commands.executeCommand(
5572
+ () => void coc12.commands.executeCommand(
5534
5573
  Commands.OPEN_SETTINGS,
5535
5574
  "sonarlint.pathToNodeExecutable"
5536
5575
  )
5537
5576
  );
5538
5577
  languageClient.onNotification(
5539
5578
  BrowseToNotification.type,
5540
- (browseTo) => void coc11.commands.executeCommand(
5579
+ (browseTo) => void coc12.commands.executeCommand(
5541
5580
  Commands.OPEN_BROWSER,
5542
- coc11.Uri.parse(browseTo)
5581
+ coc12.Uri.parse(browseTo)
5543
5582
  )
5544
5583
  );
5545
5584
  languageClient.onNotification(
@@ -5565,18 +5604,18 @@ async function showAllLocations(issue) {
5565
5604
  locations.push({ uri: loc.uri, range });
5566
5605
  })
5567
5606
  );
5568
- const quickFixList = await coc11.workspace.getQuickfixList(locations);
5569
- await coc11.nvim.call("setqflist", [quickFixList]);
5570
- let openCommand = await coc11.nvim.getVar(
5607
+ const quickFixList = await coc12.workspace.getQuickfixList(locations);
5608
+ await coc12.nvim.call("setqflist", [quickFixList]);
5609
+ let openCommand = await coc12.nvim.getVar(
5571
5610
  "coc_quickfix_open_command"
5572
5611
  );
5573
- coc11.nvim.command(
5612
+ coc12.nvim.command(
5574
5613
  typeof openCommand === "string" ? openCommand : "copen",
5575
5614
  true
5576
5615
  );
5577
5616
  }
5578
5617
  async function clearLocations() {
5579
- await coc11.nvim.call("setqflist", [[], "r"]);
5618
+ await coc12.nvim.call("setqflist", [[], "r"]);
5580
5619
  }
5581
5620
  function deactivate() {
5582
5621
  if (!languageClient) {
@@ -5586,7 +5625,7 @@ function deactivate() {
5586
5625
  }
5587
5626
  async function prepareRulesTreeView(title) {
5588
5627
  if (!allRulesView) {
5589
- allRulesView = coc11.window.createTreeView(title, {
5628
+ allRulesView = coc12.window.createTreeView(title, {
5590
5629
  treeDataProvider: allRulesTreeDataProvider
5591
5630
  });
5592
5631
  allRulesView.onDidCollapseElement((n) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-sonarlint",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "sonarlint for coc.nvim",
5
5
  "author": "asmodeus812 <svetlozar321@gmail.com>",
6
6
  "license": "MIT",