Skip to content

Commit

Permalink
Added variables for file (base)name w/o extension
Browse files Browse the repository at this point in the history
fix #71
  • Loading branch information
WebFreak001 committed Aug 26, 2016
1 parent 5a84af0 commit 6ead793
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
},
"main": "./out/src/frontend/extension",
"activationEvents": [
"onCommand:code-debug.examineMemoryLocation"
"onCommand:code-debug.examineMemoryLocation",
"onCommand:code-debug.getFileNameNoExt",
"onCommand:code-debug.getFileBasenameNoExt"
],
"categories": [
"Debuggers"
Expand Down Expand Up @@ -50,6 +52,10 @@
"asm"
]
},
"variables": {
"FileBasenameNoExt": "code-debug.getFileBasenameNoExt",
"FileNameNoExt": "code-debug.getFileNameNoExt"
},
"configurationAttributes": {
"launch": {
"required": [
Expand Down Expand Up @@ -216,6 +222,10 @@
"program": "./out/src/lldb.js",
"runtime": "node",
"label": "LLDB",
"variables": {
"FileBasenameNoExt": "code-debug.getFileBasenameNoExt",
"FileNameNoExt": "code-debug.getFileNameNoExt"
},
"enableBreakpointsFor": {
"languageIds": [
"c",
Expand Down Expand Up @@ -399,6 +409,10 @@
"program": "./out/src/mago.js",
"runtime": "node",
"label": "Mago-MI",
"variables": {
"FileBasenameNoExt": "code-debug.getFileBasenameNoExt",
"FileNameNoExt": "code-debug.getFileNameNoExt"
},
"enableBreakpointsFor": {
"languageIds": [
"d"
Expand Down
20 changes: 20 additions & 0 deletions src/frontend/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ import * as os from "os";
export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.workspace.registerTextDocumentContentProvider("debugmemory", new MemoryContentProvider()));
context.subscriptions.push(vscode.commands.registerCommand("code-debug.examineMemoryLocation", examineMemory));
context.subscriptions.push(vscode.commands.registerCommand("code-debug.getFileNameNoExt", () => {
if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document || !vscode.window.activeTextEditor.document.fileName)
{
vscode.window.showErrorMessage("No editor with valid file name active");
return;
}
var fileName = vscode.window.activeTextEditor.document.fileName;
var ext = path.extname(fileName);
return fileName.substr(0, fileName.length - ext.length);
}));
context.subscriptions.push(vscode.commands.registerCommand("code-debug.getFileBasenameNoExt", () => {
if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document || !vscode.window.activeTextEditor.document.fileName)
{
vscode.window.showErrorMessage("No editor with valid file name active");
return;
}
var fileName = path.basename(vscode.window.activeTextEditor.document.fileName);
var ext = path.extname(fileName);
return fileName.substr(0, fileName.length - ext.length);
}));
}

var memoryLocationRegex = /^0x[0-9a-f]+$/;
Expand Down

0 comments on commit 6ead793

Please sign in to comment.