Skip to content

Commit 6b162bf

Browse files
authored
Set up typing on console.fontLigatures and console.fontVariations so it is the same as the editor counterparts (#10928)
Addresses #10593 This PR makes the typing for the new `console.fontLigatures` and `console.fontVariations` settings the same as what we inherited for `editor.fontLigatures` and `editor.fontVariations`, since that is how these settings actually work. This does not change how these settings function but now the hinting in `settings.json` is correct: <img width="1028" height="336" alt="Screenshot 2025-12-03 at 7 24 59 PM" src="https://github.com/user-attachments/assets/8ba356d3-3c45-4c8c-aa49-1c790681ab96" /> ### Release Notes #### New Features - N/A #### Bug Fixes - Fixed typing for Positron's `console.fontLigatures` setting ### QA Notes If you use a setting like `"console.fontLigatures": "'ss05'"` you should get no errors and the same hinting that you would get for `"editor.fontLigatures": "'ss05'"`.
1 parent cad322b commit 6b162bf

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

src/vs/workbench/browser/fontConfigurationManager.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { createBareFontInfoFromRawSettings } from '../../editor/common/config/fo
1414

1515
/**
1616
* Font options interface. Any component that needs to provide font options can define configuration settings
17-
* matching this interface. (Note that fontLigatures and fontVariations are simplified boolean options vs. the
18-
* more complex fontLigatures and fontVariations configuration options that are available in the editor.)
17+
* matching this interface. Like the editor, fontLigatures and fontVariations can be either booleans for simple
18+
* on/off control, or strings for fine-grained control of CSS font-feature-settings and font-variation-settings.
1919
*/
2020
export interface IFontOptions {
2121
/**
@@ -24,19 +24,22 @@ export interface IFontOptions {
2424
fontFamily?: string;
2525

2626
/**
27-
* Enable font ligatures.
27+
* Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures
28+
* or a string for the value of the CSS 'font-feature-settings' property.
2829
*/
29-
fontLigatures?: boolean;
30+
fontLigatures?: boolean | string;
3031

3132
/**
3233
* The font size
3334
*/
3435
fontSize?: number;
3536

3637
/**
37-
* Enable font variations.
38+
* Configures font variations. Can be either a boolean to enable/disable the translation from
39+
* font-weight to font-variation-settings or a string for the value of the CSS
40+
* 'font-variation-settings' property.
3841
*/
39-
fontVariations?: boolean;
42+
fontVariations?: boolean | string;
4043

4144
/**
4245
* The font weight

src/vs/workbench/services/positronConsole/browser/positronConsoleService.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,18 @@ configurationRegistry.registerConfiguration({
197197
},
198198
// Font ligatures.
199199
'console.fontLigatures': {
200-
type: 'boolean',
201-
default: false,
202-
description: localize('console.fontLigatures.markdownDescription', "Enable font ligatures ('calt' and 'liga' font features)."),
200+
anyOf: [
201+
{
202+
type: 'boolean',
203+
description: localize('console.fontLigatures', "Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property."),
204+
},
205+
{
206+
type: 'string',
207+
description: localize('console.fontFeatureSettings', "Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")
208+
}
209+
],
210+
description: localize('console.fontLigaturesGeneral', "Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),
211+
default: false
203212
},
204213
// Font size.
205214
'console.fontSize': {
@@ -211,9 +220,18 @@ configurationRegistry.registerConfiguration({
211220
},
212221
// Font variations.
213222
'console.fontVariations': {
214-
type: 'boolean',
215-
default: false,
216-
description: localize('console.fontVariations', "Enable the translation from font-weight to font-variation-settings."),
223+
anyOf: [
224+
{
225+
type: 'boolean',
226+
description: localize('console.fontVariations', "Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property."),
227+
},
228+
{
229+
type: 'string',
230+
description: localize('console.fontVariationSettings', "Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")
231+
}
232+
],
233+
description: localize('console.fontVariationsGeneral', "Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),
234+
default: false
217235
},
218236
// Font weight.
219237
'console.fontWeight': {
@@ -1697,7 +1715,7 @@ class PositronConsoleInstance extends Disposable implements IPositronConsoleInst
16971715
*
16981716
* @param entries The execution history entries to replay.
16991717
*/
1700-
replayExecutions(entries: IExecutionHistoryEntry<any>[]): void {
1718+
replayExecutions(entries: IExecutionHistoryEntry<unknown>[]): void {
17011719
for (const entry of entries) {
17021720
if (entry.outputType === ExecutionEntryType.Execution) {
17031721
// Create the activity and the first item (the input)
@@ -1723,7 +1741,7 @@ class PositronConsoleInstance extends Disposable implements IPositronConsoleInst
17231741
entry.id + '-output',
17241742
entry.id,
17251743
new Date(entry.when),
1726-
{ 'text/plain': entry.output }
1744+
{ 'text/plain': entry.output as string }
17271745
);
17281746
inputItem.addActivityItem(outputActivityItem);
17291747
}

0 commit comments

Comments
 (0)