-
Notifications
You must be signed in to change notification settings - Fork 65
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
Please detail the need for resolve()
#69
Comments
Given an IDE-like application, where a user is working on a project rooted in a directory, being able to Does this use case help? |
@pwnall The use case does not appear to be clear from perspective here. Absolutely unclear at https://wicg.github.io/native-file-system/#dom-filesystemdirectoryhandle-resolve. Is the expected usage Can you include a brief code snippet demonstrating the use case? |
This is probably broken, but I hope it gets the idea across. // Called when the "Save As" button is clicked in an IDE.
async function onSaveAsClick() {
const fileHandle = await self.chooseFileSystemEntries({type: 'openFile', readOnly: false});
if (fileHandle === null) {
// User canceled out of dialog, abandon the "Save As" intent.
return;
}
// Get a directory handle to the root of the IDE's tree view.
const treeRoot = workspace().treeView().rootHandle();
const relativePath = treeRoot.resolve(fileHandle);
if (relativePath === null) {
// The selected file is outside the workspace.
await workspace().treeView().hideCursor();
} else {
// Highlight the file selected from the picker in the IDE's tree view.
await workspace().treeView().setCursor(relativePath);
}
// TODO: Write the current editor's buffer contents to fileHandle.
} |
Is the only application context an IDE which |
Without resolve() there is no way to compare different handles, so yes, IDE to highlight a path to a file is one option, another one would be launch events where when launching a PWA with a file that is already open might want to focus the window that has that file open rather than opening a new window. So basically resolve() gives you a way to compare two handles and see if they are in any way related. Since we don't expose paths (or parents) in any way, there is no way to do these things with the rest of the API. |
Looks like this was removed in commit 5e1146e, but it remains in EXPLAINER.md as |
In response to w3ctag/design-reviews#390
I don't really understand the need for
resolve
so can you add more info for that and maybe show example showing it valueThe text was updated successfully, but these errors were encountered: