Gruntfuggly / global-config

Allows copying of shared config settings in vscode
MIT License
12 stars 4 forks source link

Hardlinks #11

Closed lonix1 closed 3 years ago

lonix1 commented 3 years ago

First off @Gruntfuggly congratulations on another fine extension... funny how many great extensions you've made!

Use case:

Problem:

If I use the "copy" option, then the config cannot be easily changed for all projects at once (I'd need to rerun the extension for every project upon every config change), but I can commit those config files to git.

If I use the "symlink" option, then I can easily change config for all projects at once, but I cannot commit the config files to git (the symlink itself is committed, not the target file in ~/.vscode).

Solution:

A "hardlink" option (fs.link). This would be backward compatible for existing users, and would allow the use case above. It should be cross platform.

What do you think?

Gruntfuggly commented 3 years ago

Seems perfectly reasonable 🙂 I'll add it as a separate config setting, so that it will definitely be backward compatible.

lonix1 commented 3 years ago

Looking forward to that!

I'm on linux BTW, so let me know if you want me to test it for you on linux.

Gruntfuggly commented 3 years ago

I can do linux/macos no problem. It's Windows that's a pain. But links in Windows are a whole different game anyway, so it's probably easier implement it and wait for somebody to complain!

Gruntfuggly commented 3 years ago

Try the latest version - seems to work fine for me on macos.

lonix1 commented 3 years ago

I've installed v0.0.12 but the new global-config.hardLinks setting isn't available...

How/where can I download the new version?

Gruntfuggly commented 3 years ago

Sorry - the publish failed and I didn't notice. 0.0.13 should be available in a couple of minutes.

Gruntfuggly commented 3 years ago

OK - it's available now.

lonix1 commented 3 years ago

Works nicely, thanks!!!

It's really useful extension when you have loads of projects, and you want the same config in all of them. :smile:

Gruntfuggly commented 3 years ago

Thanks - I find it useful because I tend to open lots of code workspaces within the same project. Makes it easier for searching, etc. 🙂

lonix1 commented 3 years ago

One question, I fiddled around with subdirectories until I realised it detects multiple subdirs and allows me to choose between them, which is a cool feature (you can have multiple config "sets").

But do I need to specify specifically which files gets copied/linked (in that array), or can I make it pull all of them found in a subdir?

Gruntfuggly commented 3 years ago

lol - I'm not sure. It just uses copySync from fs-extra. From the docs, it sounds like it copies directory contents too, so I think it will just work on the directory itself.

I assumed it would never be used for anything much more complicated than copying tasks.json, settings.json, etc.

lonix1 commented 3 years ago

Actually let me play around with it and open a separate issue about that, I think it's actually a little more involved than I thought at first glance! I want to do some testing....

Gruntfuggly commented 3 years ago

It iterates over the contents of the specified directory, so I'm not sure if it handles the contents of subdirectories directly or not. It logs each 'file' it finds in the output channel, so you should be able to see what it is doing.