Skip to content

Commit feda303

Browse files
ThomasOrsJakeShirley
authored andcommitted
feat(diagnostics): Add a extension setting to open the diagnostic view on connection (#147)
Adds an extension setting `minecraft-debugger.showDiagnosticViewOnConnect` which when true automatically opens the diagnostic view when a complete connection occurs. If approved possibly worth a mention in the readme? Resolves #145
1 parent 980d901 commit feda303

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,16 @@
159159
"PromptForPort": "extension.minecraft-js.getPort"
160160
}
161161
}
162-
]
162+
],
163+
"configuration": {
164+
"properties": {
165+
"minecraft-debugger.showDiagnosticViewOnConnect": {
166+
"type": "boolean",
167+
"default": false,
168+
"description": "Open the diagnostics view on connection to Minecraft."
169+
}
170+
}
171+
}
163172
},
164173
"scripts": {
165174
"install:all": "npm install && cd webview-ui && npm install",

src/Session.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { DebugProtocol } from '@vscode/debugprotocol';
1717
import { LogOutputEvent, LogLevel } from '@vscode/debugadapter/lib/logger';
1818
import { MessageStreamParser } from './MessageStreamParser';
1919
import { SourceMaps } from './SourceMaps';
20-
import { FileSystemWatcher, window, workspace } from 'vscode';
20+
import { FileSystemWatcher, window, workspace, commands } from 'vscode';
2121
import * as path from 'path';
2222
import * as fs from 'fs';
2323
import { isUUID } from './Utils';
@@ -498,6 +498,11 @@ export class Session extends DebugSession {
498498
// When config is complete VSCode calls 'configurationDoneRequest' and the DA
499499
// sends a 'resume' message to the debugee, which had paused following the attach.
500500
this.sendEvent(new InitializedEvent());
501+
502+
// If the user has set the configuration to show the diagnostic view on connect in settings.json, show it now.
503+
if (workspace.getConfiguration('minecraft-debugger').get('showDiagnosticViewOnConnect')) {
504+
commands.executeCommand('minecraft-debugger.showMinecraftDiagnostics');
505+
}
501506
}
502507

503508
// stop listening for connections

0 commit comments

Comments
 (0)