brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] Enable opening of remote(http|https) files in Brackets #11750

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by swmitra Saturday Mar 10, 2018 at 09:21 GMT Originally opened as https://github.com/adobe/brackets/pull/14153


This PR adds File protocol adoption model to support various file protocols which mainly differs in read and write mechanism. With this PR we are adding a reference implementation for this protocol adapter model by enabling HTTP|HTTPS protocols. We are introducing a new protocol adapter registration hook in FileSystem module as function registerProtocolAdapter(protocol, adapter) where protocol can be any valid file protocol string like

HTTP: | HTTPS: | FTP: | SFTP:

for which we want to add support. adapter is the the actual protocol adapter object which should expose canRead(filePath) function handle and fileImpl which is the File interface implementation prototype handle, this will be be used by FileSystem to instantiate this new type of File if the protocol adapter is selected based on the filePath.

This change list also adds a plugin in QuickOpen, enabling user to input remote file path (HTTP | HTTPS) in QuickOpen file search dialog to open a file.

TODO


swmitra included the following code: https://github.com/adobe/brackets/pull/14153/commits

core-ai-bot commented 3 years ago

Comment by vickramdhawal Tuesday Mar 20, 2018 at 08:32 GMT


How are the users supposed to trigger opening of a remote file ? Is there any UI associated with it ? Currently, users can open files only from the mounted file system.

core-ai-bot commented 3 years ago

Comment by swmitra Tuesday Mar 20, 2018 at 09:30 GMT


@vickramdhawal It can be done by file open command.

CommandManager.execute(Commands.FILE_OPEN, {
    fullPath: "<remote-file-uri here>"
});

[update] When someone clicks on a remote file link, above snippet can be used to open that remote file. Currently there isn't any scope or feasibility in brackets sidebar to list remote files as part of project tree, in fact there isn't any use case unless we go ahead and support FTP site root mapping as our working file tree. We can then assume that any listing of remote files would be through some other auxiliary UI element, in which case the select/click handler for that UI element could be programmed to utilize this command execution approach to open a remote file.

core-ai-bot commented 3 years ago

Comment by abose Saturday Mar 31, 2018 at 06:02 GMT


"protocol can be any valid file protocol string like HTTP: | HTTPS: | FTP: | SFTP:" Is FTP and SFTP supported in this change?

core-ai-bot commented 3 years ago

Comment by abose Saturday Mar 31, 2018 at 06:07 GMT


Also would be good if this could be hooked into some UI. maybe the quick open cmd+o hotkey. This feature would help to adapt code from the internets.

core-ai-bot commented 3 years ago

Comment by swmitra Monday Apr 02, 2018 at 08:01 GMT


@abose This PR provides implementation only for http/https, but a plugin framework is also being added in this PR, where other extensions can hook onto and provide custom read/write handles, or add support for a new protocol.

Let me see if this can be hooked to quickopen where user can type/paste a remote path to open a file.

core-ai-bot commented 3 years ago

Comment by abose Monday Apr 02, 2018 at 10:49 GMT


Now that quick open works on http/s URL , normal file[file:///c/a.txt or c:\a.txt etc] paths cannot be opened with the same. Would be good if this behaved consistently for file path open as well.

[swmitra] -@abose I guess it never worked earlier with file path even without this PR. My take on this - can be taken as a separate PR! I will still do some quick check...

core-ai-bot commented 3 years ago

Comment by abose Tuesday Apr 03, 2018 at 03:32 GMT


LGTM.