Skip to content

Commit

Permalink
fix: Have a single setting to hid issues in ruler
Browse files Browse the repository at this point in the history
fixes #3664
  • Loading branch information
Jason3S committed Jan 8, 2025
1 parent 86089b4 commit 6dc2cc2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3191,6 +3191,13 @@
"since": "4.0.0",
"type": "string"
},
"cSpell.showInRuler": {
"default": true,
"markdownDescription": "Show spelling issues in the editor ruler.\n\nNote: This setting is only used when `#cSpell.useCustomDecorations#` is `true`.",
"scope": "application",
"since": "4.0.35",
"type": "boolean"
},
"cSpell.textDecoration": {
"markdownDescription": "The CSS Style used to decorate spelling issues. Depends upon `#cSpell.useCustomDecorations#`.\n\nThis setting is used to manually configure the text decoration. If it is not set, the following settings are used:\n- `#cSpell.textDecorationLine#` to pick the line type\n- `#cSpell.textDecorationStyle#` to pick the style\n- `#cSpell.textDecorationColor#` to set the color\n- `#cSpell.textDecorationThickness#` to set the thickness.\n\nSee: [text-decoration - CSS: Cascading Style Sheets, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration)\n\nFormat: `<line> [style] <color> [thickness]`\n\n- line - `underline`, `overline`, see: [text-decoration-line, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-line)\n- style - `solid`, `wavy`, `dotted`, see: [text-decoration-style, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-style)\n- color - see: [text-decoration-color, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color)\n- thickness - see: [text-decoration-thickness, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-thickness)\n\nExamples:\n- `underline green`\n- `underline dotted yellow 0.2rem`\n- `underline wavy #ff0c 1.5px` - Wavy underline with 1.5px thickness in semi-transparent yellow.\n\nTo change the ruler color, use `#cSpell.overviewRulerColor#`.",
"scope": "application",
Expand Down
8 changes: 8 additions & 0 deletions packages/_server/spell-checker-config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2781,6 +2781,14 @@
"since": "4.0.0",
"type": "string"
},
"cSpell.showInRuler": {
"default": true,
"description": "Show spelling issues in the editor ruler.\n\nNote: This setting is only used when `#cSpell.useCustomDecorations#` is `true`.",
"markdownDescription": "Show spelling issues in the editor ruler.\n\nNote: This setting is only used when `#cSpell.useCustomDecorations#` is `true`.",
"scope": "application",
"since": "4.0.35",
"type": "boolean"
},
"cSpell.textDecoration": {
"description": "The CSS Style used to decorate spelling issues. Depends upon `#cSpell.useCustomDecorations#`.\n\nThis setting is used to manually configure the text decoration. If it is not set, the following settings are used:\n- `#cSpell.textDecorationLine#` to pick the line type\n- `#cSpell.textDecorationStyle#` to pick the style\n- `#cSpell.textDecorationColor#` to set the color\n- `#cSpell.textDecorationThickness#` to set the thickness.\n\nSee: [text-decoration - CSS: Cascading Style Sheets, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration)\n\nFormat: `<line> [style] <color> [thickness]`\n\n- line - `underline`, `overline`, see: [text-decoration-line, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-line)\n- style - `solid`, `wavy`, `dotted`, see: [text-decoration-style, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-style)\n- color - see: [text-decoration-color, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color)\n- thickness - see: [text-decoration-thickness, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-thickness)\n\nExamples:\n- `underline green`\n- `underline dotted yellow 0.2rem`\n- `underline wavy #ff0c 1.5px` - Wavy underline with 1.5px thickness in semi-transparent yellow.\n\nTo change the ruler color, use `#cSpell.overviewRulerColor#`.",
"markdownDescription": "The CSS Style used to decorate spelling issues. Depends upon `#cSpell.useCustomDecorations#`.\n\nThis setting is used to manually configure the text decoration. If it is not set, the following settings are used:\n- `#cSpell.textDecorationLine#` to pick the line type\n- `#cSpell.textDecorationStyle#` to pick the style\n- `#cSpell.textDecorationColor#` to set the color\n- `#cSpell.textDecorationThickness#` to set the thickness.\n\nSee: [text-decoration - CSS: Cascading Style Sheets, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration)\n\nFormat: `<line> [style] <color> [thickness]`\n\n- line - `underline`, `overline`, see: [text-decoration-line, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-line)\n- style - `solid`, `wavy`, `dotted`, see: [text-decoration-style, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-style)\n- color - see: [text-decoration-color, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color)\n- thickness - see: [text-decoration-thickness, MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-thickness)\n\nExamples:\n- `underline green`\n- `underline dotted yellow 0.2rem`\n- `underline wavy #ff0c 1.5px` - Wavy underline with 1.5px thickness in semi-transparent yellow.\n\nTo change the ruler color, use `#cSpell.overviewRulerColor#`.",
Expand Down
11 changes: 11 additions & 0 deletions packages/_server/src/config/cspellConfig/AppearanceSettings.mts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ interface Appearance extends Decoration {
}

export interface AppearanceSettings extends Appearance {
/**
* Show spelling issues in the editor ruler.
*
* Note: This setting is only used when `#cSpell.useCustomDecorations#` is `true`.
*
* @scope application
* @since 4.0.35
* @default true
*/
showInRuler?: boolean;

/**
* Draw custom decorations on Spelling Issues.
* - `true` - Use custom decorations. - VS Code Diagnostic Severity Levels are not used.
Expand Down
1 change: 1 addition & 0 deletions packages/_server/src/config/cspellConfig/configFields.mts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const ConfigFields: CSpellUserSettingsFields = {
// Appearance
useCustomDecorations: 'useCustomDecorations',
doNotUseCustomDecorationForScheme: 'doNotUseCustomDecorationForScheme',
showInRuler: 'showInRuler',
textDecoration: 'textDecoration',
textDecorationLine: 'textDecorationLine',
textDecorationStyle: 'textDecorationStyle',
Expand Down
18 changes: 11 additions & 7 deletions packages/client/src/decorators/decorateIssues.mts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export class SpellingIssueDecorator implements Disposable {
| 'light'
| 'overviewRulerColor'
| 'revealIssuesAfterDelayMS'
| 'showInRuler'
| 'textDecoration'
| 'textDecorationColor'
| 'textDecorationColorFlagged'
Expand All @@ -258,29 +259,32 @@ export class SpellingIssueDecorator implements Disposable {
| 'textDecorationThickness'
>;

const overviewRulerColor: string | undefined = cfg[mode]?.overviewRulerColor || cfg.overviewRulerColor || undefined;
const showInRuler = cfg.showInRuler ?? true;
const overviewRulerColor: string | undefined =
(showInRuler && (cfg[mode]?.overviewRulerColor || cfg.overviewRulerColor)) || undefined;
const overviewRulerLane = showInRuler ? vscode.OverviewRulerLane.Right : undefined;

const decoratorIssues = window.createTextEditorDecorationType({
isWholeLine: false,
rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
overviewRulerLane: vscode.OverviewRulerLane.Right,
overviewRulerColor: overviewRulerColor,
overviewRulerLane,
overviewRulerColor,
textDecoration: calcTextDecoration(cfg, mode, 'textDecorationColor'),
});

const decoratorFlagged = window.createTextEditorDecorationType({
isWholeLine: false,
rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
overviewRulerLane: vscode.OverviewRulerLane.Right,
overviewRulerColor: overviewRulerColor,
overviewRulerLane,
overviewRulerColor,
textDecoration: calcTextDecoration(cfg, mode, 'textDecorationColorFlagged'),
});

const decoratorSuggestions = window.createTextEditorDecorationType({
isWholeLine: false,
rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
overviewRulerLane: vscode.OverviewRulerLane.Right,
overviewRulerColor: overviewRulerColor,
overviewRulerLane,
overviewRulerColor,
textDecoration: calcTextDecoration(cfg, mode, 'textDecorationColorSuggestion'),
});

Expand Down

0 comments on commit 6dc2cc2

Please sign in to comment.