fix: do not exclude cloud sketch diagnostics

PROEDITOR-50: error markers have been disabled for built-ins (daedae1).
Relaxed the error marker filtering for cloud sketches.

Closes #669

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta
2023-04-28 15:10:49 +02:00
committed by Akos Kitta
parent 51f69f6a59
commit e6828f86d7
3 changed files with 29 additions and 5 deletions

View File

@@ -9,6 +9,10 @@ import { Marker } from '@theia/markers/lib/common/marker';
import { ProblemManager as TheiaProblemManager } from '@theia/markers/lib/browser/problem/problem-manager';
import { ConfigServiceClient } from '../../config/config-service-client';
import debounce = require('lodash.debounce');
import {
ARDUINO_CLOUD_FOLDER,
REMOTE_SKETCHBOOK_FOLDER,
} from '../../utils/constants';
@injectable()
export class ProblemManager extends TheiaProblemManager {
@@ -16,12 +20,18 @@ export class ProblemManager extends TheiaProblemManager {
private readonly configService: ConfigServiceClient;
private dataDirUri: URI | undefined;
private cloudCacheDirUri: URI | undefined;
@postConstruct()
protected override init(): void {
super.init();
this.dataDirUri = this.configService.tryGetDataDirUri();
this.configService.onDidChangeDataDirUri((uri) => (this.dataDirUri = uri));
this.configService.onDidChangeDataDirUri((uri) => {
this.dataDirUri = uri;
this.cloudCacheDirUri = this.dataDirUri
?.resolve(REMOTE_SKETCHBOOK_FOLDER)
.resolve(ARDUINO_CLOUD_FOLDER);
});
}
override setMarkers(
@@ -29,7 +39,13 @@ export class ProblemManager extends TheiaProblemManager {
owner: string,
data: Diagnostic[]
): Marker<Diagnostic>[] {
if (this.dataDirUri && this.dataDirUri.isEqualOrParent(uri)) {
if (
this.dataDirUri &&
this.dataDirUri.isEqualOrParent(uri) &&
this.cloudCacheDirUri && // Do not disable the diagnostics for cloud sketches https://github.com/arduino/arduino-ide/issues/669
!this.cloudCacheDirUri.isEqualOrParent(uri)
) {
// If in directories.data folder but not in the cloud sketchbook cache folder.
return [];
}
return super.setMarkers(uri, owner, data);