Skip to content

Commit 6dadd17

Browse files
committed
editor.quicksSuggestions.other defaults off
1 parent 067cc87 commit 6dadd17

File tree

13 files changed

+65
-22
lines changed

13 files changed

+65
-22
lines changed

Diff for: arduino-ide-extension/src/browser/boards/boards-service-provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
8787
if (!AttachedBoardsChangeEvent.isEmpty(event)) {
8888
this.logger.info('Attached boards and available ports changed:');
8989
this.logger.info(AttachedBoardsChangeEvent.toString(event));
90-
this.logger.info(`------------------------------------------`);
90+
this.logger.info('------------------------------------------');
9191
}
9292
this._attachedBoards = event.newState.boards;
9393
this._availablePorts = event.newState.ports;

Diff for: arduino-ide-extension/src/browser/contributions/add-zip-library.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class AddZipLibrary extends SketchContribution {
8282
if (name) {
8383
throw new AlreadyInstalledError(`A library folder named ${name} already exists. Do you want to overwrite it?`, name);
8484
} else {
85-
throw new AlreadyInstalledError(`A library already exists. Do you want to overwrite it?`);
85+
throw new AlreadyInstalledError('A library already exists. Do you want to overwrite it?');
8686
}
8787
}
8888
}

Diff for: arduino-ide-extension/src/browser/output-service-impl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class OutputServiceImpl implements OutputService {
1414

1515
append(message: OutputMessage): void {
1616
const { chunk } = message;
17-
const channel = this.outputChannelManager.getChannel(`Arduino`);
17+
const channel = this.outputChannelManager.getChannel('Arduino');
1818
channel.show({ preserveFocus: true });
1919
channel.append(chunk);
2020
}

Diff for: arduino-ide-extension/src/browser/settings.tsx

+34-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface Settings extends Index {
2424
editorFontSize: number; // `editor.fontSize`
2525
themeId: string; // `workbench.colorTheme`
2626
autoSave: 'on' | 'off'; // `editor.autoSave`
27+
quickSuggestions: Record<'other'|'comments'|'strings', boolean>; // `editor.quickSuggestions`
2728

2829
autoScaleInterface: boolean; // `arduino.window.autoScale`
2930
interfaceScale: number; // `arduino.window.zoomLevel` https://github.com/eclipse-theia/theia/issues/8751
@@ -84,6 +85,7 @@ export class SettingsService {
8485
editorFontSize,
8586
themeId,
8687
autoSave,
88+
quickSuggestions,
8789
autoScaleInterface,
8890
interfaceScale,
8991
// checkForUpdates,
@@ -97,6 +99,11 @@ export class SettingsService {
9799
this.preferenceService.get<number>('editor.fontSize', 12),
98100
this.preferenceService.get<string>('workbench.colorTheme', 'arduino-theme'),
99101
this.preferenceService.get<'on' | 'off'>('editor.autoSave', 'on'),
102+
this.preferenceService.get<object>('editor.quickSuggestion', {
103+
'other': false,
104+
'comments': false,
105+
'strings': false
106+
}),
100107
this.preferenceService.get<boolean>('arduino.window.autoScale', true),
101108
this.preferenceService.get<number>('arduino.window.zoomLevel', 0),
102109
// this.preferenceService.get<string>('arduino.ide.autoUpdate', true),
@@ -113,6 +120,7 @@ export class SettingsService {
113120
editorFontSize,
114121
themeId,
115122
autoSave,
123+
quickSuggestions,
116124
autoScaleInterface,
117125
interfaceScale,
118126
// checkForUpdates,
@@ -155,10 +163,10 @@ export class SettingsService {
155163
return `Invalid sketchbook location: ${sketchbookPath}`;
156164
}
157165
if (editorFontSize <= 0) {
158-
return `Invalid editor font size. It must be a positive integer.`;
166+
return 'Invalid editor font size. It must be a positive integer.';
159167
}
160168
if (!ThemeService.get().getThemes().find(({ id }) => id === themeId)) {
161-
return `Invalid theme.`;
169+
return 'Invalid theme.';
162170
}
163171
return true;
164172
} catch (err) {
@@ -175,6 +183,7 @@ export class SettingsService {
175183
editorFontSize,
176184
themeId,
177185
autoSave,
186+
quickSuggestions,
178187
autoScaleInterface,
179188
interfaceScale,
180189
// checkForUpdates,
@@ -199,6 +208,7 @@ export class SettingsService {
199208
this.preferenceService.set('editor.fontSize', editorFontSize, PreferenceScope.User),
200209
this.preferenceService.set('workbench.colorTheme', themeId, PreferenceScope.User),
201210
this.preferenceService.set('editor.autoSave', autoSave, PreferenceScope.User),
211+
this.preferenceService.set('editor.quickSuggestions', quickSuggestions, PreferenceScope.User),
202212
this.preferenceService.set('arduino.window.autoScale', autoScaleInterface, PreferenceScope.User),
203213
this.preferenceService.set('arduino.window.zoomLevel', interfaceScale, PreferenceScope.User),
204214
// this.preferenceService.set('arduino.ide.autoUpdate', checkForUpdates, PreferenceScope.User),
@@ -360,6 +370,13 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
360370
onChange={this.autoSaveDidChange} />
361371
Auto save
362372
</label>
373+
<label className='flex-line'>
374+
<input
375+
type='checkbox'
376+
checked={this.state.quickSuggestions.other === true}
377+
onChange={this.quickSuggestionsOtherDidChange} />
378+
Editor Quick Suggestions
379+
</label>
363380
<label className='flex-line'>
364381
<input
365382
type='checkbox'
@@ -551,6 +568,21 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
551568
this.setState({ autoSave: event.target.checked ? 'on' : 'off' });
552569
};
553570

571+
protected quickSuggestionsOtherDidChange = (event: React.ChangeEvent<HTMLInputElement>) => {
572+
573+
// need to persist react events through lifecycle https://reactjs.org/docs/events.html#event-pooling
574+
const newVal = event.target.checked ? true : false
575+
576+
this.setState(prevState => {
577+
return {
578+
quickSuggestions: {
579+
...prevState.quickSuggestions,
580+
other: newVal
581+
}
582+
}
583+
});
584+
};
585+
554586
protected themeDidChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
555587
const { selectedIndex } = event.target.options;
556588
const theme = ThemeService.get().getThemes()[selectedIndex];

Diff for: arduino-ide-extension/src/browser/style/settings-dialog.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
.arduino-settings-dialog .content {
66
padding: 5px;
7-
height: 270px;
7+
height: 300px;
88
}
99

1010
.arduino-settings-dialog .flex-line {

Diff for: arduino-ide-extension/src/browser/toolbar/arduino-toolbar-contribution.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { FrontendApplicationContribution, FrontendApplication, Widget, Message } from "@theia/core/lib/browser";
2-
import { injectable, inject } from "inversify";
3-
import { ArduinoToolbar } from "./arduino-toolbar";
4-
import { TabBarToolbarRegistry } from "@theia/core/lib/browser/shell/tab-bar-toolbar";
5-
import { CommandRegistry } from "@theia/core";
6-
import { LabelParser } from "@theia/core/lib/browser/label-parser";
1+
import { FrontendApplicationContribution, FrontendApplication, Widget, Message } from '@theia/core/lib/browser';
2+
import { injectable, inject } from 'inversify';
3+
import { ArduinoToolbar } from './arduino-toolbar';
4+
import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
5+
import { CommandRegistry } from '@theia/core';
6+
import { LabelParser } from '@theia/core/lib/browser/label-parser';
77

88
export class ArduinoToolbarContainer extends Widget {
99

Diff for: arduino-ide-extension/src/electron-main/splash/splash-screen.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ SOFTWARE.
2828
*/
2929

3030
import { Event } from '@theia/core/lib/common/event';
31-
import { BrowserWindow } from "electron";
31+
import { BrowserWindow } from 'electron';
3232

3333
/**
3434
* When splashscreen was shown.
@@ -126,11 +126,11 @@ export const initSplashScreen = (config: Config, onCloseRequested?: Event<void>)
126126
const window = new BrowserWindow(xConfig.windowOpts);
127127
splashScreen = new BrowserWindow(xConfig.splashScreenOpts);
128128
splashScreen.loadURL(`file://${xConfig.templateUrl}`);
129-
xConfig.closeWindow && splashScreen.on("close", () => {
129+
xConfig.closeWindow && splashScreen.on('close', () => {
130130
done || window.close();
131131
});
132132
// Splashscreen is fully loaded and ready to view.
133-
splashScreen.webContents.on("did-finish-load", () => {
133+
splashScreen.webContents.on('did-finish-load', () => {
134134
splashScreenReady = true;
135135
showSplash();
136136
});

Diff for: arduino-ide-extension/src/node/core-client-provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class CoreClientProvider extends GrpcClientProvider<CoreClientProvider.Cl
5454

5555
const instance = initResp.getInstance();
5656
if (!instance) {
57-
throw new Error(`Could not retrieve instance from the initialize response.`);
57+
throw new Error('Could not retrieve instance from the initialize response.');
5858
}
5959

6060
// No `await`. The index update event comes later. This way we do not block app startup with index update when invalid proxy is given.

Diff for: arduino-ide-extension/src/node/monitor/monitor-service-impl.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ export class MonitorServiceImpl implements MonitorService {
122122
if (!this.connection && reason && reason.code === MonitorError.ErrorCodes.CLIENT_CANCEL) {
123123
return Status.OK;
124124
}
125-
this.logger.info(`>>> Disposing monitor connection...`);
125+
this.logger.info('>>> Disposing monitor connection...');
126126
if (!this.connection) {
127-
this.logger.warn(`<<< Not connected. Nothing to dispose.`);
127+
this.logger.warn('<<< Not connected. Nothing to dispose.');
128128
return Status.NOT_CONNECTED;
129129
}
130130
const { duplex, config } = this.connection;

Diff for: arduino-ide-extension/src/node/notification-service-server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class NotificationServiceServerImpl implements NotificationServiceServer
5353
disposeClient(client: NotificationServiceClient): void {
5454
const index = this.clients.indexOf(client);
5555
if (index === -1) {
56-
console.warn(`Could not dispose notification service client. It was not registered.`);
56+
console.warn('Could not dispose notification service client. It was not registered.');
5757
return;
5858
}
5959
this.clients.splice(index, 1);

Diff for: arduino-ide-extension/tslint.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"check-else",
1616
"check-whitespace"
1717
],
18+
"quotemark": [true, "single", "jsx-single", "avoid-escape", "avoid-template"],
1819
"radix": true,
1920
"trailing-comma": [false],
2021
"triple-equals": [true, "allow-null-check"],
@@ -34,4 +35,4 @@
3435
"check-type"
3536
]
3637
}
37-
}
38+
}

Diff for: browser-app/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@
3737
"editor.autoSave": "on",
3838
"editor.minimap.enabled": false,
3939
"editor.tabSize": 2,
40-
"editor.scrollBeyondLastLine": false
40+
"editor.scrollBeyondLastLine": false,
41+
"editor.quickSuggestions": {
42+
"other": false,
43+
"comments": false,
44+
"strings": false
45+
}
4146
}
4247
}
4348
},

Diff for: electron-app/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@
4040
"editor.autoSave": "on",
4141
"editor.minimap.enabled": false,
4242
"editor.tabSize": 2,
43-
"editor.scrollBeyondLastLine": false
43+
"editor.scrollBeyondLastLine": false,
44+
"editor.quickSuggestions": {
45+
"other": false,
46+
"comments": false,
47+
"strings": false
48+
}
4449
}
4550
}
4651
},

0 commit comments

Comments
 (0)