@@ -139,6 +139,60 @@ export function selectLocation(location: Location) {
139139 } ;
140140}
141141
142+ /**
143+ * @memberof actions/sources
144+ * @static
145+ */
146+ export function selectSpecificLocation ( location : Location ) {
147+ return async ( { dispatch, getState, client } : ThunkArgs ) => {
148+ if ( ! client ) {
149+ // No connection, do nothing. This happens when the debugger is
150+ // shut down too fast and it tries to display a default source.
151+ return ;
152+ }
153+
154+ const source = getSource ( getState ( ) , location . sourceId ) ;
155+ if ( ! source ) {
156+ // If there is no source we deselect the current selected source
157+ return dispatch ( { type : "CLEAR_SELECTED_SOURCE" } ) ;
158+ }
159+
160+ const activeSearch = getActiveSearch ( getState ( ) ) ;
161+ if ( activeSearch !== "file" ) {
162+ dispatch ( closeActiveSearch ( ) ) ;
163+ }
164+
165+ dispatch ( addTab ( source . toJS ( ) , 0 ) ) ;
166+
167+ dispatch ( {
168+ type : "SELECT_SOURCE" ,
169+ source : source . toJS ( ) ,
170+ location
171+ } ) ;
172+
173+ await dispatch ( loadSourceText ( source ) ) ;
174+ const selectedSource = getSelectedSource ( getState ( ) ) ;
175+ if ( ! selectedSource ) {
176+ return ;
177+ }
178+
179+ const sourceId = selectedSource . get ( "id" ) ;
180+ dispatch ( setSymbols ( sourceId ) ) ;
181+ dispatch ( setOutOfScopeLocations ( ) ) ;
182+ } ;
183+ }
184+
185+ /**
186+ * @memberof actions/sources
187+ * @static
188+ */
189+ export function selectSpecificSource ( sourceId : string ) {
190+ return async ( { dispatch } : ThunkArgs ) => {
191+ const location = createLocation ( { sourceId } ) ;
192+ return await dispatch ( selectSpecificLocation ( location ) ) ;
193+ } ;
194+ }
195+
142196/**
143197 * @memberof actions/sources
144198 * @static
0 commit comments