Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit e6f9968

Browse files
jainsneha23bomsy
authored andcommitted
Fix 4690 [PrettyPrint] enable “Jump to Generated Location" (#4698)
* Bug #4690 fix. * bug fix * tabs changed to source * fix * fix
1 parent 08519dc commit e6f9968

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/components/Editor/EditorMenu.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
44

55
import { PureComponent } from "react";
6-
import { showMenu } from "devtools-contextmenu";
7-
import { isOriginalId, isGeneratedId } from "devtools-source-map";
6+
import { showMenu } from "devtools-launchpad";
7+
import { isOriginalId } from "devtools-source-map";
88
import { copyToTheClipboard } from "../../utils/clipboard";
99
import { isPretty } from "../../utils/source";
1010
import { getSourceLocationFromMouseEvent } from "../../utils/editor";
@@ -16,7 +16,8 @@ import {
1616
getContextMenu,
1717
getSelectedLocation,
1818
getSelectedSource,
19-
getSymbols
19+
getSymbols,
20+
getPrettySource
2021
} from "../../selectors";
2122

2223
import actions from "../../actions";
@@ -38,7 +39,8 @@ function getMenuItems(
3839
addExpression,
3940
getFunctionText,
4041
getFunctionLocation,
41-
flashLineRange
42+
flashLineRange,
43+
hasPrettyPrint
4244
}
4345
) {
4446
const copySourceLabel = L10N.getStr("copySource");
@@ -85,13 +87,16 @@ function getMenuItems(
8587
);
8688

8789
const isOriginal = isOriginalId(selectedLocation.sourceId);
88-
const hasSourceMap = selectedSource.get("sourceMapURL");
90+
const hasSourceMap = !!selectedSource.get("sourceMapURL");
8991
const isPrettyPrinted = isPretty(selectedSource.toJS());
9092

93+
const isPrettified = isPrettyPrinted || hasPrettyPrint;
94+
const isMapped = isOriginal || hasSourceMap;
95+
9196
const jumpLabel = {
9297
id: "node-menu-jump",
9398
accesskey: L10N.getStr("editor.jumpToMappedLocation1.accesskey"),
94-
disabled: isGeneratedId && !hasSourceMap,
99+
disabled: !isMapped && !isPrettified,
95100
label: L10N.getFormatStr(
96101
"editor.jumpToMappedLocation1",
97102
isOriginal ? L10N.getStr("generated") : L10N.getStr("original")
@@ -193,6 +198,7 @@ export default connect(
193198
return {
194199
selectedLocation: getSelectedLocation(state),
195200
selectedSource,
201+
hasPrettyPrint: !!getPrettySource(state, selectedSource.get("id")),
196202
contextMenu: getContextMenu(state),
197203
getFunctionText: line =>
198204
findFunctionText(

0 commit comments

Comments
 (0)