Experiment with switching markdown extension to use native privates

Let's try this out with one extension to start
This commit is contained in:
Matt Bierner
2026-03-10 23:13:16 -07:00
parent 6597286e32
commit 7df46143a1
43 changed files with 845 additions and 690 deletions

View File

@@ -5,27 +5,27 @@
import { getElementsForSourceLine } from './scroll-sync';
export class ActiveLineMarker {
private _current: any;
#current: any;
onDidChangeTextEditorSelection(line: number, documentVersion: number) {
const { previous } = getElementsForSourceLine(line, documentVersion);
this._update(previous && (previous.codeElement || previous.element));
this.#update(previous && (previous.codeElement || previous.element));
}
private _update(before: HTMLElement | undefined) {
this._unmarkActiveElement(this._current);
this._markActiveElement(before);
this._current = before;
#update(before: HTMLElement | undefined) {
this.#unmarkActiveElement(this.#current);
this.#markActiveElement(before);
this.#current = before;
}
private _unmarkActiveElement(element: HTMLElement | undefined) {
#unmarkActiveElement(element: HTMLElement | undefined) {
if (!element) {
return;
}
element.classList.toggle('code-active-line', false);
}
private _markActiveElement(element: HTMLElement | undefined) {
#markActiveElement(element: HTMLElement | undefined) {
if (!element) {
return;
}