mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-18 23:59:43 +01:00
Experiment with switching markdown extension to use native privates
Let's try this out with one extension to start
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user