symbols.js (1211B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 import { loadSourceText } from "./loadSourceText"; 6 import { getEditor } from "../../utils/editor/index"; 7 8 export function getOriginalFunctionDisplayName(location) { 9 return async ({ dispatch }) => { 10 // Make sure the source for the symbols exist. 11 await dispatch(loadSourceText(location.source, location.sourceActor)); 12 const editor = getEditor(); 13 return editor.getClosestFunctionName(location); 14 }; 15 } 16 17 export function getFunctionSymbols(location, maxResults) { 18 return async ({ dispatch }) => { 19 // Make sure the source for the symbols exist. 20 await dispatch(loadSourceText(location.source, location.sourceActor)); 21 const editor = getEditor(); 22 return editor?.getFunctionSymbols(maxResults); 23 }; 24 } 25 26 export function getClassSymbols(location) { 27 return async ({ dispatch }) => { 28 // See comment in getFunctionSymbols 29 await dispatch(loadSourceText(location.source, location.sourceActor)); 30 31 const editor = getEditor(); 32 return editor?.getClassSymbols(); 33 }; 34 }