brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] Saving the tabs settings per file/project #2859

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by TomMalbran Tuesday Mar 05, 2013 at 03:19 GMT Originally opened as https://github.com/adobe/brackets/pull/3039


With this pull request changing the tabs type and tabs size will only change it for the current file. It also adds new tab settings for the entire project available at the project settings dialog. This will set all 3 tab settings for every open instance within the project, but only the ones that the file doesn't have saved, and will save them in the persistent storage so that the every new file opened will default to the project settings.


TomMalbran included the following code: https://github.com/adobe/brackets/pull/3039/commits

core-ai-bot commented 3 years ago

Comment by peterflynn Tuesday Mar 12, 2013 at 01:20 GMT


@TomMalbran I haven't done an in-depth code review of this yet, but I have a couple high-level concerns first:

So, that's a whole bunch of stuff to tackle... and the infrastructure & UI level discussions could take some time. I wonder whether you could address many of the same pain points by starting with tab setting autodetection per file, without manual per-file overrides. That seems like an easier thing to land first since it doesn't raise as many "big" questions/changes. Thoughts?

core-ai-bot commented 3 years ago

Comment by TomMalbran Tuesday Mar 12, 2013 at 02:20 GMT


@peterflynn Thanks for the review, this are some of my thoughts/ideas:

  1. I see the problem there, and it doesn't seem to be an easy fix for that yet. It would require more research and lots of code, that should be addressed in other request probably.
  2. An easy fix could be a new ProjectPreferences file that had the dialog and all the preferences for the project. Then showProjectPreferencesDialog could just grab all the preferences needed from the functions in this file. A better way would be to have the project settings for each file saved as a JSON object and use mustache to show the content of the file and then save it back getting the input values and the names as some sort of key.
  3. One idea I had but didn't implemented, was having a preferences to determine what the status bar preferences affected. So if it was in global, changing the tab preferences would change them for every file like now. And then it could have project and file to deal with the new 2 modes. But then you wouldn't be able change individual files inside the project, in the global or project mode, unless this was a per file preference too.
  4. I thought about doing that, but maybe you have a thirdparty file with its own preferences (it uses spaces, for example), and might not want to change them if you decide to start using tabs instead of spaces for the entire project. But maybe using the option in point 3 would solve this.
  5. EditorStatusBar sounds good or as mentioned in point 2 a new file.
  6. Actually freshly opened editors should use the file saved preferences or default to the project ones, since the preferences are obtained from Editor.prototype._getTabPreference. But I noticed that it is missing a isWithinProject filter to default to the global ones for none project files.
  7. Right, I haven't thought of that.

This seems all doable, except for point 1. I was doing this since I am working on another project besides Brackets that uses tabs instead of spaces, so I forget many times to change the settings and end up commiting with tabs instead of spaces. Both just having only project preferences and autodetecting per file could solve this. I added per file just to go with the Trello card and it should be useful too.

I didn't thought that auto-detection per file could solve my problem. So the idea would be a global preference that when enabled, it would check the tabs/spaces every time you switch editors and update the global preferences to what was found in the file?

Just having project preferences would be nice too, but I guess that would still have several of those open/big questions.

And, do you want me to address the merge issues anyway?

core-ai-bot commented 3 years ago

Comment by peterflynn Tuesday Mar 12, 2013 at 19:38 GMT


Oh, one other issue I just realized: afaict with this change as-is, there's no longer any way to set a global (not per-proj, not per-file) indentation preference. So if someone really dislikes our defaults, they'll have to manually reset them for every new project opened -- probably not ideal.

core-ai-bot commented 3 years ago

Comment by TomMalbran Tuesday Mar 12, 2013 at 22:37 GMT


Yes, I realized that, but I couldn't figure where to add this, since there isn't yet a preferences dialog for Brackets, and this aren't true/false preferences. My suggestion in point 3, could solve this, but without the dual mode.

So I am guessing that this pull is ahead of its time. Might be better to leave it until there is a better way to set the global, project and per file preferences.

core-ai-bot commented 3 years ago

Comment by TomMalbran Thursday Mar 28, 2013 at 22:01 GMT


@peterflynn This requests looks like a no gone at this point in Brackets, since point 1 isn't fixable right now, and other need better planning or research. I am going to just close this, but let me know if there is something i can do to bring it back.