Remote-edit: sftp/ftp remote edit package available


#1

Hello,

I’ve just published a package that allows you to remotely edit files with SFTP/FTP.

Supported features include adding hosts with GUI, user agent/private key/password auth for sftp, browsing files, downloading files, automatic upload on save, viewing of downloaded files.

See https://atom.io/packages/remote-edit for more info and screenshots.

It’s only an alpha so feedback is more than welcome :smile:


Unable to open sftp:// links in linux
#2

Is there a way to use this to open sftp:// links?


#3

Currently there is no way to open sftp:// links.
Do you mean from an input field in Atom or from a file manager/hyperlink in another application? The former is something that I could put in my todo list for the application, but the latter is probably not something that I will be able to implement.


#4

I’m specifically having an issue with opening links from my file manager. What is preventing that from being done or what would be needed?


#5

I’m just guessing here but it might depends on the file manager and operating system you use. For this to be implemented in the remote-edit package you would need to be able to define that “sftp://” style links should be opened by Atom. I don’t think this is possible from a mere package, but would require some changes in the Atom Core as mentioned here.

Edit:
After quickly browsing the Atom source it seems that this might be possible to implement from a package. You would need to register an opener with the workspace that could be used when URI’s of sft:// type where called. I don’t really know if this will work, and if it will be able to save using the filesystem (doubt it). So any saving would have go thru the plugin. This is probably not something I will focus on but you’re more than welcome to try it out and submit a PR if it works :smile:

Edit2: From what I can gleam from the API it seems this is more related to specifying settings on different kinds of files, but it might work for your issue as well.


#6

Nice, been looking for something like this for a while. Is there any way to cd .. when browsing files?


#7

hi! this was previously present, but seems to have been removed from ssh2 (the ssh library i’m using). I’ve created an issue, https://github.com/sveale/remote-edit/issues/8, and will publish a fix asap.

Edit: fixed :slight_smile:


#8

This is exactly what I was hoping to find. EXCELLENT! KEEP IT UP!


#9

I’ve been trying a bit to get some kind of action from opening sftp:// links by registering it, but I don’t know enough to really test it at this point.

I was thinking something like this:

    atom.project.registerOpener (uri) ->
      if uri.split("://")[0] is 'sftp'
        return new opensftp(uri)

Its a bit ugly but it might work. Unfortunately it didn’t work and I’m not even sure where to start with this. I’ve even used this in the console:atom.workspace.open('sftp://test.com/hi')

I do see you register a remote-edit: protocol. Can you directly open a link using that? Say something like atom remote-edit:test.com/file.txt


#10

I’m unable to install the remote-edit@1.2.2, there is a lot of spew produced - I tried to paste here but it generates a 500 server error on posting, so you can see the full spew here: http://edoceo.io/paste?p=wsIFck

Here is some of the important stuff

In file included from …/src/main.cc:1:0:
…/…/nan/nan.h: In function ‘v8::Handlev8::Value NanError(const char*)’:
…/…/nan/nan.h:339:13: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h: In function ‘void NanThrowError(const char*)’:
…/…/nan/nan.h:343:5: error: ‘ThrowException’ is not a member of ‘v8’
…/…/nan/nan.h:343:5: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h: In function ‘void NanThrowError(v8::Handlev8::Value)’:
…/…/nan/nan.h:348:5: error: ‘ThrowException’ is not a member of ‘v8’
…/…/nan/nan.h: In function ‘v8::Handlev8::Value NanError(const char*, int)’:
…/…/nan/nan.h:355:53: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h:357:14: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h:357:65: error: no matching function for call to ‘v8::Int32::New(const int&)’
…/…/nan/nan.h:357:65: note: candidate is:
In file included from /home/atom/.atom/.node-gyp/.node-gyp/0.11.13/src/node.h:61:0,
from …/…/nan/nan.h:134,
from …/src/main.cc:1:
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:1989:25: note: static v8::Localv8::Integer v8::Integer::New(v8::Isolate*, int32_t)
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:1989:25: note: candidate expects 2 arguments, 1 provided
In file included from …/src/main.cc:1:0:
…/…/nan/nan.h: In function ‘v8::Handlev8::Value NanTypeError(const char*)’:
…/…/nan/nan.h:369:12: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h: In function ‘void NanThrowTypeError(const char*)’:
…/…/nan/nan.h:373:5: error: ‘ThrowException’ is not a member of ‘v8’
…/…/nan/nan.h:373:5: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h: In function ‘v8::Handlev8::Value NanRangeError(const char*)’:
…/…/nan/nan.h:377:12: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h: In function ‘void NanThrowRangeError(const char*)’:
…/…/nan/nan.h:381:5: error: ‘ThrowException’ is not a member of ‘v8’
…/…/nan/nan.h:381:5: error: ‘New’ is not a member of ‘v8::String’
…/…/nan/nan.h: In constructor ‘NanCallback::NanCallback()’:
…/…/nan/nan.h:727:49: error: no matching function for call to ‘v8::Object::New()’
…/…/nan/nan.h:727:49: note: candidate is:
In file included from /home/atom/.atom/.node-gyp/.node-gyp/0.11.13/src/node.h:61:0,
from …/…/nan/nan.h:134,
from …/src/main.cc:1:
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:2372:24: note: static v8::Localv8::Object v8::Object::New(v8::Isolate*)
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:2372:24: note: candidate expects 1 argument, 0 provided
In file included from …/src/main.cc:1:0:
…/…/nan/nan.h: In constructor ‘NanCallback::NanCallback(const v8::Handlev8::Function&)’:
…/…/nan/nan.h:733:49: error: no matching function for call to ‘v8::Object::New()’
…/…/nan/nan.h:733:49: note: candidate is:
In file included from /home/atom/.atom/.node-gyp/.node-gyp/0.11.13/src/node.h:61:0,
from …/…/nan/nan.h:134,
from …/src/main.cc:1:
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:2372:24: note: static v8::Localv8::Object v8::Object::New(v8::Isolate*)
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:2372:24: note: candidate expects 1 argument, 0 provided
In file included from …/src/main.cc:1:0:
…/…/nan/nan.h: In destructor ‘NanCallback::~NanCallback()’:
…/…/nan/nan.h:740:12: error: ‘class v8::Persistentv8::Object’ has no member named ‘Dispose’
…/…/nan/nan.h:741:12: error: ‘class v8::Persistentv8::Object’ has no member named ‘Clear’
…/…/nan/nan.h: In member function ‘void NanCallback::SetFunction(const v8::Handlev8::Function&)’:
…/…/nan/nan.h:746:39: error: ‘NewSymbol’ is not a member of ‘v8::String’
…/…/nan/nan.h: In member function ‘v8::Localv8::Function NanCallback::GetFunction()’:
…/…/nan/nan.h:750:46: error: ‘NewSymbol’ is not a member of ‘v8::String’
…/…/nan/nan.h:751:25: error: expected primary-expression before ‘>’ token
…/…/nan/nan.h:751:27: error: expected primary-expression before ‘)’ token
…/…/nan/nan.h: In member function ‘void NanCallback::Call(int, v8::Handlev8::Value)’:
…/…/nan/nan.h:759:13: error: ‘NewSymbol’ is not a member of ‘v8::String’
…/…/nan/nan.h:759:51: error: expected primary-expression before ‘>’ token
…/…/nan/nan.h:759:53: error: expected primary-expression before ‘)’ token
…/…/nan/nan.h:761:9: error: ‘GetCurrent’ is not a member of ‘v8::Context’
…/…/nan/nan.h: In member function ‘void NanAsyncWorker::SavePersistent(const char
, v8::Localv8::Object&)’:
…/…/nan/nan.h:808:17: error: ‘NewSymbol’ is not a member of ‘v8::String’
…/…/nan/nan.h: In member function ‘v8::Localv8::Object NanAsyncWorker::GetFromPersistent(const char*)’:
…/…/nan/nan.h:815:24: error: ‘NewSymbol’ is not a member of ‘v8::String’
…/…/nan/nan.h:815:53: error: expected primary-expression before ‘>’ token
…/…/nan/nan.h:815:55: error: expected primary-expression before ‘)’ token
…/…/nan/nan.h: In member function ‘virtual void NanAsyncWorker::HandleErrorCallback()’:
…/…/nan/nan.h:837:30: error: ‘New’ is not a member of ‘v8::String’
…/src/main.cc: In function ‘void {anonymous}::Runas(const v8::FunctionCallbackInfov8::Value&)’:
…/src/main.cc:28:22: error: ‘New’ is not a member of ‘v8::String’
…/src/main.cc:30:22: error: ‘New’ is not a member of ‘v8::String’
…/src/main.cc:34:42: error: ‘New’ is not a member of ‘v8::String’
…/src/main.cc:40:3: error: no matching function for call to ‘v8::Integer::New(int&)’
…/src/main.cc:40:3: note: candidate is:
In file included from /home/atom/.atom/.node-gyp/.node-gyp/0.11.13/src/node.h:61:0,
from …/…/nan/nan.h:134,
from …/src/main.cc:1:
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:1989:25: note: static v8::Localv8::Integer v8::Integer::New(v8::Isolate*, int32_t)
/home/atom/.atom/.node-gyp/.node-gyp/0.11.13/deps/v8/include/v8.h:1989:25: note: candidate expects 2 arguments, 1 provided
…/src/main.cc:40:3: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
In file included from …/src/main.cc:1:0:
…/…/nan/nan.h: In instantiation of ‘void NanDisposePersistent(v8::Persistent<T, v8::NonCopyablePersistentTraits >&) [with T = v8::Object]’:
…/…/nan/nan.h:786:44: required from here
…/…/nan/nan.h:394:5: error: ‘class v8::Persistentv8::Object’ has no member named ‘Clear’
make: *** [Release/obj.target/runas/src/main.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2


#11

Yeah I tried that a while back myself. The protocol I register is only inside of Atom. For this to work outside, that is from any app running, I would have to begin messing with the registry on Windows. Don’t know how this could be accomplished on Mac OS X or Linux. Long story short: I don’t think this can be accomplished in cross-platform with the current tools provided by Atom.

I only use the protocol i registered to open up local files in a specific editor that shows a globe icon next to the file name to highlight that this is a “remote” file :).
You could build on this to be able to open “atom.workspace.open(‘sftp://test.com/hi’)” style links from the console, but I don’t think that solves your problem?


#12

Hi! I just pushed a new version to atom.io. Can you try installing it? :slight_smile:


#13

Just got it, selected Packages -> Remote Edit -> Add New Host (sftp) and it bombed with this:

Window load time: 871ms
’webkitRequestAnimationFrame’ is vendor-specific. Please use the standard ‘requestAnimationFrame’ instead.
Uncaught Error: watch ENOENT fs.js:1072
Uncaught Error: ENOENT, open ‘/home/atom/.atom/remoteEdit.json’ /home/atom/.atom/packages/remote-edit/lib/model/inter-process-data-watcher.coffee:37

I had to just ‘touch .atom/remoteEdit.json’ and all is well


#14

ahh ok. great that you found a solution so quickly. I’ve changed libraries for watching files, and it seems that the new library doesn’t create the file if it doesnt exist. Will push a new version that takes that into account.


#15

Also, the CTRL+C shortcut for clear hosts interferes with the CTRL+C for Copy (according to the Keybinding Resolver)


#16

Thanks. I just removed the functionality. It’s possible to delete single hosts from the select view with ctrl-d and it was kinda dangerous having that kind of global shortcut.

Just changed the underlying sftp module also, so some small issues with certain dirs not being shown should also be resolved.


#17

If I had more time to really look into it I would definitely give it a shot. However right now I’m just not able to do so. With any luck somebody will be able to take up the torch, or maybe my schedule will open up a bit. I don’t see that happening anytime in the next 18+ months but if it does this is one of those things I’d like to have done.

For testing, is there a way I can in the console open a connection using your plugin? I’m sure there is some sort of function call where I can just put in the user, pass, server and file, correct?


#18

This works great! I log in, pick a file, and it gets uploaded automatically after I edit and save it. That’s great. However, the file name in the tabs view looks like “2518460985627-[actual file name]”, is there a way to only show the file name as it is on the server? Also, could it be possible to use the tree view to easily pick a file on the server, rather than with the Remote Edit: Browse menu? I know it’s probably not as easily as it sounds to implement such features, but it would be greatly appreciated (as your plugin already is). Many thanks.


#19

Not to be rude, but I just started using remote-sync and it does everything you are asking for. Uploads every save, no file picking since it just uses the files picked by the tree, and the file name is normal. I had some problems with windows support but it was easy to patch. I like it a lot so far.


#20

I would also suggest looking at remote-sync. The plugins serve different purposes. I use this plugin to quickly edit a file without having to open up the terminal. If I’m doing multiple edits I use vim/ssh or initiate a git repository.
In regards to the file names that’s definitively something I can change :slight_smile: