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

Add VSCode configuration setting for default Unibeautify configuration file #55

Closed
muuvmuuv opened this issue Jun 20, 2018 · 10 comments
Closed

Comments

@muuvmuuv
Copy link
Contributor

muuvmuuv commented Jun 20, 2018

I have several of my configurations in my Dropbox folder and want to link to them from UB. That would be very nice!


Update: Add support for unibeautify.defaultConfig (type: string) configuration option which points to a .unibeautifyrc config file? This would likely require a change to: https://github.com/Unibeautify/vscode/blob/master/src/EditProvider.ts#L105-L109
Also see https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributesconfiguration
Please let me know if you have any questions!

@Glavin001
Copy link
Member

The best practice would be to include your configuration in the same VSCode project/workspace.
If your project is not within the same Dropbox folder, I would recommend setting up something like symlinks:

This could be your .unibeautifyrc.yml configuration file or you could use prefer_beautifier_config for non-Unibeautify configuration files: https://unibeautify.com/docs/options-for-beautifiers.html#prefer-beautifier-configuration

This is currently supported by PHP-CS-Fixer Beautifier as follows:

---
PHP: # Language
  beautifiers: # Enable beautifiers
  - PHP-CS-Fixer
  PHP-CS-Fixer:
    prefer_beautifier_config: true

https://github.com/Unibeautify/beautifier-php-cs-fixer/blob/master/src/index.ts#L77

For example, PHP-CS-Fixer supported formats are .php_cs and .php_cs.dist.


If you could provide more details on your use case, we can help more 😃 .

@Glavin001 Glavin001 self-assigned this Jun 20, 2018
@Glavin001
Copy link
Member

We can reopen if you have more questions 😃 .

@muuvmuuv
Copy link
Contributor Author

Hm I know what you mean by symlinking them, I already do it like this, but I really don‘t want to symlink all my confs in every project every time. It would be way smoother to specify the path to the conf in the .unibeautifyrc like this:

{
  "PHP": {
    "beautifiers": ["PHP-CS-Fixer"],
    "prefer_beautifier_config": "/Users/marvinheilemann/Dropbox/Configs/.php_cs"
  }
}

and another idea would be to have one .unibeautifyrc in my dropbox folder and link to it via a VSCode setting (to rule them all 😄)

@Glavin001
Copy link
Member

Unibeautify is optimized for the conventional workflow where project's configuration is contained in the same project directory.

It would be way smoother to specify the path to the conf in the .unibeautifyrc like this:
...
"prefer_beautifier_config": "/Users/marvinheilemann/Dropbox/Configs/.php_cs"

Absolute paths are also usually a bad idea within projects because they are not portable.
For example, if you sent me your project, I do not have a file at path /Users/marvinheilemann/Dropbox/Configs/.php_cs.

This is also why finishPath at https://github.com/Unibeautify/beautifier-php-cs-fixer/blob/master/src/index.ts#L79 stops at the project's root directory: anything outside of the project cannot be assumed to exist in the same location.

and another idea would be to have one .unibeautifyrc in my dropbox folder and link to it via a VSCode setting (to rule them all 😄)

I think this would be acceptable. 😃 Especially when we considering cases where a project does not have a Unibeautify configuration at all you want it to fallback.

@muuvmuuv would you be interested in adding support for unibeautify.defaultConfig (type: string) which points to a .unibeautifyrc config file? This would likely require a change to: https://github.com/Unibeautify/vscode/blob/master/src/EditProvider.ts#L105-L109
Also see https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributesconfiguration
Please let me know if you have any questions!

@Glavin001 Glavin001 changed the title Add option to pull config from path for different languages Add VSCode configuration setting for default Unibeautify configuration file Jun 20, 2018
@Glavin001 Glavin001 reopened this Jun 20, 2018
@Glavin001 Glavin001 assigned muuvmuuv and unassigned Glavin001 Jun 20, 2018
@muuvmuuv
Copy link
Contributor Author

I got what you mean, I will work with symlinks now ^^ anyway it would be cool (I don't share the most of my projects)

For the other thing, I‘ll have a look. I don‘t have much time the next month, but It seems like a little update to the code.

@Glavin001
Copy link
Member

Let me know if / before you start working on it. I might be able to implement this feature if I have some time this weekend, since it is small. Usually though, I have other higher priority tasks to work on so I would expect open-source contributors to make a Pull Request 😄.

@Glavin001 Glavin001 self-assigned this Jun 21, 2018
@muuvmuuv
Copy link
Contributor Author

@Glavin001 started already 😁

@Glavin001
Copy link
Member

Awesome! 🎉 Let me know if you have any questions.

@Glavin001 Glavin001 removed their assignment Jun 21, 2018
@stevenzeck
Copy link
Contributor

Was this closed by #57?

@muuvmuuv
Copy link
Contributor Author

@szeck87 yes

Sent with GitHawk

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

3 participants