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

Specify different code formatter settings per package #985

Open
daniels220 opened this issue Jul 24, 2020 · 4 comments
Open

Specify different code formatter settings per package #985

daniels220 opened this issue Jul 24, 2020 · 4 comments

Comments

@daniels220
Copy link
Contributor

I personally prefer periodsAtEndOfMethod: true for my own code, but I see that this is not the convention in Dolphin core. It would be nice if I could specify different settings depending on what code I'm editing—doing this at the package level seems the most obvious place.

I imagine this is nontrivial—with the settings stored in class vars, seems like a fair bit of refactoring would be needed. Unfortunately I don't think Pharo has this capability either (to crib from). If you like the concept, and have an idea of the approach you'd like to take, I might be able to work on it.

@blairmcg
Copy link
Contributor

If it's something you find important, then why not. I agree it sounds like a per-package setting is probably best.

I think it makes sense to store a generic settings Dictionary on Package that could contain such things and any other metadata that might be needed, and file it out as part of the .pax. Storing it in STON pretty-printed format would make a lot of sense. To avoid load order the settings could be saved in serialised STON string form into the existing properties Dictionary at load time, and then de-serialised out into an instance variable on demand when required. The reference to STON could either be dynamic, or put the Package settings accessor method in the Development System package. We can neaten it up later if necessary.

@fxgallego
Copy link
Contributor

Does this mean if you want a custom setting in all your packages then you would change it in each one? How would you inherit the settings at "folder" level, for example?
I think that Dolphin development (this project) should be done using a Dolphin image, not your development image so I don't see the problem. But maybe there is a good explanation 😄
It would be useful to save the user preferences locally, some IDE's do that in a "dot folder/file" inside the project's root folder so you can commit the preferences with your source code, if you want. I usually ignore the preferences.

@blairmcg
Copy link
Contributor

Good points from @fxgallego. Storing at the package level would be too awkward to manage, at least for this.

@daniels220
Copy link
Contributor Author

Fair point about the awkwardness of handling settings across a large number of packages—I was aiming for a minimum-viable solution and planning on just using a script to automate applying the settings to a large number of packages. Inheritance would be great, but since there's no persistent object representing a folder that would be harder. It might make sense to create one—certainly other languages have systems of inheriting settings files that apply to everything in the folder they're in—but that's a lot more work.

As for keeping Dolphin development in a Dolphin image...I think that's throwing away one of the huge advantages of Smalltalk, which is precisely that the development tools are always open to modification and you don't have to open a separate project/tool/image to work on them—and, having made whatever changes, they become immediately available to you to work on whatever actual business problem. I've never sat down and said "okay, I'm going to work on X development feature now"—rather, I'm working on another problem, need a tool to help me solve it, write the tool, solve the problem. So keeping that workflow fluid is important to me.

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