Skip to content

Commit 876b387

Browse files
committed
editor.quicksSuggestions.other defaults off
1 parent e90fa27 commit 876b387

File tree

7 files changed

+56
-13
lines changed

7 files changed

+56
-13
lines changed

arduino-ide-extension/src/browser/settings.tsx

+32
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,
@@ -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];

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 {

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

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
});

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", "avoid-escape"],
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+
}

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
},

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)