Skip to content

Commit 2304250

Browse files
committed
Add autoScrollOutput configuration option to automatically reveal and scroll output channel when new logs are added, final fixes before publishing v2.4.0
1 parent 096009a commit 2304250

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
### Added
77
- Implemented on-demand access logging for Tomcat with dynamic log file watching
88
- Added retry mechanism for EBUSY errors during deployment (kills Tomcat process before retry)
9+
- Add `tomcat.autoScrollOutput` configuration option to automatically reveal and scroll output channel when new logs are added
910
- Introduced syntax highlighting rules for Tomcat HTTP logs and admin actions
1011

1112
### Fixed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Access via <kbd>Ctrl+,</kbd> → Search "Tomcat"
143143
| `tomcat.browser` | `Google Chrome` | Browser for app launch & debug (`Google Chrome`, `Microsoft Edge`, `Firefox`, `Safari`, `Brave`, `Opera`) |
144144
| `tomcat.port` | `8080` | Tomcat server listen port (valid range: `1024`-`65535`) |
145145
| `tomcat.protectedWebApps` | `["ROOT", "docs", "examples", "manager", "host-manager"]` | List of protected web apps during cleanup operations |
146+
| `tomcat.autoScrollOutput` | `true` | Automatically reveal and scroll output channel when new logs are added |
146147

147148
> ℹ️ `tomcat.home` and `tomcat.javaHome` are now auto-detected and hidden from user settings.
148149
@@ -173,6 +174,9 @@ For technical implementation details and contribution guidelines, see:
173174
- **HTTP Traffic Insights**
174175
New real-time access log monitoring with dynamic file watching capabilities
175176

177+
- **Enhanced Debugging Experience**
178+
Added `tomcat.autoScrollOutput` setting to automatically scroll output channel logs disable if it interferes with your workflow
179+
176180
- **Enhanced Deployment Reliability**
177181
Added automatic retry mechanism for busy resource errors with process cleanup
178182

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@
166166
"errorMessage": "Port must be between 1024-49151",
167167
"description": "The port number for the Tomcat server, allowed range is 1024-49151."
168168
},
169+
"tomcat.autoScrollOutput": {
170+
"type": "boolean",
171+
"default": true,
172+
"description": "Automatically reveal and scroll output channel when new logs are added. Disable to prevent automatic panel focus changes."
173+
},
169174
"tomcat.home": {
170175
"type": "string",
171176
"default": "",

src/extension.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,11 @@ import { Browser } from './utils/Browser';
7070
* - Environment information
7171
*/
7272
export function activate(context: vscode.ExtensionContext) {
73-
// Initialize core services using singleton pattern
7473
const builder = Builder.getInstance();
7574
const tomcat = Tomcat.getInstance();
7675

77-
// Configure editor syntax highlighting
7876
addSyntaxColoringRules();
7977

80-
// Register command palette entries
8178
context.subscriptions.push(
8279
vscode.commands.registerCommand('tomcat.start', () => tomcat.start(true)),
8380
vscode.commands.registerCommand('tomcat.stop', () => tomcat.stop(true)),
@@ -143,7 +140,6 @@ export function deactivate() {
143140
* - Scope metadata
144141
*/
145142
function updateSettings(event: vscode.ConfigurationChangeEvent) {
146-
// Cascading configuration updates based on changed settings
147143
if (event.affectsConfiguration('tomcat.home')) {
148144
Tomcat.getInstance().findTomcatHome();
149145
Builder.getInstance().updateConfig();
@@ -164,5 +160,8 @@ function updateSettings(event: vscode.ConfigurationChangeEvent) {
164160

165161
} else if (event.affectsConfiguration('tomcat.browser')) {
166162
Browser.getInstance().updateConfig();
163+
164+
} else if (event.affectsConfiguration('tomcat.autoScrollOutput')) {
165+
Logger.getInstance().updateConfig();
167166
}
168167
}

src/utils/Logger.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export class Logger {
6767
private static instance: Logger;
6868
private tomcatHome: string;
6969
private autoDeployMode: string;
70+
private autoScrollOutput: boolean;
7071
private outputChannel: vscode.OutputChannel;
7172
private statusBarItem?: vscode.StatusBarItem;
7273
private currentLogFile: string | null = null;
@@ -84,7 +85,8 @@ export class Logger {
8485
*/
8586
private constructor() {
8687
this.tomcatHome = vscode.workspace.getConfiguration().get<string>('tomcat.home', '');
87-
this.autoDeployMode = vscode.workspace.getConfiguration().get<string>('tomcat.autoDeployMode', 'Disabled');
88+
this.autoDeployMode = vscode.workspace.getConfiguration().get<string>('tomcat.autoDeployMode', 'Disabled');
89+
this.autoScrollOutput = vscode.workspace.getConfiguration().get<boolean>('tomcat.autoScrollOutput', true);
8890
this.outputChannel = vscode.window.createOutputChannel('Tomcat', 'tomcat-log');
8991
}
9092

@@ -116,6 +118,7 @@ export class Logger {
116118
public updateConfig(): void {
117119
this.tomcatHome = vscode.workspace.getConfiguration().get<string>('tomcat.home', '');
118120
this.autoDeployMode = vscode.workspace.getConfiguration().get<string>('tomcat.autoDeployMode', 'Disabled');
121+
this.autoScrollOutput = vscode.workspace.getConfiguration().get<boolean>('tomcat.autoScrollOutput', true);
119122
}
120123

121124
/**
@@ -445,10 +448,8 @@ export class Logger {
445448
const timestamp = new Date().toLocaleString();
446449
const formattedMessage = `[${timestamp}] [${level}] ${message}`;
447450

448-
// Write to output channel
449451
this.outputChannel.appendLine(formattedMessage);
450452

451-
// Conditionally show UI notification
452453
if (showUI) {
453454
showUI(message).then(selection => {
454455
if (selection) {
@@ -457,8 +458,7 @@ export class Logger {
457458
});
458459
}
459460

460-
// Automatically show errors in output channel
461-
if (level === 'ERROR' || level === 'WARN') {
461+
if (this.autoScrollOutput || level === 'ERROR' || level === 'WARN') {
462462
this.outputChannel.show(true);
463463
}
464464
}

0 commit comments

Comments
 (0)