Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
awelc committed Jan 29, 2025
1 parent 77632f5 commit 6f74254
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ export class Runtime extends EventEmitter {
throw Error(`Cannot find package name in manifest file: ${manifest_path}`);
}

const opendFileExt = path.extname(openedFilePath);
if (opendFileExt !== MOVE_FILE_EXT
&& opendFileExt !== BCODE_FILE_EXT
&& opendFileExt !== JSON_FILE_EXT) {
throw new Error(`File extension: ${opendFileExt} is not supported by trace debugger`);
const openedFileExt = path.extname(openedFilePath);
if (openedFileExt !== MOVE_FILE_EXT
&& openedFileExt !== BCODE_FILE_EXT
&& openedFileExt !== JSON_FILE_EXT) {
throw new Error(`File extension: ${openedFileExt} is not supported by trace debugger`);
}
const showDisassembly = opendFileExt === BCODE_FILE_EXT;
const showDisassembly = openedFileExt === BCODE_FILE_EXT;

// create file maps for all files in the `sources` directory, including both package source
// files and source files for dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const LOG_LEVEL = 'log';
*/
const DEBUGGER_TYPE = 'move-debug';

const MOVE_FILE_EXT = ".move";
const BCODE_FILE_EXT = ".mvb";


/**
* Provider of on-hover information during debug session.
*/
Expand Down Expand Up @@ -84,10 +88,6 @@ export function activate(context: vscode.ExtensionContext) {
const stackFrame: StackFrame = stackTraceResponse.stackFrames[0];
if (stackFrame && stackFrame.source && stackFrame.source.path !== previousSourcePath) {
previousSourcePath = stackFrame.source.path;
const source = stackFrame.source;
const line = stackFrame.line;
console.log(`Frame details: ${source?.name} at line ${line}`);

const editor = vscode.window.activeTextEditor;
if (editor) {
const optimized_lines = stackTraceResponse.optimizedLines;
Expand Down Expand Up @@ -227,13 +227,13 @@ async function findTraceInfo(editor: vscode.TextEditor): Promise<string> {
}

let tracedFunctions: string[] = [];
if (path.extname(editor.document.uri.fsPath) === '.move') {
if (path.extname(editor.document.uri.fsPath) === MOVE_FILE_EXT) {
const pkgModules = findSrcModules(editor.document.getText());
if (pkgModules.length === 0) {
throw new Error(`Cannot find any modules in file '${editor.document.uri.fsPath}'`);
}
tracedFunctions = findTracedFunctionsFromPath(pkgRoot, pkgModules);
} else if (path.extname(editor.document.uri.fsPath) === '.mvb') {
} else if (path.extname(editor.document.uri.fsPath) === BCODE_FILE_EXT) {
const modulePattern = /\bmodule\s+\d+\.\w+\b/g;
const moduleSequences = editor.document.getText().match(modulePattern);
if (!moduleSequences || moduleSequences.length === 0) {
Expand Down

0 comments on commit 6f74254

Please sign in to comment.