mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-09 10:28:32 +00:00
feat: configure sketchbook location without restart
Closes #1764 Closes #796 Closes #569 Closes #655 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
@@ -1,30 +1,35 @@
|
||||
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
||||
import URI from '@theia/core/lib/common/uri';
|
||||
import { Title, Widget } from '@theia/core/shared/@phosphor/widgets';
|
||||
import { ILogger } from '@theia/core/lib/common/logger';
|
||||
import { EditorWidget } from '@theia/editor/lib/browser';
|
||||
import { WidgetDecoration } from '@theia/core/lib/browser/widget-decoration';
|
||||
import { TabBarDecoratorService as TheiaTabBarDecoratorService } from '@theia/core/lib/browser/shell/tab-bar-decorator';
|
||||
import { ConfigService } from '../../../common/protocol/config-service';
|
||||
import { ConfigServiceClient } from '../../config/config-service-client';
|
||||
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
|
||||
|
||||
@injectable()
|
||||
export class TabBarDecoratorService extends TheiaTabBarDecoratorService {
|
||||
@inject(ConfigService)
|
||||
protected readonly configService: ConfigService;
|
||||
@inject(ConfigServiceClient)
|
||||
private readonly configService: ConfigServiceClient;
|
||||
@inject(FrontendApplicationStateService)
|
||||
private readonly appStateService: FrontendApplicationStateService;
|
||||
|
||||
@inject(ILogger)
|
||||
protected readonly logger: ILogger;
|
||||
|
||||
protected dataDirUri: URI | undefined;
|
||||
private dataDirUri: URI | undefined;
|
||||
|
||||
@postConstruct()
|
||||
protected init(): void {
|
||||
this.configService
|
||||
.getConfiguration()
|
||||
.then(({ dataDirUri }) => (this.dataDirUri = new URI(dataDirUri)))
|
||||
.catch((err) =>
|
||||
this.logger.error(`Failed to determine the data directory: ${err}`)
|
||||
);
|
||||
const fireDidChange = () =>
|
||||
this.appStateService
|
||||
.reachedState('ready')
|
||||
.then(() => this.fireDidChangeDecorations());
|
||||
this.dataDirUri = this.configService.tryGetDataDirUri();
|
||||
this.configService.onDidChangeDataDirUri((dataDirUri) => {
|
||||
this.dataDirUri = dataDirUri;
|
||||
fireDidChange();
|
||||
});
|
||||
if (this.dataDirUri) {
|
||||
fireDidChange();
|
||||
}
|
||||
}
|
||||
|
||||
override getDecorations(title: Title<Widget>): WidgetDecoration.Data[] {
|
||||
|
||||
@@ -5,31 +5,23 @@ import {
|
||||
} from '@theia/core/shared/inversify';
|
||||
import { Diagnostic } from '@theia/core/shared/vscode-languageserver-types';
|
||||
import URI from '@theia/core/lib/common/uri';
|
||||
import { ILogger } from '@theia/core';
|
||||
import { Marker } from '@theia/markers/lib/common/marker';
|
||||
import { ProblemManager as TheiaProblemManager } from '@theia/markers/lib/browser/problem/problem-manager';
|
||||
import { ConfigService } from '../../../common/protocol/config-service';
|
||||
import { ConfigServiceClient } from '../../config/config-service-client';
|
||||
import debounce = require('lodash.debounce');
|
||||
|
||||
@injectable()
|
||||
export class ProblemManager extends TheiaProblemManager {
|
||||
@inject(ConfigService)
|
||||
protected readonly configService: ConfigService;
|
||||
@inject(ConfigServiceClient)
|
||||
private readonly configService: ConfigServiceClient;
|
||||
|
||||
@inject(ILogger)
|
||||
protected readonly logger: ILogger;
|
||||
|
||||
protected dataDirUri: URI | undefined;
|
||||
private dataDirUri: URI | undefined;
|
||||
|
||||
@postConstruct()
|
||||
protected override init(): void {
|
||||
super.init();
|
||||
this.configService
|
||||
.getConfiguration()
|
||||
.then(({ dataDirUri }) => (this.dataDirUri = new URI(dataDirUri)))
|
||||
.catch((err) =>
|
||||
this.logger.error(`Failed to determine the data directory: ${err}`)
|
||||
);
|
||||
this.dataDirUri = this.configService.tryGetDataDirUri();
|
||||
this.configService.onDidChangeDataDirUri((uri) => (this.dataDirUri = uri));
|
||||
}
|
||||
|
||||
override setMarkers(
|
||||
|
||||
Reference in New Issue
Block a user