Skip to content

Commit

Permalink
Bug 1874363 - [devtools] Remove build-debugger source-editor mapping.…
Browse files Browse the repository at this point in the history
… r=devtools-reviewers,ochameau.

Also remove devtools/client/debugger/src/utils/editor/source-editor.js which wasn't
used an look like a relic of ancient times.

Differential Revision: https://phabricator.services.mozilla.com/D198409
  • Loading branch information
nchevobbe committed Jan 16, 2024
1 parent c7947b6 commit 4dc490f
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 322 deletions.
1 change: 0 additions & 1 deletion devtools/client/debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
},
"dependencies": {
"acorn": "~8.8.2",
"codemirror": "^5.28.0",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-redux": "^5.0.7",
Expand Down
2 changes: 1 addition & 1 deletion devtools/client/debugger/src/utils/editor/create-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

import SourceEditor from "./source-editor";
import SourceEditor from "devtools/client/shared/sourceeditor/editor";
import { features, prefs } from "../prefs";

export function createEditor() {
Expand Down
1 change: 0 additions & 1 deletion devtools/client/debugger/src/utils/editor/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ CompiledModules(
"get-expression.js",
"index.js",
"source-documents.js",
"source-editor.js",
"source-search.js",
"tokens.js",
)
145 changes: 0 additions & 145 deletions devtools/client/debugger/src/utils/editor/source-editor.js

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

import { createEditor } from "../create-editor";
import SourceEditor from "../source-editor";

import { features } from "../../prefs";

describe("createEditor", () => {
test("Returns a SourceEditor", () => {
test("SourceEditor default config", () => {
const editor = createEditor();
expect(editor).toBeInstanceOf(SourceEditor);
expect(editor.opts).toMatchSnapshot();
expect(editor.opts.gutters).not.toContain("CodeMirror-foldgutter");
expect(editor.config).toMatchSnapshot();
expect(editor.config.gutters).not.toContain("CodeMirror-foldgutter");
});

test("Adds codeFolding", () => {
features.codeFolding = true;
const editor = createEditor();
expect(editor).toBeInstanceOf(SourceEditor);
expect(editor.opts).toMatchSnapshot();
expect(editor.opts.gutters).toContain("CodeMirror-foldgutter");
expect(editor.config).toMatchSnapshot();
expect(editor.config.gutters).toContain("CodeMirror-foldgutter");
});
});
160 changes: 0 additions & 160 deletions devtools/client/debugger/src/utils/editor/tests/get-expression.spec.js

This file was deleted.

2 changes: 2 additions & 0 deletions devtools/client/debugger/src/utils/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ if (isNode()) {
pref("devtools.debugger.features.inline-preview", true);
pref("devtools.debugger.features.javascript-tracing", false);
pref("devtools.editor.tabsize", 2);
pref("devtools.editor.expandtab", false);
pref("devtools.editor.autoclosebrackets", false);
}

export const prefs = new PrefsHelper("devtools", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ add_task(async function () {
{ line: 51, column: 39, expression: "#privateVar", result: 2 },
]);

await testPreviews(dbg, "multipleTokens", [
{ line: 81, column: 4, expression: "foo", result: "Object" },
{ line: 81, column: 11, expression: "blip", result: "Object" },
{ line: 82, column: 8, expression: "bar", result: "Object" },
{ line: 84, column: 16, expression: "boom", result: `0` },
]);

await testHoveringInvalidTargetTokens(dbg);

info(
Expand Down
9 changes: 9 additions & 0 deletions devtools/client/debugger/test/mochitest/examples/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@ function invalidTargets() {
const myVar = "foo";
debugger;
return myVar;
}

function multipleTokens() {
var foo = {bar: { baz: "bloop"}}, blip = {boom: 0};
foo || blip
foo.bar;
foo.bar.baz;
foo || blip.boom;
debugger;
}
Loading

0 comments on commit 4dc490f

Please sign in to comment.