brackets-archive / bracketsIssues

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

[CLOSED] Local .brackets.json array values being ignored #9520

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by sandcastle Saturday Apr 04, 2015 at 03:40 GMT Originally opened as https://github.com/adobe/brackets/issues/10827


I'm using the file tree exclude plugin. When trying to set local settings for this plugin they are being ignored - I assume this somehow due to the fact that the value is an array as other local settings (not arrays) are working fine. When setting the values globally it works fine.

Local file:

{
  "sortDirectoriesFirst": true,

  "jwolfe.file-tree-exclude.list": [
        "node_modules",
        "bower_components",
        "tmp"
    ]
}

This appears to be impacting both Windows and Mac clients - for more information on this, please refer to the open issue on the plugin repo:

https://github.com/JonathanWolfe/file-tree-exclude/issues/2

core-ai-bot commented 3 years ago

Comment by redmunds Saturday Apr 04, 2015 at 14:21 GMT


@sandcastle The type of data doesn't matter to the preferences system. It's all a matter of what the extension is expecting, so this is a bug with the extension.

I'm not sure why the author calls Glenn Ruehle's exclude-folder plugin "defunkt" -- as far as I know it still works, so maybe try that plugin instead.

core-ai-bot commented 3 years ago

Comment by sandcastle Sunday Apr 05, 2015 at 12:35 GMT


@redmunds thanks for the feedback - I will take this up with the plugin author :smile:

core-ai-bot commented 3 years ago

Comment by PhiLhoSoft Sunday Apr 05, 2015 at 21:38 GMT


I'm not sure why the author calls Glenn Ruehle's exclude-folder plugin "defunkt"

Perhaps because the last commit was made a year ago... Looks like the old project required to hack the source to exclude other folders, which is not practical, particularly in case of updates!

core-ai-bot commented 3 years ago

Comment by peterflynn Tuesday Apr 07, 2015 at 02:24 GMT


@PhiLhoSoft Plenty of useful extensions can go more than a year without needing any updates to keep working. I'm pretty sure that one still works fine.

At any rate, we're planning on an official feature for excluding files in the (hopefully near) future, at which point both extensions will be "defunkt" :-)

core-ai-bot commented 3 years ago

Comment by PhiLhoSoft Tuesday Apr 07, 2015 at 09:11 GMT


That's a good point. Some micro-extensions are better in the core, when proved useful, anyway. Stuff like clicking in the gutter to select a line, view whitespace, and so on. Stuff really basic in most text editors.

core-ai-bot commented 3 years ago

Comment by JonathanWolfe Wednesday Apr 15, 2015 at 01:16 GMT


@PhiLhoSoft I waited for it to land forever so I finally had to revamp Ruehle's old plugin as a stop gap until then.

I also cannot get the plugin to load the project's .brackets.json. The .gets always return the global variable's value regardless of requested context.

core-ai-bot commented 3 years ago

Comment by redmunds Wednesday Apr 15, 2015 at 02:36 GMT


@JonathanWolfe

I also cannot get the plugin to load the project's .brackets.json. The .gets always return the global variable's value regardless of requested context.

A .brackets.json file in the root folder of a project gets automatically loaded and the values override the global brackets.json file -- there's nothing that a plugin needs to do. Use File > Open Folder... to select folder that contains the .brackets.json file to be the current "project".

core-ai-bot commented 3 years ago

Comment by PhiLhoSoft Wednesday Apr 15, 2015 at 08:44 GMT


The "override" mechanism is a bit annoying: we might want, in some cases, a merge instead. Particularly in the case of@JonathanWolfe's extension, where we might want to define generic excludes (node_modules, etc.) and excludes specific to a project.

Beside, it doesn't work with this extension : in brackets.json:

"jwolfe.file-tree-exclude.list": [
    "/node/",
    "node_modules",
    "bower_components",
    ".git",
    ".idea",
    ".sass-cache",
    ".settings",
    "/dist/",
    "/target/"
],

in project's .brackets.json:

"jwolfe.file-tree-exclude.list": [
    "enunciate",
    "deploy",
    "it",
    "java"
]

I do see the enunciate and java and all these folders, while .settings and node and visible but shown empty, while node_modules and .idea are entirely hidden. Not sure why there is a difference in treatment. Anyway, my point is that currently I have to move project-specific excludes to the global settings to make them effective.

core-ai-bot commented 3 years ago

Comment by redmunds Wednesday Apr 15, 2015 at 14:52 GMT


@PhiLhoSoft Correct, the preferences system does not merge values (arrays or otherwise). They are overridden.

core-ai-bot commented 3 years ago

Comment by JonathanWolfe Wednesday Apr 15, 2015 at 14:55 GMT


@redmunds Overriding is what I want, except that no matter what I always get the global brackets.json info, and never the project's .brackets.json. And I've tried every .get in the api.

core-ai-bot commented 3 years ago

Comment by redmunds Wednesday Apr 15, 2015 at 15:03 GMT


@JonathanWolfe Make sure project prefs file is named correctly and in the project root folder. Brackets must be opened to the same project root folder. Make sure there are no syntax errors in json -- the JSONLint extension makes this easy. Make sure key is correct and in quotes. Make sure encoding of prefs file is UTF-8. Not sure what else it could be.

core-ai-bot commented 3 years ago

Comment by PhiLhoSoft Thursday Apr 16, 2015 at 11:59 GMT


For the record, my .brackets.json file has other settings "language": { "javascript": { "useTabChar": false } }, that override a global (defined in brackets.json) "useTabChar": true, and only for this project. So this eliminates bad placement of the file, bad syntax inside it (it would be reported, anyway, would it? -- just checked, not at all, but I see the change in the above setting) and such.

core-ai-bot commented 3 years ago

Comment by redmunds Thursday Apr 16, 2015 at 14:44 GMT


I took a quick look at the extension code (i.e. I haven't tried running it or stepping through it) and it looks like the prefs are retrieved at extension load time. The prefs for your default startup project may not have been loaded, and any project that you switch to later will definitely not have been loaded. Try waiting until _indexFilter() is called to retrieve the pref.

If that fixes problem, you can probably be more efficient by only updating prefs on "projectOpen" event.

core-ai-bot commented 3 years ago

Comment by JonathanWolfe Friday Apr 17, 2015 at 02:53 GMT


I did finally solve the issue by waiting on appReady and then refreshing the filetree. (Otherwise not waiting for appReady and just running on _indexFilter's regular time would use the global settings until the appReady event naturally fired.