Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d6f4096

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
Reveal the error location after on failed verify.
Closes #608 Closes #229 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent a715da3 commit d6f4096

23 files changed

+1541
-388
lines changed

‎arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ import {
298298
} from '../common/protocol/survey-service';
299299
import { WindowContribution } from './theia/core/window-contribution';
300300
import { WindowContribution as TheiaWindowContribution } from '@theia/core/lib/browser/window-contribution';
301+
import { CoreErrorHandler } from './contributions/core-error-handler';
302+
import { CompilerErrors } from './contributions/compiler-errors';
301303

302304
MonacoThemingService.register({
303305
id: 'arduino-theme',
@@ -430,6 +432,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
430432
)
431433
)
432434
.inSingletonScope();
435+
bind(CoreErrorHandler).toSelf().inSingletonScope();
433436

434437
// Serial monitor
435438
bind(MonitorWidget).toSelf();
@@ -694,6 +697,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
694697
Contribution.configure(bind, AddZipLibrary);
695698
Contribution.configure(bind, PlotterFrontendContribution);
696699
Contribution.configure(bind, Format);
700+
Contribution.configure(bind, CompilerErrors);
697701

698702
// Disabled the quick-pick customization from Theia when multiple formatters are available.
699703
// Use the default VS Code behavior, and pick the first one. In the IDE2, clang-format has `exclusive` selectors.

‎arduino-ide-extension/src/browser/arduino-preferences.ts‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,32 @@ export enum UpdateChannel {
1313
Stable = 'stable',
1414
Nightly = 'nightly',
1515
}
16+
export const ErrorRevealStrategyLiterals = [
17+
/**
18+
* Scroll vertically as necessary and reveal a line.
19+
*/
20+
'auto',
21+
/**
22+
* Scroll vertically as necessary and reveal a line centered vertically.
23+
*/
24+
'center',
25+
/**
26+
* Scroll vertically as necessary and reveal a line close to the top of the viewport, optimized for viewing a code definition.
27+
*/
28+
'top',
29+
/**
30+
* Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
31+
*/
32+
'centerIfOutsideViewport',
33+
] as const;
34+
export type ErrorRevealStrategy = typeof ErrorRevealStrategyLiterals[number];
35+
export namespace ErrorRevealStrategy {
36+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
37+
export function is(arg: any): arg is ErrorRevealStrategy {
38+
return !!arg && ErrorRevealStrategyLiterals.includes(arg);
39+
}
40+
export const Default: ErrorRevealStrategy = 'centerIfOutsideViewport';
41+
}
1642

1743
export const ArduinoConfigSchema: PreferenceSchema = {
1844
type: 'object',
@@ -33,6 +59,23 @@ export const ArduinoConfigSchema: PreferenceSchema = {
3359
),
3460
default: false,
3561
},
62+
'arduino.compile.experimental': {
63+
type: 'boolean',
64+
description: nls.localize(
65+
'arduino/preferences/compile.experimental',
66+
'True if the IDE should handle multiple compiler errors. False by default'
67+
),
68+
default: false,
69+
},
70+
'arduino.compile.revealRange': {
71+
enum: [...ErrorRevealStrategyLiterals],
72+
description: nls.localize(
73+
'arduino/preferences/compile.revealRange',
74+
"Adjusts how compiler errors are revealed in the editor after a failed verify/upload. Possible values: 'auto': Scroll vertically as necessary and reveal a line. 'center': Scroll vertically as necessary and reveal a line centered vertically. 'top': Scroll vertically as necessary and reveal a line close to the top of the viewport, optimized for viewing a code definition. 'centerIfOutsideViewport': Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport. The default value is '{0}'.",
75+
ErrorRevealStrategy.Default
76+
),
77+
default: ErrorRevealStrategy.Default,
78+
},
3679
'arduino.compile.warnings': {
3780
enum: [...CompilerWarningLiterals],
3881
description: nls.localize(
@@ -196,6 +239,8 @@ export const ArduinoConfigSchema: PreferenceSchema = {
196239
export interface ArduinoConfiguration {
197240
'arduino.language.log': boolean;
198241
'arduino.compile.verbose': boolean;
242+
'arduino.compile.experimental': boolean;
243+
'arduino.compile.revealRange': ErrorRevealStrategy;
199244
'arduino.compile.warnings': CompilerWarnings;
200245
'arduino.upload.verbose': boolean;
201246
'arduino.upload.verify': boolean;

‎arduino-ide-extension/src/browser/contributions/burn-bootloader.ts‎

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
import { inject, injectable } from '@theia/core/shared/inversify';
2-
import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
3-
import { CoreService } from '../../common/protocol';
42
import { ArduinoMenus } from '../menu/arduino-menus';
53
import { BoardsDataStore } from '../boards/boards-data-store';
64
import { BoardsServiceProvider } from '../boards/boards-service-provider';
75
import {
8-
SketchContribution,
6+
CoreServiceContribution,
97
Command,
108
CommandRegistry,
119
MenuModelRegistry,
1210
} from './contribution';
1311
import { nls } from '@theia/core/lib/common';
1412

1513
@injectable()
16-
export class BurnBootloader extends SketchContribution {
17-
@inject(CoreService)
18-
protected readonly coreService: CoreService;
19-
20-
14+
export class BurnBootloader extends CoreServiceContribution {
2115
@inject(BoardsDataStore)
2216
protected readonly boardsDataStore: BoardsDataStore;
2317

2418
@inject(BoardsServiceProvider)
2519
protected readonly boardsServiceClientImpl: BoardsServiceProvider;
2620

27-
@inject(OutputChannelManager)
28-
protected override readonly outputChannelManager: OutputChannelManager;
29-
3021
override registerCommands(registry: CommandRegistry): void {
3122
registry.registerCommand(BurnBootloader.Commands.BURN_BOOTLOADER, {
3223
execute: () => this.burnBootloader(),
@@ -62,7 +53,7 @@ export class BurnBootloader extends SketchContribution {
6253
...boardsConfig.selectedBoard,
6354
name: boardsConfig.selectedBoard?.name || '',
6455
fqbn,
65-
}
56+
};
6657
this.outputChannelManager.getChannel('Arduino').clear();
6758
await this.coreService.burnBootloader({
6859
board,
@@ -81,13 +72,7 @@ export class BurnBootloader extends SketchContribution {
8172
}
8273
);
8374
} catch (e) {
84-
let errorMessage = "";
85-
if (typeof e === "string") {
86-
errorMessage = e;
87-
} else {
88-
errorMessage = e.toString();
89-
}
90-
this.messageService.error(errorMessage);
75+
this.handleError(e);
9176
}
9277
}
9378
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /