liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.51k stars 267 forks source link

Watcher Glob? #95

Open kinoli opened 6 years ago

kinoli commented 6 years ago

I have 2 watcher directories. I can't figure out how to set the glob for it. Can you help?

aaronbartell commented 6 years ago

I am also struggling to get watcher working (Windows 10). When I put new files in the root of the project it doesn't do anything.

Below is my config.

{
    "protocol": "sftp",
    "host": "DEV400",
    "port": 22,
    "username": "aaron",
    "password": null,
    "agent": null,
    "privateKeyPath": "C:\\Users\\user\\.ssh\\id_rsa",
    "passphrase": null,
    "interactiveAuth": false,
    "remotePath": "/home/aaron/sftp_test",
    "uploadOnSave": false,
    "syncMode": "update",
    "ignore": [
        ".vscode",
        ".git"
    ],
    "watcher": {
        "files": "**",
        "autoUpload": true,
        "autoDelete": true
    }
}

Are there other things I can test?

kinoli commented 6 years ago

It works fine for me if it's a single string, but I can't figure out the patter when I have 2 strings to put in there. I would think it should be an array like 'ignore' but that doesn't work.

aaronbartell commented 6 years ago

@kinoli Can you post your config?

Note it works for me on my Mac, just not on Windows 10.

kinoli commented 6 years ago
{
    "host": "",
    "port": 22,
    "username": "",
    "password": "",
    "protocol": "sftp",
    "agent": null,
    "privateKeyPath": null,
    "passphrase": null,
    "passive": false,
    "interactiveAuth": false,
    "remotePath": "/data/projectname",
    "uploadOnSave": true,
    "syncMode": "update",
    "watcher": {
        "files": "public/lib/", // this is where I need to add a second directory
        "autoUpload": true,
        "autoDelete": false
    },
    "ignore": [
        "**/.vscode/**",
        "**/.git/**",
        "**/.DS_Store",
        ".htaccess",
        ".gitignore",
        ".codekit-cache",
        "config.codekit",
        "config.codekit3",
        "gulpfile.js",
        "package.json",
        "src/**",
        "_db/**"
    ]
}
liximomo commented 6 years ago

@aaronbartell Try files: **/*

liximomo commented 6 years ago

@kinoli You could do this {paht/to/a/*,path/to/b/*}.

aaronbartell commented 6 years ago

@liximomo I made the suggested change and it still isn't uploading when I add new files. Below is a link to my "Help->About" for VSCode.

Version 1.19.3
Commit 7c4205b5c6e52a53b81c69d2b2dc8a627abaa0ba
Date 2018-01-25T10:36:34.867Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

NOTE: The uploadOnSave feature works fine Windows, so it's not a connection issue. Also, the same watcher config works on my Mac. Are there additional file-watcher things I need to install when working on Windows?

aaronbartell commented 6 years ago

UPDATE

I found the issue. It had to do with me running Windows 10 in virtual environment (Parallels on Mac) and the file path composition/flavor, which is more Linux-like. I moved the VSCode project directory from the shared Parallels directory to c:\temp and the watcher now works.

roryheaney commented 6 years ago

This wasn't an issue before but experiencing it in a virtual environment as well now.

andrew-mykhalchuk commented 6 years ago

@liximomo Similar issue here but I'll rephrase it a bit. So I work on large ecommerce project and need to specifically point watcher to only few folders like css, html, jsp and js. According to comment in config "files": is expecting string so can't use an array there. This feature exists in plugins for other code editors and looks like the following:

Remote sync for Atom

"watch": [
    "/assets",
    "/html",
    "/jsp"
  ],

Remote FTP for Atom

 "watch":[ // array - Paths to files, directories, or glob patterns that are watched and when edited outside of the atom editor are uploaded. Default : []
    "/assets",
    "/html",
    "/jsp"
 ],
liximomo commented 6 years ago

@mehocode Maybe I should support array as a value.

junxion-io commented 6 years ago

Yes please!

liximomo commented 6 years ago

Currently You could watch array of files in this way:

 "watch":  { 
    files: '{/a/*,/b/*,/c/*}'
}
steveja42 commented 4 years ago

Can you please add an example in the docs? So people can know how to watch multiple files. "watcher": { "files": "{dist/.,package.json}", "autoUpload": true, "autoDelete": false }