Skip to content

Commit 65445a9

Browse files
committed
feat(log): draw focus sometimes on log channel
Fixes #744
1 parent 1627b79 commit 65445a9

File tree

5 files changed

+9
-2
lines changed

5 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4949

5050
### Changed
5151

52+
- Changed logger to draw focus on certain error messages
53+
([#744](https://github.com/fortran-lang/vscode-fortran-support/issues/744))
5254
- Changed the way extension Release Notes are displayed
5355
([#723](https://github.com/fortran-lang/vscode-fortran-support/issues/723))
5456
- Changed the activation events of the extension to include the `onCommand` for all register commands

src/features/formatting-provider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
5050
this.logger.error(
5151
`[format] fprettify can only format FortranFreeForm, change to findent for FortranFixedForm formatting`
5252
);
53+
this.logger.show(true); // Keep focus on editor
5354
return undefined;
5455
}
5556
return this.spawnFormatBase(document, 'fprettify', ['--stdout']);
@@ -101,6 +102,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
101102

102103
if (!FORMATTERS.includes(this.formatter)) {
103104
this.logger.error(`[format] Unsupported formatter: ${this.formatter}`);
105+
this.logger.show(true); // Keep focus on editor
104106
}
105107
return this.formatter;
106108
}

src/features/linter-provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ export class FortranLintingProvider {
430430
return;
431431
} catch (err) {
432432
this.logger.error(`[build] Compiling ${textDocument.fileName} failed:`, err);
433+
this.logger.show(true); // Keep focus on editor
433434
console.error(`ERROR: ${err}`);
434435
}
435436
}

src/lsp/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ export class FortlsClient {
265265
const results = spawnSync(executablePath, args.concat(['--version']));
266266
if (results.error) {
267267
this.logger.error(`[lsp.client] Unable to launch LS to check version:`, results.error);
268+
this.logger.show();
268269
const selected = window.showErrorMessage(
269270
'Modern Fortran Error starting fortls: Check that fortls is in your PATH or that "fortran.fortls.path" is pointing to a fortls binary.',
270271
'Settings',
@@ -282,6 +283,7 @@ export class FortlsClient {
282283
}
283284
if (results.status !== 0) {
284285
this.logger.error(`[lsp.client] Unable to verify input arguments with LS:`);
286+
this.logger.show();
285287
const selected = window.showErrorMessage(
286288
'Error launching fortls: Please check that all selected options are supported by your language server version.',
287289
'Settings',

src/services/logging.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export class Logger {
7171
}
7272
}
7373

74-
public show() {
75-
this.channel.show();
74+
public show(preserveFocus?: boolean) {
75+
this.channel.show(preserveFocus);
7676
}
7777

7878
private logObject(data: unknown): void {

0 commit comments

Comments
 (0)