Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion configs/firefox-panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"codeCoverage": { "enabled": false },
"codeFolding": { "enabled": false },
"searchNav": { "enabled": true },
"collapseFrame": { "enabled": true }
"collapseFrame": { "enabled": true },
"columnBreakpoints": { "enabled": true }
}
}
2 changes: 2 additions & 0 deletions src/actions/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { clearDocuments } from "../utils/editor";
import { getSources } from "../reducers/sources";
import { waitForMs } from "../utils/utils";
import { newSources } from "./sources";
import { clearSymbols } from "../utils/parser";

/**
* Redux actions for the navigation state
Expand All @@ -16,6 +17,7 @@ export function willNavigate(_, event) {
return async function({ dispatch, getState, client, sourceMaps }: ThunkArgs) {
await sourceMaps.clearSourceMaps();
clearDocuments();
clearSymbols();

dispatch(navigate(event.url));
};
Expand Down
1 change: 1 addition & 0 deletions src/actions/tests/__snapshots__/ast.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Object {

exports[`ast setSymbols when the source is loaded should be able to set symbols 1`] = `
Object {
"callExpressions": Array [],
"comments": Array [],
"functions": Array [
Object {
Expand Down
46 changes: 46 additions & 0 deletions src/components/Editor/CallSite.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.call-site {
background: #f0f9ff;
cursor: pointer;
position: relative;
}

.call-site::before {
content: "";
position: absolute;
width: 100%;
height: calc(100% - 2px);
border-bottom: 2px solid #aed3ef;
}

.call-site-bp {
cursor: pointer;
position: relative;
}

.debug-expression.call-site-bp, .call-site-bp {
background-color: #fce7e7;
}

.call-site-bp::before {
content: "";
position: absolute;
width: 100%;
height: calc(100% - 2px);
border-bottom: 2px solid red;
}

.theme-dark .call-site {
background-color: #4b5462;
}

.theme-dark .call-site::before {
border-bottom-color: #5f78a4;
}

.theme-dark .call-site-bp {
background-color: #4b3f3f;
}

.theme-dark .call-site-bp::before {
border-bottom-color: #dd4d4d;
}
95 changes: 95 additions & 0 deletions src/components/Editor/CallSite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// @flow
import { Component } from "react";

import { markText } from "../../utils/editor";
require("./CallSite.css");

type MarkerType = {
clear: Function
};

type props = {
callSite: Object,
editor: Object,
breakpoint: Object,
showCallSite: Boolean
};
export default class CallSite extends Component {
props: props;

addCallSite: Function;
marker: ?MarkerType;

constructor() {
super();

this.marker = undefined;
const self: any = this;
self.addCallSite = this.addCallSite.bind(this);
self.clearCallSite = this.clearCallSite.bind(this);
}

addCallSite(nextProps: props) {
const { editor, callSite, breakpoint } = nextProps || this.props;
const className = !breakpoint ? "call-site" : "call-site-bp";
this.marker = markText(editor, className, callSite.location);
}

clearCallSite() {
if (this.marker) {
this.marker.clear();
this.marker = null;
}
}

shouldComponentUpdate(nextProps: any) {
return this.props.editor !== nextProps.editor;
}

componentDidMount() {
const { breakpoint, editor, showCallSite } = this.props;
if (!editor) {
return;
}

if (!breakpoint && !showCallSite) {
return;
}

this.addCallSite();
}

componentWillReceiveProps(nextProps: props) {
const { breakpoint, showCallSite } = this.props;

if (nextProps.breakpoint !== breakpoint) {
if (this.marker) {
this.marker.clear();
}
this.addCallSite(nextProps);
}

if (nextProps.showCallSite !== showCallSite) {
if (nextProps.showCallSite) {
if (!this.marker) {
this.addCallSite();
}
} else if (!nextProps.breakpoint) {
this.clearCallSite();
}
}
}

componentWillUnmount() {
if (!this.props.editor || !this.marker) {
return;
}
this.marker.clear();
}

render() {
return null;
}
}

CallSite.displayName = "CallSite";
Loading