Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
338ea54
adding code on vscode side
aiday-mar Aug 26, 2025
01023d7
channelling information until text model
aiday-mar Aug 26, 2025
78337a6
adding code
aiday-mar Aug 27, 2025
caa7500
adding code
aiday-mar Aug 28, 2025
eff39b1
wip
aiday-mar Aug 28, 2025
3212903
wip
aiday-mar Aug 28, 2025
e3c37c2
wip
aiday-mar Aug 28, 2025
527e805
moving to textmodel
aiday-mar Aug 29, 2025
3537d36
removing comment
aiday-mar Aug 29, 2025
b851380
removing comment
aiday-mar Aug 29, 2025
31caf10
removing comment
aiday-mar Aug 29, 2025
00343c2
message
aiday-mar Aug 29, 2025
0e9f28b
wip
aiday-mar Sep 1, 2025
906c063
updating on removal of variable fonts
aiday-mar Sep 1, 2025
3f8a647
fixing the api
aiday-mar Sep 1, 2025
e6e1f51
fixing offset
aiday-mar Sep 1, 2025
71d18e8
Merge branch 'main' into operational-bobcat
aiday-mar Oct 8, 2025
7ddb8fa
=polishing
aiday-mar Oct 24, 2025
759533d
polishing
aiday-mar Oct 24, 2025
a63c9be
adding code
aiday-mar Oct 29, 2025
202bf72
need to find how to add colors
aiday-mar Oct 29, 2025
6b027da
adding code
aiday-mar Oct 30, 2025
a487d21
setting relevant CSS from within colorThemeData
aiday-mar Oct 30, 2025
6035c0d
adding code
aiday-mar Oct 30, 2025
a628a5b
adding code which changes the line height too
aiday-mar Oct 30, 2025
92bf840
adding code
aiday-mar Oct 30, 2025
e47173c
adding code
aiday-mar Nov 7, 2025
922f577
use different decorations ids for line height
aiday-mar Nov 10, 2025
8324bfa
adding space
aiday-mar Nov 11, 2025
922eaaa
directly setting the decorations from inside the provider
aiday-mar Nov 11, 2025
1e4636e
getting the decorations on line
aiday-mar Nov 12, 2025
db3e449
removing other code
aiday-mar Nov 12, 2025
7962709
changing id to unique id
aiday-mar Nov 12, 2025
c327951
adding code to resolve edits on content change events
aiday-mar Nov 12, 2025
ba857b8
using array of font segments so it is optimized
aiday-mar Nov 13, 2025
23fbb0a
adding logs
aiday-mar Nov 13, 2025
813170a
using annotations array
aiday-mar Nov 17, 2025
8d08bfa
fixing the text mate tokenization controller code
aiday-mar Nov 18, 2025
06d2bfa
fixing tests for getting annotation indices
aiday-mar Nov 19, 2025
6adc94e
using global offsets directly instead of line numbers
aiday-mar Nov 20, 2025
92e2ff2
adding serizalization logic
aiday-mar Nov 20, 2025
2731587
wip
aiday-mar Nov 21, 2025
00e6624
using the algorithm from the editReplaceRanges
aiday-mar Nov 21, 2025
a3a1075
adding code to fix rebase
aiday-mar Nov 21, 2025
d0099d4
adding code
aiday-mar Nov 24, 2025
7c048a1
combining methods into one
aiday-mar Nov 24, 2025
4c2847c
fixing some bugs
aiday-mar Nov 24, 2025
ee51ed3
using the same id in the getDecorationsInRange method and in the onDi…
aiday-mar Nov 25, 2025
f5d6056
allowing to remove tokenization decorations
aiday-mar Nov 25, 2025
c125338
using the fontannotations map array instead of the model decorations
aiday-mar Nov 25, 2025
dc2e831
investigating the bug where variable line height remains on line addi…
aiday-mar Nov 25, 2025
19a41b0
adding code
aiday-mar Nov 26, 2025
00df9ec
fixing flickering of font decorations
aiday-mar Nov 26, 2025
a6d748d
polishing round
aiday-mar Nov 26, 2025
69af626
polishing round
aiday-mar Nov 27, 2025
f5f4ac8
using the annotation with annotation field undefined for deleting oth…
aiday-mar Nov 27, 2025
ba053e9
returns the deleted annotations
aiday-mar Nov 27, 2025
ee5a23c
refactoring code
aiday-mar Nov 30, 2025
e1f31d4
fire event on decoration removed through edit
aiday-mar Nov 30, 2025
fa9c779
adding font token annotation outside of if statement
aiday-mar Nov 30, 2025
67973b5
fixing the test
aiday-mar Nov 30, 2025
f6fa19e
adding visual representation for tests
aiday-mar Nov 30, 2025
eb5fdee
Merge branch 'main' into operational-bobcat
aiday-mar Nov 30, 2025
59cda00
package lock changed
aiday-mar Nov 30, 2025
6720244
registering the disposable
aiday-mar Nov 30, 2025
db0e327
fix
aiday-mar Nov 30, 2025
dc01002
increasing the vscode-textmate version
aiday-mar Dec 2, 2025
95af0be
changing the vscode-textmate version used for the remote extension
aiday-mar Dec 2, 2025
d2ad6f8
using specific edit
aiday-mar Dec 2, 2025
a48a292
applying review comments
aiday-mar Dec 12, 2025
25fd3da
removing comments
aiday-mar Dec 12, 2025
0fab53b
refactor: enhance type definitions for annotations and font tokens
aiday-mar Dec 12, 2025
355a4fd
refactor: update font token handling to use IFontTokenOption type
aiday-mar Dec 12, 2025
3a5403a
moving IAnnotationUpdate further down
aiday-mar Dec 12, 2025
d0177da
using a different visualization system
aiday-mar Dec 12, 2025
d7a4ebe
setting to non static method
aiday-mar Dec 12, 2025
96f8c73
Merge branch 'main' into operational-bobcat
aiday-mar Dec 16, 2025
34fb290
fixing imports
aiday-mar Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"v8-inspect-profiler": "^0.1.1",
"vscode-oniguruma": "1.7.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "^9.2.1",
"vscode-textmate": "^9.3.0",
"yauzl": "^3.0.0",
"yazl": "^2.4.3"
},
Expand Down
8 changes: 4 additions & 4 deletions remote/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"tas-client": "0.3.1",
"vscode-oniguruma": "1.7.0",
"vscode-regexpp": "^3.1.0",
"vscode-textmate": "^9.2.1",
"vscode-textmate": "^9.3.0",
"yauzl": "^3.0.0",
"yazl": "^2.4.3"
},
Expand Down
8 changes: 4 additions & 4 deletions remote/web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion remote/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"katex": "^0.16.22",
"tas-client": "0.3.1",
"vscode-oniguruma": "1.7.0",
"vscode-textmate": "^9.2.1"
"vscode-textmate": "^9.3.0"
}
}
15 changes: 15 additions & 0 deletions src/vs/editor/common/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { localize } from '../../nls.js';
import { ExtensionIdentifier } from '../../platform/extensions/common/extensions.js';
import { IMarkerData } from '../../platform/markers/common/markers.js';
import { EditDeltaInfo } from './textModelEditSource.js';
import { FontTokensUpdate } from './textModelEvents.js';

/**
* @internal
Expand Down Expand Up @@ -64,6 +65,17 @@ export class TokenizationResult {
}
}

/**
* @internal
*/
export interface IFontToken {
readonly startIndex: number;
readonly endIndex: number;
readonly fontFamily: string | null;
readonly fontSize: string | null;
readonly lineHeight: number | null;
}

/**
* @internal
*/
Expand All @@ -78,6 +90,7 @@ export class EncodedTokenizationResult {
*
*/
public readonly tokens: Uint32Array,
public readonly fontInfo: IFontToken[],
public readonly endState: IState,
) {
}
Expand Down Expand Up @@ -140,6 +153,8 @@ export interface IBackgroundTokenizer extends IDisposable {
export interface IBackgroundTokenizationStore {
setTokens(tokens: ContiguousMultilineTokens[]): void;

setFontInfo(changes: FontTokensUpdate): void;

setEndState(lineNumber: number, state: IState): void;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/languages/nullTokenize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export function nullTokenizeEncoded(languageId: LanguageId, state: IState | null
| (ColorId.DefaultBackground << MetadataConsts.BACKGROUND_OFFSET)
) >>> 0;

return new EncodedTokenizationResult(tokens, state === null ? NullState : state);
return new EncodedTokenizationResult(tokens, [], state === null ? NullState : state);
}
31 changes: 31 additions & 0 deletions src/vs/editor/common/languages/supports/tokenization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { Color } from '../../../../base/common/color.js';
import { IFontTokenOptions } from '../../../../platform/theme/common/themeService.js';
import { LanguageId, FontStyle, ColorId, StandardTokenType, MetadataConsts } from '../../encodedTokenAttributes.js';

export interface ITokenThemeRule {
Expand Down Expand Up @@ -422,3 +423,33 @@ export function generateTokensCSSForColorMap(colorMap: readonly Color[]): string
rules.push('.mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }');
return rules.join('\n');
}

export function generateTokensCSSForFontMap(fontMap: readonly IFontTokenOptions[]): string {
const rules: string[] = [];
const fonts = new Set<string>();
for (let i = 1, len = fontMap.length; i < len; i++) {
const font = fontMap[i];
if (!font.fontFamily && !font.fontSize) {
continue;
}
const className = classNameForFontTokenDecorations(font.fontFamily ?? '', font.fontSize ?? '');
if (fonts.has(className)) {
continue;
}
fonts.add(className);
let rule = `.${className} {`;
if (font.fontFamily) {
rule += `font-family: ${font.fontFamily};`;
}
if (font.fontSize) {
rule += `font-size: ${font.fontSize};`;
}
rule += `}`;
rules.push(rule);
}
return rules.join('\n');
}

export function classNameForFontTokenDecorations(fontFamily: string, fontSize: string): string {
return `font-decoration-${fontFamily.toLowerCase()}-${fontSize.toLowerCase()}`;
}
29 changes: 27 additions & 2 deletions src/vs/editor/common/model/decorationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Event } from '../../../base/common/event.js';
import { Range } from '../core/range.js';
import { IModelDecoration } from '../model.js';

Expand All @@ -25,5 +24,31 @@ export interface DecorationProvider {
*/
getAllDecorations(ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[];

readonly onDidChange: Event<void>;
}

export class LineHeightChangingDecoration {

public static toKey(obj: LineHeightChangingDecoration): string {
return `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;
}

constructor(
public readonly ownerId: number,
public readonly decorationId: string,
public readonly lineNumber: number,
public readonly lineHeight: number | null
) { }
}

export class LineFontChangingDecoration {

public static toKey(obj: LineFontChangingDecoration): string {
return `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;
}

constructor(
public readonly ownerId: number,
public readonly decorationId: string,
public readonly lineNumber: number
) { }
}
54 changes: 28 additions & 26 deletions src/vs/editor/common/model/textModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import { PieceTreeTextBuffer } from './pieceTreeTextBuffer/pieceTreeTextBuffer.j
import { PieceTreeTextBufferBuilder } from './pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js';
import { SearchParams, TextModelSearch } from './textModelSearch.js';
import { AttachedViews } from './tokens/abstractSyntaxTokenBackend.js';
import { TokenizationFontDecorationProvider } from './tokens/tokenizationFontDecorationsProvider.js';
import { LineFontChangingDecoration, LineHeightChangingDecoration } from './decorationProvider.js';
import { TokenizationTextModelPart } from './tokens/tokenizationTextModelPart.js';

export function createTextBufferFactory(text: string): model.ITextBufferFactory {
Expand Down Expand Up @@ -292,6 +294,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
private _decorations: { [decorationId: string]: IntervalNode };
private _decorationsTree: DecorationsTrees;
private readonly _decorationProvider: ColorizedBracketPairsDecorationProvider;
private readonly _fontTokenDecorationsProvider: TokenizationFontDecorationProvider;
//#endregion

private readonly _tokenizationTextModelPart: TokenizationTextModelPart;
Expand Down Expand Up @@ -366,6 +369,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
languageId,
this._attachedViews
);
this._fontTokenDecorationsProvider = this._register(new TokenizationFontDecorationProvider(this, this._tokenizationTextModelPart));

this._isTooLargeForSyncing = (bufferTextLength > TextModel._MODEL_SYNC_LIMIT);

Expand All @@ -392,6 +396,18 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
this._onDidChangeDecorations.fire();
this._onDidChangeDecorations.endDeferredEmit();
}));
this._register(this._fontTokenDecorationsProvider.onDidChangeLineHeight((affectedLineHeights) => {
this._onDidChangeDecorations.beginDeferredEmit();
this._onDidChangeDecorations.fire();
this._fireOnDidChangeLineHeight(affectedLineHeights);
this._onDidChangeDecorations.endDeferredEmit();
}));
this._register(this._fontTokenDecorationsProvider.onDidChangeFont((affectedFontLines) => {
this._onDidChangeDecorations.beginDeferredEmit();
this._onDidChangeDecorations.fire();
this._fireOnDidChangeFont(affectedFontLines);
this._onDidChangeDecorations.endDeferredEmit();
}));

this._languageService.requestRichLanguageFeatures(languageId);

Expand Down Expand Up @@ -454,6 +470,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
}
this._tokenizationTextModelPart.handleDidChangeContent(change);
this._bracketPairs.handleDidChangeContent(change);
this._fontTokenDecorationsProvider.handleDidChangeContent(change);
this._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));
}

Expand Down Expand Up @@ -1630,11 +1647,19 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
const lineChangeEvents = affectedLines.map(lineNumber => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));
this._onDidChangeInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));
}
this._fireOnDidChangeLineHeight(affectedLineHeights);
this._fireOnDidChangeFont(affectedFontLines);
}

private _fireOnDidChangeLineHeight(affectedLineHeights: Set<LineHeightChangingDecoration> | null): void {
if (affectedLineHeights && affectedLineHeights.size > 0) {
const affectedLines = Array.from(affectedLineHeights);
const lineHeightChangeEvent = affectedLines.map(specialLineHeightChange => new ModelLineHeightChanged(specialLineHeightChange.ownerId, specialLineHeightChange.decorationId, specialLineHeightChange.lineNumber, specialLineHeightChange.lineHeight));
this._onDidChangeLineHeight.fire(new ModelLineHeightChangedEvent(lineHeightChangeEvent));
}
}

private _fireOnDidChangeFont(affectedFontLines: Set<LineFontChangingDecoration> | null): void {
if (affectedFontLines && affectedFontLines.size > 0) {
const affectedLines = Array.from(affectedFontLines);
const fontChangeEvent = affectedLines.map(fontChange => new ModelFontChanged(fontChange.ownerId, fontChange.lineNumber));
Expand Down Expand Up @@ -1795,6 +1820,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati

const decorations = this._getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);
pushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation));
pushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(range, ownerId, filterOutValidation));
return decorations;
}

Expand All @@ -1803,6 +1829,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati

const decorations = this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);
pushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));
pushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));
return decorations;
}

Expand Down Expand Up @@ -1835,6 +1862,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
public getAllDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {
let result = this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, false, false);
result = result.concat(this._decorationProvider.getAllDecorations(ownerId, filterOutValidation));
result = result.concat(this._fontTokenDecorationsProvider.getAllDecorations(ownerId, filterOutValidation));
return result;
}

Expand Down Expand Up @@ -2510,32 +2538,6 @@ function _normalizeOptions(options: model.IModelDecorationOptions): ModelDecorat
return ModelDecorationOptions.createDynamic(options);
}

class LineHeightChangingDecoration {

public static toKey(obj: LineHeightChangingDecoration): string {
return `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;
}

constructor(
public readonly ownerId: number,
public readonly decorationId: string,
public readonly lineNumber: number,
public readonly lineHeight: number | null
) { }
}

class LineFontChangingDecoration {

public static toKey(obj: LineFontChangingDecoration): string {
return `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;
}

constructor(
public readonly ownerId: number,
public readonly decorationId: string,
public readonly lineNumber: number
) { }
}

class DidChangeDecorationsEmitter extends Disposable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { StandardTokenType } from '../../encodedTokenAttributes.js';
import { ILanguageIdCodec } from '../../languages.js';
import { IAttachedView } from '../../model.js';
import { TextModel } from '../textModel.js';
import { IModelContentChangedEvent, IModelTokensChangedEvent } from '../../textModelEvents.js';
import { IModelContentChangedEvent, IModelTokensChangedEvent, IModelFontTokensChangedEvent } from '../../textModelEvents.js';
import { BackgroundTokenizationState } from '../../tokenizationTextModelPart.js';
import { LineTokens } from '../../tokens/lineTokens.js';
import { derivedOpts, IObservable, ISettableObservable, observableSignal, observableValueOpts } from '../../../../base/common/observable.js';
Expand Down Expand Up @@ -145,6 +145,10 @@ export abstract class AbstractSyntaxTokenBackend extends Disposable {
/** @internal, should not be exposed by the text model! */
public readonly onDidChangeTokens: Event<IModelTokensChangedEvent> = this._onDidChangeTokens.event;

protected readonly _onDidChangeFontTokens: Emitter<IModelFontTokensChangedEvent> = this._register(new Emitter<IModelFontTokensChangedEvent>());
/** @internal, should not be exposed by the text model! */
public readonly onDidChangeFontTokens: Event<IModelFontTokensChangedEvent> = this._onDidChangeFontTokens.event;

constructor(
protected readonly _languageIdCodec: ILanguageIdCodec,
protected readonly _textModel: TextModel,
Expand Down
Loading
Loading