lkcampbell / brackets-indent-guides

A Brackets extension to show indent guides in the code editor
149 stars 34 forks source link

User preferences not applied on startup or reload #17

Closed lkcampbell closed 9 years ago

lkcampbell commented 9 years ago

OS: Mac OSX Mavericks

Brackets Version: Release 1.1 development build 1.1.0-0 (master d9bc65e1d)

Extension Version: 1.3.2

Repro Steps:

  1. Add "language": { "clojure": { "brackets-indent-guides.guideColor": "red" } } to brackets.json. Any color value that is not the default color value.
  2. Open a clojure file then restart or reload Brackets.

Observed Results: Indent guides are the default color value.

Expected Results: Indent guides should be red.

Other Notes: If you navigate to a file written in a different programming language and then navigate back, the guides will turn red.

This isn't specific to the new language scope of preferences, it just happens to be a convenient way to reproduce the issue.

Also happens if you close all open files and then open a clojure file again. Don't even have to reload or restart.

lkcampbell commented 9 years ago

Here's what is happening:

In my extension, AppInit.appReady() fires off and calls applyPreferences(), which calls PreferencesManager.get() functions for all Indent Guide preferences.

The bug is related to timing. If I run the code without pausing in the DevTools debugger, the PreferencesManager.get() function is ignoring the path-specific preference information and returning the wrong values. If I run the code and step through the PreferencesManager.get() calls, the calls return the correct path-specific preferences.

This is not an Indent Guides extension bug. It appears to be a problem with the Brackets PreferencesManager module. If I get time, I will investigate the core bug and post an issue and track it.

lkcampbell commented 9 years ago

The Brackets PreferencesManager module is complex and would represent a significant amount of time and effort to fix. This issue doesn't happen very often and there are plenty of workarounds available. Closing as invalid since this really is a Brackets core bug.