Skip to content

Commit

Permalink
SLVSCODE-848 Show INFO and BLOCKER severity levels in rule descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jblievremont committed Sep 24, 2024
1 parent 4bf5771 commit b7258a3
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 13 deletions.
3 changes: 3 additions & 0 deletions images/impact/blocker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions images/impact/high.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions images/impact/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions images/impact/low.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions images/impact/medium.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"groupId": "org.sonarsource.sonarlint.ls",
"artifactId": "sonarlint-language-server",
"version": "3.10.0.75477",
"version": "3.11.0.75514",
"output": "server/sonarlint-ls.jar"
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/rules/rulepanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function computeRuleDescPanelContent(
rule: ShowRuleDescriptionParams
) {
const resolver = new ResourceResolver(context, webview);
const themeSrc = resolver.resolve('styles', 'theme.css');
const styleSrc = resolver.resolve('styles', 'rule.css');
const hljsSrc = resolver.resolve('styles', 'vs.css');
const hotspotSrc = resolver.resolve('styles', 'hotspot.css');
Expand All @@ -72,6 +73,7 @@ function computeRuleDescPanelContent(
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; img-src ${webview.cspSource}; style-src ${webview.cspSource}"/>
<link rel="stylesheet" type="text/css" href="${themeSrc}" />
<link rel="stylesheet" type="text/css" href="${styleSrc}" />
<link rel="stylesheet" type="text/css" href="${hotspotSrc}" />
<link rel="stylesheet" type="text/css" href="${hljsSrc}" />
Expand Down
28 changes: 22 additions & 6 deletions styles/rule.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,37 @@ a {
.impact.capsule {
margin-left: 0.6em;
padding-right: 0.2em;
border: 1px solid;
}

.impact-blocker {
color: var(--sonarlint-blocker-color);
background-color: var(--sonarlint-blocker-background-color);
border-color: var(--sonarlint-blocker-border-color);
}

.impact-high {
color: rgb(180, 35, 24);
background-color: rgb(180, 35, 24, 0.2);
color: var(--sonarlint-high-color);
background-color: var(--sonarlint-high-background-color);
border-color: var(--sonarlint-high-border-color);
}

.impact-medium {
color: rgb(174, 122, 41);
background-color: rgb(174, 122, 41, 0.2);
color: var(--sonarlint-medium-color);
background-color: var(--sonarlint-medium-background-color);
border-color: var(--sonarlint-medium-border-color);
}

.impact-low {
color: rgb(49, 108, 146);
background-color: rgb(49, 108, 146, 0.2);
color: var(--sonarlint-low-color);
background-color: var(--sonarlint-low-background-color);
border-color: var(--sonarlint-low-border-color);
}

.impact-info {
color: var(--sonarlint-info-color);
background-color: var(--sonarlint-info-background-color);
border-color: var(--sonarlint-info-border-color);
}

.impact img {
Expand Down
42 changes: 42 additions & 0 deletions styles/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* --------------------------------------------------------------------------------------------
* SonarLint for VisualStudio Code
* Copyright (C) 2017-2024 SonarSource SA
* sonarlint@sonarsource.com
* Licensed under the LGPLv3 License. See LICENSE.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

.vscode-light {
--sonarlint-blocker-color: #801B14;
--sonarlint-blocker-border-color: #801B14;
--sonarlint-blocker-background-color: #FEE4E2;
--sonarlint-high-color: #B42318;
--sonarlint-high-border-color: #D92D20;
--sonarlint-high-background-color: #FEF3F2;
--sonarlint-medium-color: #93370D;
--sonarlint-medium-border-color: #FE964B;
--sonarlint-medium-background-color: #FFF0EB;
--sonarlint-low-color: #8C5E1E;
--sonarlint-low-border-color: #FADC79;
--sonarlint-low-background-color: #FCF5E4;
--sonarlint-info-color: #316C92;
--sonarlint-info-border-color: #8FCAEA;
--sonarlint-info-background-color: #F5FBFF;
}

.vscode-dark {
--sonarlint-blocker-color: #F97066;
--sonarlint-blocker-border-color: #F97066;
--sonarlint-blocker-background-color: rgba(128, 27, 20, 0.2);
--sonarlint-high-color: #FDA29B;
--sonarlint-high-border-color: #FDA29B;
--sonarlint-high-background-color: rgba(253, 162, 155, 0.2);
--sonarlint-medium-color: #FE964B;
--sonarlint-medium-border-color: #FE964B;
--sonarlint-medium-background-color: rgba(181, 71, 8, 0.2);
--sonarlint-low-color: #FADC79;
--sonarlint-low-border-color: #FADC79;
--sonarlint-low-background-color: rgba(250, 220, 121, 0.2);
--sonarlint-info-color: #8FCAEA;
--sonarlint-info-border-color: #8FCAEA;
--sonarlint-info-background-color: rgba(143, 202, 234, 0.2);
}

0 comments on commit b7258a3

Please sign in to comment.