Skip to content

Commit 43ae423

Browse files
OrKoNDevtools-frontend LUCI CQ
authored andcommitted
[cleanup] rename DISK to WORKSPACE_PROJECT for clarity
+ additional documentation Bug: 399333674 Change-Id: Iceb733882d6d4f7838d66936ce01006da7834700 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6304802 Auto-Submit: Alex Rudenko <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]>
1 parent 8b38da8 commit 43ae423

File tree

6 files changed

+43
-8
lines changed

6 files changed

+43
-8
lines changed

front_end/models/persistence/IsolatedFileSystemManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,6 @@ function hostFileSystemTypeToPlatformFileSystemType(type: string): PlatformFileS
368368
case 'overrides':
369369
return PlatformFileSystemType.OVERRIDES;
370370
default:
371-
return PlatformFileSystemType.DISK;
371+
return PlatformFileSystemType.WORKSPACE_PROJECT;
372372
}
373373
}

front_end/models/persistence/PersistenceImpl.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ describeWithMockConnection('PersistenceImpl', () => {
115115
const fileSystemPath = urlString`file://path/to/filesystem`;
116116
const fileSystemFileUrl = urlString`${fileSystemPath + '/script.js'}`;
117117
const {uiSourceCode: fileSystemUiSourceCode, project} = createFileSystemFileForPersistenceTests(
118-
{fileSystemPath, fileSystemFileUrl, type: Persistence.PlatformFileSystem.PlatformFileSystemType.DISK},
118+
{
119+
fileSystemPath,
120+
fileSystemFileUrl,
121+
type: Persistence.PlatformFileSystem.PlatformFileSystemType.WORKSPACE_PROJECT
122+
},
119123
SCRIPT_DESCRIPTION.url, SCRIPT_DESCRIPTION.content, target);
120124
const breakpointLine = 0;
121125

@@ -141,7 +145,11 @@ describeWithMockConnection('PersistenceImpl', () => {
141145
const fileSystemPath = urlString`file://path/to/filesystem`;
142146
const fileSystemFileUrl = urlString`${fileSystemPath + '/script.js'}`;
143147
const {uiSourceCode: fileSystemUiSourceCode, project} = createFileSystemFileForPersistenceTests(
144-
{fileSystemPath, fileSystemFileUrl, type: Persistence.PlatformFileSystem.PlatformFileSystemType.DISK},
148+
{
149+
fileSystemPath,
150+
fileSystemFileUrl,
151+
type: Persistence.PlatformFileSystem.PlatformFileSystemType.WORKSPACE_PROJECT
152+
},
145153
SCRIPT_DESCRIPTION.url, SCRIPT_DESCRIPTION.content, target);
146154
const breakpointLine = 0;
147155

front_end/models/persistence/PlatformFileSystem.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const {urlString} = Platform.DevToolsPath;
1010
describe('PlatformFileSystem', () => {
1111
it('can be instantiated successfully', () => {
1212
const platformFileSystem = new Persistence.PlatformFileSystem.PlatformFileSystem(
13-
urlString`Test Path`, Persistence.PlatformFileSystem.PlatformFileSystemType.DISK, false);
13+
urlString`Test Path`, Persistence.PlatformFileSystem.PlatformFileSystemType.WORKSPACE_PROJECT, false);
1414
assert.strictEqual(platformFileSystem.path(), 'Test Path', 'path was not set or retrieved correctly');
1515
assert.strictEqual(
16-
platformFileSystem.type(), Persistence.PlatformFileSystem.PlatformFileSystemType.DISK,
16+
platformFileSystem.type(), Persistence.PlatformFileSystem.PlatformFileSystemType.WORKSPACE_PROJECT,
1717
'Type was not set or retrieved correctly');
1818
});
1919
});

front_end/models/persistence/PlatformFileSystem.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,32 @@ const str_ = i18n.i18n.registerUIStrings('models/persistence/PlatformFileSystem.
1717
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
1818

1919
export enum PlatformFileSystemType {
20+
/**
21+
* Snippets are implemented as a PlatformFileSystem but they are
22+
* actually stored in the browser's profile directory and do not
23+
* create files on the actual filesystem.
24+
*
25+
* See Sources > Snippets in the UI.
26+
*/
2027
SNIPPETS = 'snippets',
28+
/**
29+
* Overrides is a filesystem that represents a user-selected folder on
30+
* disk. This folder is used to replace page resources using request
31+
* interception.
32+
*
33+
* See Sources > Overrides in the UI.
34+
*/
2135
OVERRIDES = 'overrides',
22-
DISK = 'disk',
36+
/**
37+
* Represents a filesystem for a workspace folder that the user added
38+
* to DevTools. It can be manually connected or it can be
39+
* automatically discovered based on the hints found in devtools.json
40+
* served by the inspected page (see
41+
* https://goo.gle/devtools-json-design). DevTools tries to map the
42+
* page content to the content in such folder but does not use request
43+
* interception for this.
44+
*/
45+
WORKSPACE_PROJECT = 'workspace-project',
2346
}
2447

2548
export class PlatformFileSystem {
@@ -56,6 +79,10 @@ export class PlatformFileSystem {
5679
return this.#type;
5780
}
5881

82+
/**
83+
* True if the filesystem was automatically discovered (see
84+
* https://goo.gle/devtools-json-design).
85+
*/
5986
automatic(): boolean {
6087
return this.#automatic;
6188
}

front_end/panels/ai_assistance/AiAssistancePanel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ export class AiAssistancePanel extends UI.Panel.Panel {
487487
if (!(project instanceof Persistence.FileSystemWorkspaceBinding.FileSystem)) {
488488
continue;
489489
}
490-
if (project.fileSystem().type() !== Persistence.PlatformFileSystem.PlatformFileSystemType.DISK) {
490+
if (project.fileSystem().type() !== Persistence.PlatformFileSystem.PlatformFileSystemType.WORKSPACE_PROJECT) {
491491
continue;
492492
}
493493
this.#project = project;

front_end/testing/UISourceCodeHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export function createFileSystemUISourceCode(options: {
130130
const type = options.type || '';
131131
const content = options.content || '';
132132
const platformFileSystem = new TestPlatformFileSystem(
133-
fileSystemPath, type || Persistence.PlatformFileSystem.PlatformFileSystemType.DISK, options.mimeType,
133+
fileSystemPath, type || Persistence.PlatformFileSystem.PlatformFileSystemType.WORKSPACE_PROJECT, options.mimeType,
134134
Boolean(options.autoMapping));
135135
const metadata = options.metadata || new Workspace.UISourceCode.UISourceCodeMetadata(null, null);
136136

0 commit comments

Comments
 (0)