Skip to content

fix: do not exclude cloud sketch diagnostics #2037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions arduino-ide-extension/src/browser/create/create-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { AuthenticationSession } from '../../node/auth/types';
import { ArduinoPreferences } from '../arduino-preferences';
import { AuthenticationClientService } from '../auth/authentication-client-service';
import { LocalCacheFsProvider } from '../local-cache/local-cache-fs-provider';
import {
ARDUINO_CLOUD_FOLDER,
REMOTE_SKETCHBOOK_FOLDER,
} from '../utils/constants';
import { CreateUri } from './create-uri';

export type CloudSketchState = 'push' | 'pull';
Expand Down Expand Up @@ -128,8 +132,8 @@ export class CreateFeatures implements FrontendApplicationContribution {
return undefined;
}
return dataDirUri
.resolve('RemoteSketchbook')
.resolve('ArduinoCloud')
.resolve(REMOTE_SKETCHBOOK_FOLDER)
.resolve(ARDUINO_CLOUD_FOLDER)
.isEqualOrParent(new URI(sketch.uri));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import {
import { AuthenticationClientService } from '../auth/authentication-client-service';
import { AuthenticationSession } from '../../common/protocol/authentication-service';
import { ConfigService } from '../../common/protocol';
import {
ARDUINO_CLOUD_FOLDER,
REMOTE_SKETCHBOOK_FOLDER,
} from '../utils/constants';

export namespace LocalCacheUri {
export const scheme = 'arduino-local-cache';
Expand Down Expand Up @@ -107,7 +111,7 @@ export class LocalCacheFsProvider
return;
}
this._localCacheRoot = localCacheUri;
for (const segment of ['RemoteSketchbook', 'ArduinoCloud']) {
for (const segment of [REMOTE_SKETCHBOOK_FOLDER, ARDUINO_CLOUD_FOLDER]) {
this._localCacheRoot = this._localCacheRoot.resolve(segment);
await fileService.createFolder(this._localCacheRoot);
}
Expand Down
20 changes: 18 additions & 2 deletions arduino-ide-extension/src/browser/theia/markers/problem-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,43 @@ 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 {
@inject(ConfigServiceClient)
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(
uri: URI,
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);
Expand Down