editor.quicksSuggestions.other defaults off

This commit is contained in:
Francesco Stasi 2021-03-15 09:23:20 +01:00 committed by Francesco Stasi
parent 067cc8766a
commit 6dadd1775a
13 changed files with 65 additions and 22 deletions

View File

@ -87,7 +87,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
if (!AttachedBoardsChangeEvent.isEmpty(event)) { if (!AttachedBoardsChangeEvent.isEmpty(event)) {
this.logger.info('Attached boards and available ports changed:'); this.logger.info('Attached boards and available ports changed:');
this.logger.info(AttachedBoardsChangeEvent.toString(event)); this.logger.info(AttachedBoardsChangeEvent.toString(event));
this.logger.info(`------------------------------------------`); this.logger.info('------------------------------------------');
} }
this._attachedBoards = event.newState.boards; this._attachedBoards = event.newState.boards;
this._availablePorts = event.newState.ports; this._availablePorts = event.newState.ports;

View File

@ -82,7 +82,7 @@ export class AddZipLibrary extends SketchContribution {
if (name) { if (name) {
throw new AlreadyInstalledError(`A library folder named ${name} already exists. Do you want to overwrite it?`, name); throw new AlreadyInstalledError(`A library folder named ${name} already exists. Do you want to overwrite it?`, name);
} else { } else {
throw new AlreadyInstalledError(`A library already exists. Do you want to overwrite it?`); throw new AlreadyInstalledError('A library already exists. Do you want to overwrite it?');
} }
} }
} }

View File

@ -14,7 +14,7 @@ export class OutputServiceImpl implements OutputService {
append(message: OutputMessage): void { append(message: OutputMessage): void {
const { chunk } = message; const { chunk } = message;
const channel = this.outputChannelManager.getChannel(`Arduino`); const channel = this.outputChannelManager.getChannel('Arduino');
channel.show({ preserveFocus: true }); channel.show({ preserveFocus: true });
channel.append(chunk); channel.append(chunk);
} }

View File

@ -24,6 +24,7 @@ export interface Settings extends Index {
editorFontSize: number; // `editor.fontSize` editorFontSize: number; // `editor.fontSize`
themeId: string; // `workbench.colorTheme` themeId: string; // `workbench.colorTheme`
autoSave: 'on' | 'off'; // `editor.autoSave` autoSave: 'on' | 'off'; // `editor.autoSave`
quickSuggestions: Record<'other'|'comments'|'strings', boolean>; // `editor.quickSuggestions`
autoScaleInterface: boolean; // `arduino.window.autoScale` autoScaleInterface: boolean; // `arduino.window.autoScale`
interfaceScale: number; // `arduino.window.zoomLevel` https://github.com/eclipse-theia/theia/issues/8751 interfaceScale: number; // `arduino.window.zoomLevel` https://github.com/eclipse-theia/theia/issues/8751
@ -84,6 +85,7 @@ export class SettingsService {
editorFontSize, editorFontSize,
themeId, themeId,
autoSave, autoSave,
quickSuggestions,
autoScaleInterface, autoScaleInterface,
interfaceScale, interfaceScale,
// checkForUpdates, // checkForUpdates,
@ -97,6 +99,11 @@ export class SettingsService {
this.preferenceService.get<number>('editor.fontSize', 12), this.preferenceService.get<number>('editor.fontSize', 12),
this.preferenceService.get<string>('workbench.colorTheme', 'arduino-theme'), this.preferenceService.get<string>('workbench.colorTheme', 'arduino-theme'),
this.preferenceService.get<'on' | 'off'>('editor.autoSave', 'on'), this.preferenceService.get<'on' | 'off'>('editor.autoSave', 'on'),
this.preferenceService.get<object>('editor.quickSuggestion', {
'other': false,
'comments': false,
'strings': false
}),
this.preferenceService.get<boolean>('arduino.window.autoScale', true), this.preferenceService.get<boolean>('arduino.window.autoScale', true),
this.preferenceService.get<number>('arduino.window.zoomLevel', 0), this.preferenceService.get<number>('arduino.window.zoomLevel', 0),
// this.preferenceService.get<string>('arduino.ide.autoUpdate', true), // this.preferenceService.get<string>('arduino.ide.autoUpdate', true),
@ -113,6 +120,7 @@ export class SettingsService {
editorFontSize, editorFontSize,
themeId, themeId,
autoSave, autoSave,
quickSuggestions,
autoScaleInterface, autoScaleInterface,
interfaceScale, interfaceScale,
// checkForUpdates, // checkForUpdates,
@ -155,10 +163,10 @@ export class SettingsService {
return `Invalid sketchbook location: ${sketchbookPath}`; return `Invalid sketchbook location: ${sketchbookPath}`;
} }
if (editorFontSize <= 0) { if (editorFontSize <= 0) {
return `Invalid editor font size. It must be a positive integer.`; return 'Invalid editor font size. It must be a positive integer.';
} }
if (!ThemeService.get().getThemes().find(({ id }) => id === themeId)) { if (!ThemeService.get().getThemes().find(({ id }) => id === themeId)) {
return `Invalid theme.`; return 'Invalid theme.';
} }
return true; return true;
} catch (err) { } catch (err) {
@ -175,6 +183,7 @@ export class SettingsService {
editorFontSize, editorFontSize,
themeId, themeId,
autoSave, autoSave,
quickSuggestions,
autoScaleInterface, autoScaleInterface,
interfaceScale, interfaceScale,
// checkForUpdates, // checkForUpdates,
@ -199,6 +208,7 @@ export class SettingsService {
this.preferenceService.set('editor.fontSize', editorFontSize, PreferenceScope.User), this.preferenceService.set('editor.fontSize', editorFontSize, PreferenceScope.User),
this.preferenceService.set('workbench.colorTheme', themeId, PreferenceScope.User), this.preferenceService.set('workbench.colorTheme', themeId, PreferenceScope.User),
this.preferenceService.set('editor.autoSave', autoSave, PreferenceScope.User), this.preferenceService.set('editor.autoSave', autoSave, PreferenceScope.User),
this.preferenceService.set('editor.quickSuggestions', quickSuggestions, PreferenceScope.User),
this.preferenceService.set('arduino.window.autoScale', autoScaleInterface, PreferenceScope.User), this.preferenceService.set('arduino.window.autoScale', autoScaleInterface, PreferenceScope.User),
this.preferenceService.set('arduino.window.zoomLevel', interfaceScale, PreferenceScope.User), this.preferenceService.set('arduino.window.zoomLevel', interfaceScale, PreferenceScope.User),
// this.preferenceService.set('arduino.ide.autoUpdate', checkForUpdates, PreferenceScope.User), // this.preferenceService.set('arduino.ide.autoUpdate', checkForUpdates, PreferenceScope.User),
@ -360,6 +370,13 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
onChange={this.autoSaveDidChange} /> onChange={this.autoSaveDidChange} />
Auto save Auto save
</label> </label>
<label className='flex-line'>
<input
type='checkbox'
checked={this.state.quickSuggestions.other === true}
onChange={this.quickSuggestionsOtherDidChange} />
Editor Quick Suggestions
</label>
<label className='flex-line'> <label className='flex-line'>
<input <input
type='checkbox' type='checkbox'
@ -551,6 +568,21 @@ export class SettingsComponent extends React.Component<SettingsComponent.Props,
this.setState({ autoSave: event.target.checked ? 'on' : 'off' }); this.setState({ autoSave: event.target.checked ? 'on' : 'off' });
}; };
protected quickSuggestionsOtherDidChange = (event: React.ChangeEvent<HTMLInputElement>) => {
// need to persist react events through lifecycle https://reactjs.org/docs/events.html#event-pooling
const newVal = event.target.checked ? true : false
this.setState(prevState => {
return {
quickSuggestions: {
...prevState.quickSuggestions,
other: newVal
}
}
});
};
protected themeDidChange = (event: React.ChangeEvent<HTMLSelectElement>) => { protected themeDidChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
const { selectedIndex } = event.target.options; const { selectedIndex } = event.target.options;
const theme = ThemeService.get().getThemes()[selectedIndex]; const theme = ThemeService.get().getThemes()[selectedIndex];

View File

@ -4,7 +4,7 @@
.arduino-settings-dialog .content { .arduino-settings-dialog .content {
padding: 5px; padding: 5px;
height: 270px; height: 300px;
} }
.arduino-settings-dialog .flex-line { .arduino-settings-dialog .flex-line {

View File

@ -1,9 +1,9 @@
import { FrontendApplicationContribution, FrontendApplication, Widget, Message } from "@theia/core/lib/browser"; import { FrontendApplicationContribution, FrontendApplication, Widget, Message } from '@theia/core/lib/browser';
import { injectable, inject } from "inversify"; import { injectable, inject } from 'inversify';
import { ArduinoToolbar } from "./arduino-toolbar"; import { ArduinoToolbar } from './arduino-toolbar';
import { TabBarToolbarRegistry } from "@theia/core/lib/browser/shell/tab-bar-toolbar"; import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
import { CommandRegistry } from "@theia/core"; import { CommandRegistry } from '@theia/core';
import { LabelParser } from "@theia/core/lib/browser/label-parser"; import { LabelParser } from '@theia/core/lib/browser/label-parser';
export class ArduinoToolbarContainer extends Widget { export class ArduinoToolbarContainer extends Widget {

View File

@ -28,7 +28,7 @@ SOFTWARE.
*/ */
import { Event } from '@theia/core/lib/common/event'; import { Event } from '@theia/core/lib/common/event';
import { BrowserWindow } from "electron"; import { BrowserWindow } from 'electron';
/** /**
* When splashscreen was shown. * When splashscreen was shown.
@ -126,11 +126,11 @@ export const initSplashScreen = (config: Config, onCloseRequested?: Event<void>)
const window = new BrowserWindow(xConfig.windowOpts); const window = new BrowserWindow(xConfig.windowOpts);
splashScreen = new BrowserWindow(xConfig.splashScreenOpts); splashScreen = new BrowserWindow(xConfig.splashScreenOpts);
splashScreen.loadURL(`file://${xConfig.templateUrl}`); splashScreen.loadURL(`file://${xConfig.templateUrl}`);
xConfig.closeWindow && splashScreen.on("close", () => { xConfig.closeWindow && splashScreen.on('close', () => {
done || window.close(); done || window.close();
}); });
// Splashscreen is fully loaded and ready to view. // Splashscreen is fully loaded and ready to view.
splashScreen.webContents.on("did-finish-load", () => { splashScreen.webContents.on('did-finish-load', () => {
splashScreenReady = true; splashScreenReady = true;
showSplash(); showSplash();
}); });

View File

@ -54,7 +54,7 @@ export class CoreClientProvider extends GrpcClientProvider<CoreClientProvider.Cl
const instance = initResp.getInstance(); const instance = initResp.getInstance();
if (!instance) { if (!instance) {
throw new Error(`Could not retrieve instance from the initialize response.`); throw new Error('Could not retrieve instance from the initialize response.');
} }
// No `await`. The index update event comes later. This way we do not block app startup with index update when invalid proxy is given. // No `await`. The index update event comes later. This way we do not block app startup with index update when invalid proxy is given.

View File

@ -122,9 +122,9 @@ export class MonitorServiceImpl implements MonitorService {
if (!this.connection && reason && reason.code === MonitorError.ErrorCodes.CLIENT_CANCEL) { if (!this.connection && reason && reason.code === MonitorError.ErrorCodes.CLIENT_CANCEL) {
return Status.OK; return Status.OK;
} }
this.logger.info(`>>> Disposing monitor connection...`); this.logger.info('>>> Disposing monitor connection...');
if (!this.connection) { if (!this.connection) {
this.logger.warn(`<<< Not connected. Nothing to dispose.`); this.logger.warn('<<< Not connected. Nothing to dispose.');
return Status.NOT_CONNECTED; return Status.NOT_CONNECTED;
} }
const { duplex, config } = this.connection; const { duplex, config } = this.connection;

View File

@ -53,7 +53,7 @@ export class NotificationServiceServerImpl implements NotificationServiceServer
disposeClient(client: NotificationServiceClient): void { disposeClient(client: NotificationServiceClient): void {
const index = this.clients.indexOf(client); const index = this.clients.indexOf(client);
if (index === -1) { if (index === -1) {
console.warn(`Could not dispose notification service client. It was not registered.`); console.warn('Could not dispose notification service client. It was not registered.');
return; return;
} }
this.clients.splice(index, 1); this.clients.splice(index, 1);

View File

@ -15,6 +15,7 @@
"check-else", "check-else",
"check-whitespace" "check-whitespace"
], ],
"quotemark": [true, "single", "jsx-single", "avoid-escape", "avoid-template"],
"radix": true, "radix": true,
"trailing-comma": [false], "trailing-comma": [false],
"triple-equals": [true, "allow-null-check"], "triple-equals": [true, "allow-null-check"],

View File

@ -37,7 +37,12 @@
"editor.autoSave": "on", "editor.autoSave": "on",
"editor.minimap.enabled": false, "editor.minimap.enabled": false,
"editor.tabSize": 2, "editor.tabSize": 2,
"editor.scrollBeyondLastLine": false "editor.scrollBeyondLastLine": false,
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false
}
} }
} }
}, },

View File

@ -40,7 +40,12 @@
"editor.autoSave": "on", "editor.autoSave": "on",
"editor.minimap.enabled": false, "editor.minimap.enabled": false,
"editor.tabSize": 2, "editor.tabSize": 2,
"editor.scrollBeyondLastLine": false "editor.scrollBeyondLastLine": false,
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false
}
} }
} }
}, },