Created
October 30, 2020 21:37
-
-
Save jasonLaster/92f8534dcbeeb12b2f1f1a307e9fcc5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/devtools/client/debugger/src/actions/breakpoints/index.js b/src/devtools/client/debugger/src/actions/breakpoints/index.js | |
| index 67993947..30a721df 100644 | |
| --- a/src/devtools/client/debugger/src/actions/breakpoints/index.js | |
| +++ b/src/devtools/client/debugger/src/actions/breakpoints/index.js | |
| @@ -205,9 +205,15 @@ export function addBreakpointAtLine(cx, line, shouldLog = false, disabled = fals | |
| line, | |
| }; | |
| + const selectedSource = getSelectedSourceWithContent(state); | |
| + const symbols = selectedSource ? getSymbols(state, selectedSource) : null; | |
| + cursorPosition: getCursorPosition(state), | |
| + | |
| const options = {}; | |
| const file = source.url.split("/").pop(); | |
| - options.logValue = `"${file}:${line}"`; | |
| + const firstOption = `"${file}:${line}"`; | |
| + const secondOpton = getClosestFunction(sysmbols, cursorPosition) | |
| + options.logValue = secondOpton || firstOption | |
| return dispatch(addBreakpoint(cx, breakpointLocation, options, disabled)); | |
| }; | |
| diff --git a/src/devtools/client/debugger/src/components/PrimaryPanes/Outline.js b/src/devtools/client/debugger/src/components/PrimaryPanes/Outline.js | |
| index 8e4adaff..bc0f45db 100644 | |
| --- a/src/devtools/client/debugger/src/components/PrimaryPanes/Outline.js | |
| +++ b/src/devtools/client/debugger/src/components/PrimaryPanes/Outline.js | |
| @@ -80,26 +80,7 @@ export class Outline extends Component { | |
| setFocus(cursorPosition) { | |
| const { symbols } = this.props; | |
| - let classes = []; | |
| - let functions = []; | |
| - | |
| - if (symbols && !symbols.loading) { | |
| - ({ classes, functions } = symbols); | |
| - } | |
| - | |
| - // Find items that enclose the selected location | |
| - const enclosedItems = [...functions, ...classes].filter( | |
| - item => item.name != "anonymous" && containsPosition(item.location, cursorPosition) | |
| - ); | |
| - | |
| - if (enclosedItems.length == 0) { | |
| - return this.setState({ focusedItem: null }); | |
| - } | |
| - | |
| - // Find the closest item to the selected location to focus | |
| - const closestItem = enclosedItems.reduce((item, closest) => | |
| - positionAfter(item.location, closest.location) ? item : closest | |
| - ); | |
| + getClosestFunction(symbols, cursorPosition) | |
| this.setState({ focusedItem: closestItem }); | |
| } | |
| @@ -311,6 +292,7 @@ export class Outline extends Component { | |
| const mapStateToProps = state => { | |
| const selectedSource = getSelectedSourceWithContent(state); | |
| const symbols = selectedSource ? getSymbols(state, selectedSource) : null; | |
| + cursorPosition: getCursorPosition(state), | |
| return { | |
| cx: getContext(state), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment