goto line functionality
a user has requested goto line functionality similar to the old debugger
something like adding :100 in the search field to go to line 100
this should be easy to implement using the selectLocation functionality using the current source.
GIST
diff --git a/src/components/App.js b/src/components/App.js
index 1dd5132..ed7e64e 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -100,6 +100,13 @@ class App extends Component {
L10N.getStr("symbolSearch.search.key2"),
this.toggleSymbolModal
);
+
+ // cmd g should toggle go to line
+ shortcuts.on(
+ L10N.getStr("symbolSearch.search.key2"),
+ this.toggleSymbolModal
+ );
+
shortcuts.on("Escape", this.onEscape);
}
@@ -143,6 +150,30 @@ class App extends Component {
setActiveSearch("symbol");
}
+ toggleGoToLineModal(_, e: SyntheticEvent) {
+ const {
+ selectedSource,
+ activeSearch,
+ closeActiveSearch,
+ setActiveSearch
+ } = this.props;
+
+ e.preventDefault();
+ e.stopPropagation();
+
+ // this is beautiful. we don't wan to topen if there is no source :)
+ // yay
+ if (!selectedSource) {
+ return;
+ }
+
+ if (activeSearch == "symbol") {
+ return closeActiveSearch();
+ }
+
+ setActiveSearch("line");
+ }
+
onLayoutChange() {
if (isVisible()) {
this.setState({ horizontal: verticalLayoutBreakpoint.matches });
diff --git a/src/components/SymbolModal.js b/src/components/SymbolModal.js
index e515a1b..9db62fa 100644
--- a/src/components/SymbolModal.js
+++ b/src/components/SymbolModal.js
@@ -1,5 +1,10 @@
// @flow
+// copy this file and re-name it to go to line
+
+// the key detail is that enter should call the action `selectSource` with the current
+// selected source and the line
+
import PropTypes from "prop-types";
import React, { Component } from "react";
import { connect } from "react-redux";
Agreed, lets find a good UI for this. Chrome uses ctrl+g which is the standard shortcut. They also use their modal, which is a good pattern here. I think they had an alert box until recently :)
Another argument for using the modal is that when we do the editor UX we can implement our unified modal vision, where the prefix ":" triggers line mode, "@" triggers function mode, ...

I'd like that (: triggering line mode, etc.) ! IMO # should trigger the function mode though, like before.
Yes, i was thinking this would be nice too
Hi everyone! I am looking for my first bug and I am interested to contribute and explore React. I am wondering if this is a good idea to start on this one or would you recommend me some other bug to start with?
@svitlana-galianova we're doing a meetup tonight, i think some people might start it then
/claim
at @jasonLaster 's suggestion I'm taking a look at this one, got a bit of a diff going, I'll update soon! Will likely have questions :)
Thanks for claiming the issue! :wave:
Here are some link for getting setup, contributing, and development tips. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
This was landed. So I'm going to close it.
Sorry to comment on a closed ticket but I cannot find how to use this feature, with Firefox 58.0b4 (I was told this landed in Firefox 58) ?
yep, cmd+: