-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
Project-specific config settings #1146
Comments
There is an API for this, but it doesn't define any conventions about where the project-specific settings live. Two different packages use this API: project-config and atomic-management. Both expect the custom config file to live in an So that's the good news — you can install one of these packages and enjoy project-specific config settings today! I expect that, if we ever did move this functionality into core, we'd “pave the cowpaths” and implement what already exists in these packages — likely with support for either file format. |
I have set up atomic-management in my own environment, and it seems to accomplish exactly what I was looking for. Thanks for the tip (and I hope that this bug report guides the next person who goes looking for this functionality). I have a mild concern regarding security for this style of implementation (in that a .atom directory with malicious or short sighted contents might find its way into a git repository, potentially resulting in unanticipated behavior in Pulsar clients that download and open such a project), and if the functionality were to become core, I feel like that kind of possibility should be mitigated against in some fashion. In any case, my own use case has been adequately handled; feel free to either close or leave open this issue as per your own preference. |
If we did implement it in core, I imagine that you'd have to grant permission the first time you opened a project at a specific location. But I also think that there aren't major security implications here — in the sense that the worst it could do is change some of your settings. I can't immediately think of any packages that would do something silly like execute arbitrary code that happened to use a config setting as its payload. The biggest issue, actually, may be the UX around custom settings, since they aren't visible in the |
I'm going to treat this as the canonical ticket for this request. That means it may be open for a while, but it'll also accumulate discussion and knowledge — some of which I'm about to dump below. |
History of project-specific config in Atom/PulsarAtom's support for project-specific config is minimal; it exists as two methods on RFCRFC 001 proposed a project-specific config system.
Near as I can tell, none of this ever got implemented! It may have clarified the discussion, but it wasn’t an influence on the API design. Pull requestSeparately, another user (apparently a contributor to Nuclide) opened a PR whose goals overlapped with those of the above RFC:
Over the course of the review of the aforementioned PR, the feature appeared to get progressively genericized. For instance: there doesn’t seem to be any code that enforces the The most important part of the PR was the The ability to specify a project file via This, however, was enough — it was a feature without a GUI and without a canonical configuration location, but community packages rushed to fill the void. Community usageatomic-management and project-config work nearly identically: they both envision a This is a strong convention to build upon because it matches what VS Code ended up doing for a similar feature: putting all VS Code–specific stuff under a Though it’s not documented, both packages seem to allow you to include or eschew the top level of the If you structure your project-specific configuration file the same way, it appears to work just fine. If you assume that all of your project-specific configuration overrides are applied to all scopes — and thus skip the top level of keys, much like the My recollection is that this is a feature of the underlying CaveatsIt’s fair to say that this feature was added without a huge amount of rigor; this was in 2018 at a point when (I suspect) Atom was clearly deprioritized after the Microsoft acquisition and the Atom team were looking out the window for their next opportunity. If there had been more attention paid to it, I would imagine that they’d have adopted this feature more holistically. settings-viewFor instance: I fixed this in #655 by ensuring that It would be nice to represent all of this complexity cleanly in the Naming conventionIt’s also true that neither the File formatsAtom and Pulsar both strongly tilt toward using CSON for configuration, but they both seem to support the usage of JSON; I’ve never tried it, but it seems to be possible to define a Likewise, if Pulsar supported a project-specific configuration file, it should allow either file format instead of forcing the user to choose (as both community packages do). Multiple project rootsThe RFC points out one potential gotcha from looking for a config file in a specific location from the project root: technically, an Atom/Pulsar project can have more than one root folder! (I don’t know whose idea this was, but it’s the bane of my existence.)
The When project paths changeThe RFC asks what should happen to config overrides when a new root is added to the project, or a root is removed from a project.
Because it has solved the multiple-roots problem, ConclusionIf we were to implement this, how would it work? Here’s my suggestion:
In my opinion, the existence of It would still be worth bringing into core in the future if we did want to go further and support more project-specific stuff in the style of VS Code. |
There's one other issue that's a bit deeper and I'm not sure what the resolution should be: Suppose you have a config key whose value is an array, as in the example in #655’s description. If you wanted to override the config value merely to add a value that may not be there, you're stuck; you can only replace the value altogether. Likewise, you can't subtract a value that may be present. To apply the modification you want, you have to know ahead of time what the current value is, and that's not realistic if a team is sharing an This is a result of Such enhancements might be worth applying in the future — perhaps as a new file inside the |
Per-project array configuration might be tricky to do well. Suppose that there's a particular value within an array in the global config file; a session is then opened within that environment such that one project's config file adds that value in again, two more explicitly remove that same value, a fourth makes unrelated changes to the array storing that value, and a fifth doesn't change the array at all. It's not entirely clear from a technical standpoint whether the application should treat the configuration as having that value set or not, and if the config files themselves are ordered to give one of the project's config files priority over the others, that might interfere with the desired result for /other/ configuration values. An implicit priority scheme (a la CSS) or an explicit priority value (a la Linux package management) might even be warranted to remove the ambiguity of how such a case should be handled. |
Have you checked for existing feature requests?
Summary
I think it would be useful for the Pulsar editor to allow for project-specific overrides to be made to config.cson configuration values. This might be achievable by consulting a .pulsarrc file in the project's directory (which Google's search AI has "helpfully" hallucinated as a feature that Pulsar already supports), but an existing file/directory that's already used for project metadata might be a more appropriate (and probably more secure) place to implement such a thing instead.
What benefits does this feature provide?
This feature would allow for conveniently using settings that would benefit a particular project, even if such settings might not be desirable for Pulsar use in general.
As an example of how this could be useful, I've recently started looking into the git repository of a project that uses .html files for HTML content with Twig syntax (rather than another extension such as .html.twig). I have the php-twig package installed (and therefore have access to the "HTML (Twig)" grammar), but as far as I can tell, with the way things are now, I have a few broad options for how I use Pulsar, and none of them are entirely ideal:
Having a place to specify per-project configuration settings would allow for avoiding the downsides that each of the currently available options would entail.
Any alternatives?
I'm not familiar enough with the nature of the API that packages have access to to assess whether this could potentially be implemented as a package. Pulsar uses packages for surprisingly low level features (such as tabs), but changes to where and how Pulsar derives its configuration settings might require an even higher level of access than what the packages API gives.
Other examples:
No response
The text was updated successfully, but these errors were encountered: