Bug 1953415 - [devtools] Remove CM5 code related to the Highlight Lines Component r=devtools-reviewers,ochameau

Differential Revision: https://phabricator.services.mozilla.com/D250294
This commit is contained in:
Hubert Boma Manilla
2025-05-23 10:38:50 +00:00
committed by hmanilla@mozilla.com
parent 792d117b92
commit f9f60e8571

View File

@@ -9,7 +9,6 @@
import { Component } from "devtools/client/shared/vendor/react";
import PropTypes from "devtools/client/shared/vendor/react-prop-types";
import { features } from "../../utils/prefs";
import { markerTypes } from "../../constants";
class HighlightLines extends Component {
@@ -40,64 +39,29 @@ class HighlightLines extends Component {
clearHighlightRange() {
const { range, editor } = this.props;
if (!range) {
if (!range || !editor) {
return;
}
if (features.codemirrorNext) {
if (editor) {
editor.removeLineContentMarker("multi-highlight-line-marker");
}
return;
}
const { codeMirror } = editor;
if (!codeMirror) {
return;
}
const { start, end } = range;
codeMirror.operation(() => {
for (let line = start - 1; line < end; line++) {
codeMirror.removeLineClass(line, "wrap", "highlight-lines");
}
});
editor.removeLineContentMarker("multi-highlight-line-marker");
}
highlightLineRange = () => {
const { range, editor } = this.props;
if (!range) {
if (!range || !editor) {
return;
}
if (features.codemirrorNext) {
if (editor) {
editor.scrollTo(range.start, 0);
const lines = [];
for (let line = range.start; line <= range.end; line++) {
lines.push({ line });
}
editor.setLineContentMarker({
id: markerTypes.MULTI_HIGHLIGHT_LINE_MARKER,
lineClassName: "highlight-lines",
lines,
});
}
return;
editor.scrollTo(range.start, 0);
const lines = [];
for (let line = range.start; line <= range.end; line++) {
lines.push({ line });
}
const { codeMirror } = editor;
if (!codeMirror) {
return;
}
const { start, end } = range;
codeMirror.operation(() => {
editor.alignLine(start);
for (let line = start - 1; line < end; line++) {
codeMirror.addLineClass(line, "wrap", "highlight-lines");
}
editor.setLineContentMarker({
id: markerTypes.MULTI_HIGHLIGHT_LINE_MARKER,
lineClassName: "highlight-lines",
lines,
});
};