Fix #78 (silent ignore on windows)
This commit is contained in:
parent
4829b28df5
commit
4393a315fa
2 changed files with 20 additions and 10 deletions
|
|
@ -8,8 +8,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
context.subscriptions.push(vscode.workspace.registerTextDocumentContentProvider("debugmemory", new MemoryContentProvider()));
|
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.examineMemoryLocation", examineMemory));
|
||||||
context.subscriptions.push(vscode.commands.registerCommand("code-debug.getFileNameNoExt", () => {
|
context.subscriptions.push(vscode.commands.registerCommand("code-debug.getFileNameNoExt", () => {
|
||||||
if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document || !vscode.window.activeTextEditor.document.fileName)
|
if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document || !vscode.window.activeTextEditor.document.fileName) {
|
||||||
{
|
|
||||||
vscode.window.showErrorMessage("No editor with valid file name active");
|
vscode.window.showErrorMessage("No editor with valid file name active");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -18,8 +17,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
return fileName.substr(0, fileName.length - ext.length);
|
return fileName.substr(0, fileName.length - ext.length);
|
||||||
}));
|
}));
|
||||||
context.subscriptions.push(vscode.commands.registerCommand("code-debug.getFileBasenameNoExt", () => {
|
context.subscriptions.push(vscode.commands.registerCommand("code-debug.getFileBasenameNoExt", () => {
|
||||||
if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document || !vscode.window.activeTextEditor.document.fileName)
|
if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document || !vscode.window.activeTextEditor.document.fileName) {
|
||||||
{
|
|
||||||
vscode.window.showErrorMessage("No editor with valid file name active");
|
vscode.window.showErrorMessage("No editor with valid file name active");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -61,11 +59,19 @@ function getMemoryRange(range: string) {
|
||||||
|
|
||||||
function examineMemory() {
|
function examineMemory() {
|
||||||
let socketlists = path.join(os.tmpdir(), "code-debug-sockets");
|
let socketlists = path.join(os.tmpdir(), "code-debug-sockets");
|
||||||
if (!fs.existsSync(socketlists))
|
if (!fs.existsSync(socketlists)) {
|
||||||
return vscode.window.showErrorMessage("No debugging sessions available");
|
if (process.platform == "win32")
|
||||||
fs.readdir(socketlists, (err, files) => {
|
return vscode.window.showErrorMessage("This command is not available on windows");
|
||||||
if (err)
|
else
|
||||||
return vscode.window.showErrorMessage("No debugging sessions available");
|
return vscode.window.showErrorMessage("No debugging sessions available");
|
||||||
|
}
|
||||||
|
fs.readdir(socketlists, (err, files) => {
|
||||||
|
if (err) {
|
||||||
|
if (process.platform == "win32")
|
||||||
|
return vscode.window.showErrorMessage("This command is not available on windows");
|
||||||
|
else
|
||||||
|
return vscode.window.showErrorMessage("No debugging sessions available");
|
||||||
|
}
|
||||||
var pickedFile = (file) => {
|
var pickedFile = (file) => {
|
||||||
vscode.window.showInputBox({ placeHolder: "Memory Location or Range", validateInput: range => getMemoryRange(range) === undefined ? "Range must either be in format 0xF00-0xF01, 0xF100+32 or 0xABC154" : "" }).then(range => {
|
vscode.window.showInputBox({ placeHolder: "Memory Location or Range", validateInput: range => getMemoryRange(range) === undefined ? "Range must either be in format 0xF00-0xF01, 0xF100+32 or 0xABC154" : "" }).then(range => {
|
||||||
vscode.commands.executeCommand("vscode.previewHtml", vscode.Uri.parse("debugmemory://" + file + "#" + getMemoryRange(range)));
|
vscode.commands.executeCommand("vscode.previewHtml", vscode.Uri.parse("debugmemory://" + file + "#" + getMemoryRange(range)));
|
||||||
|
|
@ -75,6 +81,8 @@ function examineMemory() {
|
||||||
pickedFile(files[0]);
|
pickedFile(files[0]);
|
||||||
else if (files.length > 0)
|
else if (files.length > 0)
|
||||||
vscode.window.showQuickPick(files, { placeHolder: "Running debugging instance" }).then(file => pickedFile(file));
|
vscode.window.showQuickPick(files, { placeHolder: "Running debugging instance" }).then(file => pickedFile(file));
|
||||||
|
else if (process.platform == "win32")
|
||||||
|
return vscode.window.showErrorMessage("This command is not available on windows");
|
||||||
else
|
else
|
||||||
vscode.window.showErrorMessage("No debugging sessions available");
|
vscode.window.showErrorMessage("No debugging sessions available");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -65,13 +65,15 @@ export class MI2DebugSession extends DebugSession {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.commandServer.on("error", err => {
|
this.commandServer.on("error", err => {
|
||||||
this.handleMsg("stderr", "Code-Debug WARNING: Utility Command Server: Error in command socket " + err.toString() + "\nCode-Debug WARNING: The examine memory location command won't work");
|
if (process.platform != "win32")
|
||||||
|
this.handleMsg("stderr", "Code-Debug WARNING: Utility Command Server: Error in command socket " + err.toString() + "\nCode-Debug WARNING: The examine memory location command won't work");
|
||||||
});
|
});
|
||||||
if (!fs.existsSync(systemPath.join(os.tmpdir(), "code-debug-sockets")))
|
if (!fs.existsSync(systemPath.join(os.tmpdir(), "code-debug-sockets")))
|
||||||
fs.mkdirSync(systemPath.join(os.tmpdir(), "code-debug-sockets"));
|
fs.mkdirSync(systemPath.join(os.tmpdir(), "code-debug-sockets"));
|
||||||
this.commandServer.listen(systemPath.join(os.tmpdir(), "code-debug-sockets", "Debug-Instance-" + Math.floor(Math.random() * 36 * 36 * 36 * 36).toString(36)));
|
this.commandServer.listen(systemPath.join(os.tmpdir(), "code-debug-sockets", "Debug-Instance-" + Math.floor(Math.random() * 36 * 36 * 36 * 36).toString(36)));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.handleMsg("stderr", "Code-Debug WARNING: Utility Command Server: Failed to start " + e.toString() + "\nCode-Debug WARNING: The examine memory location command won't work");
|
if (process.platform != "win32")
|
||||||
|
this.handleMsg("stderr", "Code-Debug WARNING: Utility Command Server: Failed to start " + e.toString() + "\nCode-Debug WARNING: The examine memory location command won't work");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue