Skip to content
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

Idea/Suggestion: Adds support to sync custom files #258

Closed
fjcalzado opened this issue Mar 15, 2017 · 25 comments
Closed

Idea/Suggestion: Adds support to sync custom files #258

fjcalzado opened this issue Mar 15, 2017 · 25 comments

Comments

@fjcalzado
Copy link

It would be a great idea if we can not only sync VS Code related files, but also custom files provided by the user via file path. This will be really useful specially for linters configuration files.
Right now you have a feature called Customized Sync but is intended just to remove files from syncing right? I propose the other way round, adding custom files to be sync, so that we can deploy them in any other machine. In order to be useful, user should have to indicate where to download this custom files in each machine.

@shanalikhan
Copy link
Owner

Please give a proper scenario for your case along with files names and their path

@fjcalzado
Copy link
Author

fjcalzado commented Mar 15, 2017

Sure, lets consider a bunch of linters typically installed in VSCode through extensions: ESLint, StyleLint and HTMLHint for example, and also the widely used Beautify extension. All of them are customizable via configuration files:

.eslintrc
.stylelintrc
.htmlhintrc
.jsbeautifyrc

They could be located anywhere actually, cause linters will find for them recursively upwards in the folder tree. In my case, in order to keep common settings for all my project, I have them saved in
C:\dev\
Which is the root folder for all my development projects.
It would be nice to be able to tell Sync to consider these files as well, along with the VSCode setting files. So that I can synchronize them in different machines and different paths. Just to put an example:
MachineA: C:\dev\.eslintrc synched with MachineB: D:\Users\[username]\code\.eslintrc

Maybe paths should be stored in a new file (e.g.: customFileMapping) and also uploaded to Gist. This file will contain the different paths for each file in each machine. This way, machines can resolve where to download each one.

The files provided in this scenario are just examples. The idea would be to allow whatever file (maybe you can apply restrictions if you desire, only text files or light files) in whatever path.

@soundstep
Copy link

soundstep commented Jul 12, 2017

It would also be nice to be able to save launch configurations.
The launch file is in .vscode/launch.json.
It looks like this:

{
    // Use IntelliSense to learn about possible Node.js debug attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug Nightwatch (grunt)",
            "program": "/usr/local/bin/grunt",
            "args": ["tests:integration:chrome"],
            "cwd": "${workspaceRoot}",
            "stopOnEntry": false
        }
    ]
}

Mote info there:
https://code.visualstudio.com/docs/editor/debugging#_launch-configurations

@shanalikhan
Copy link
Owner

There would be something like syncCustomFiles with their name and path.

When users upload the files it will upload the files from the specific path and upon download it will replace those files in their path.

@tasugo
Copy link

tasugo commented Jul 27, 2017

I think there's some difference to note betweetn vscode files (such as tasks.json, that is generated by the editor whenever you save a task) and custom per project/per language files such as .eslintrc.

Editor files can be saved by default if present, custom files would need a list provided by the user as ti which files they want to save.

@ekulabuhov
Copy link

ekulabuhov commented Mar 12, 2018

As a workaround for launch.json VSCode also supports storing launch configurations in it's preferences under "launch" key:

"launch": {
	"configurations": [ { "type": "node", ... } ]
}

settings.json is uploaded as part of the gist.

@YesThatAllen
Copy link

I'd use this to sync my .code-workspace files (as discussed in #460 )

@shanalikhan
Copy link
Owner

shanalikhan commented Sep 13, 2018

It should work like:

customFiles:
[
"fileName1" : "pathOfFile",
"fileName2" : "/home/project/setting.json"
]

Read those paths and upload and while downloading place those files in the path specified

@IssueHuntBot
Copy link

@BoostIO funded this issue with $60. Visit this issue on Issuehunt

@ghost
Copy link

ghost commented Oct 1, 2018

@shanalikhan I'd like to contribute with this one. This extension is a must have for me since I have to use newly installed machines frequently (linux and windows). I use a lot of dot files configs.
I was thinking, once the file was downloaded it should be a command like >sync import $file_name$. For instance, I want to sync a frequently used .babelrc and use it in different projects, so I only have to mark that file in the sync settings and then import it whenever I want through the command palette.

What do you think? Please tell me your ideas and I will start to work on this as soon as I can

@shanalikhan
Copy link
Owner

shanalikhan commented Oct 3, 2018

@b1tdust

once the file was downloaded it should be a command like >sync import $file_name$. Please tell me your ideas and I will start to work on this as soon as I can

There is already issue opened #403 but code doesnt allow extensions to register commands CLI.

What you we do for to add something like this.

customFiles:
[
"babelrc" : "path/of/babelrc",
"fileName2" : "/home/project/setting.json"
]

When user uploads Settings Sync needs to upload file in path path/of/babelrc with name babelrc in GIST.
On downloading the file, Settings Sync will read the babelrc and put in path/of/babelrc.

once the file was downloaded it should be a command like >sync import $file_name$

Once it is done, we can have new command in Advance Settings of Settings Sync Import File to workspace. That path/of/babelrc will be copied to the current workspace when user select this file from the list in visual studio code.

@ghost
Copy link

ghost commented Oct 4, 2018

@shanalikhan I meant the command pallet (ctrl + shift + p in linux). Something similar to
image
What do you think? Since the imported file will be needed when you are in vscode more than importing it through CLI.

I will be working on this this weekend (tough week at work)

@IssueHuntBot
Copy link

@tkrtmy has started working. Visit this issue on Issuehunt

@tkrtmy tkrtmy mentioned this issue Oct 4, 2018
@IssueHuntBot
Copy link

@tkrtmy has submitted output. Visit this issue on Issuehunt

@shanalikhan
Copy link
Owner

As @tkrtmy has send the initial PR with further work required.
The details are mentioned at #666 (comment)

@b1tdust

@tkrtmy
Copy link

tkrtmy commented Oct 13, 2018

@shanalikhan I fixed this issue. What should I do to get the bounty at issuehunt..?

@shanalikhan shanalikhan modified the milestones: Backlog, v3.2 Oct 16, 2018
@shanalikhan
Copy link
Owner

i will transfer in this week.

@shanalikhan
Copy link
Owner

v3.2 is released with this feature. Let me know if there is any problem

@IssueHuntBot
Copy link

@shanalikhan has rewarded. Visit this issue on Issuehunt

@carlocardella
Copy link

Sorry to jump on a closed thread, but how is this supposed to work exactly? I have added a couple of custom files on one machine, I see the relevant lines added to syncLocalSettings.json and the files are uploaded to my private Gist, but then when I sync/download on a second machine syncLocalSettings.json does not get updated therefore the second machine does not know to download the two custom files (I don't see them created in the destination folder, even if the folder exists)

@tkrtmy
Copy link

tkrtmy commented Oct 19, 2018

@carlocardella
syncLocalSettings.json is not synced. it is edited only local.
if you'd like to download & sync custom file in also other machine, you should decide file location and use >Sync : Add Custom Sync File path option to specify absolute path on the second machine too.
After that, you can custom file download from gist to the second machine.

@shanalikhan
Copy link
Owner

shanalikhan commented Oct 19, 2018

PUBLIC WIKI :

https://github.com/shanalikhan/code-settings-sync/wiki/Custom-Sync

Feel free to improve this page where required.

@carlocardella
Copy link

Thanks, I figured that after a few tests but my initial guess (admittedly without fully reading the new docs) was that since the extension already synchronizes a number of settings (and does an excellent job at it, it saved me a few times already) and seeing the custom files are uploaded to the same Gist used for other settings, downloading on a new machine would have downloaded the custom files as well.
Sounds like a nice new feature/improvement request then 😊

@norixx
Copy link

norixx commented Oct 25, 2018

I clean-installed VSCode, of course syncLocalSettings.json got deleted. Since that file was missing , all paths of my custom files were gone. Then I thought it would be a good idea to sync syncLocalSettings.json itself as customFiles.
I imported it separately after recovering essential files. Just an idea.

@carlocardella
Copy link

Interesting idea, thanks for the suggestion.
syncLocalSettings.json though also contains the last sync upload and download timestamp, I have not tested it but doesn't that confuse the subsequent sync operations, assuming the timestamp is actually used and is not just there for reference?

 "lastUpload": "2018-10-25T13:23:20.523Z",
 "lastDownload": "2018-10-24T14:53:48.190Z",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants