-
Notifications
You must be signed in to change notification settings - Fork 279
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
Added logic to control autocomplete #678
Conversation
@hkirat your comment points to an issue in the Adobe/brackets repository, did you mean to point to a Thimble repository? If so, note that if you want to point to an issue in a different repo, you can't use the |
Thanks for pointing that out @Pomax. It points to an issue in Thimble. Updated the same. |
@hkirat thanks for the update testing now. |
src/bramble/client/main.js
Outdated
@@ -909,6 +920,14 @@ define([ | |||
this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_SCRIPTS"}, callback); | |||
}; | |||
|
|||
BrambleProxy.prototype.startAutoComplete = function(callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to enable
vs. start
src/bramble/client/main.js
Outdated
this._executeRemoteCommand({commandCategory: "bramble", command: "START_AUTO_COMPLETE"}, callback); | ||
}; | ||
|
||
BrambleProxy.prototype.stopAutoComplete = function(callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to disable
vs. start
src/bramble/client/main.js
Outdated
@@ -204,6 +204,7 @@ define([ | |||
self.getSidebarVisible = function() { return _state.sidebarVisible; }; | |||
self.getRootDir = function() { return _root; }; | |||
self.getWordWrap = function() { return _state.wordWrap; }; | |||
self.getAutoComplete = function() { return _state.allowAutoComplete; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you're changing the public API, please update the README as well, see https://github.com/mozilla/brackets#bramble-instance-getters
@@ -157,6 +157,40 @@ define(function (require, exports, module) { | |||
}); | |||
}); | |||
|
|||
// Listen for changes to TagHints | |||
PreferencesManager.on("change", "codehint.TagHints", function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the idea of sending 4 separate events for state changes on a variable that we're tracking in the StateManager as a single boolean. Can you harmonize these so they all send the same type: "bramble:autocompleteChange"
with a single boolean? It will mean we fire this change event 4 times, but that shouldn't break anything, since Thimble will just set it true
or false
in all cases.
src/bramble/client/StateManager.js
Outdated
@@ -139,6 +139,10 @@ define(function() { | |||
get: function() { return getBool(storage, "allowJavaScript"); }, | |||
set: function(v) { storage.setItem(prefix("allowJavaScript"), v); } | |||
}, | |||
allowAutoComplete: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a general concern. In some places you use Autocomplete
and in others AutoComplete
. Once upon a time I implemented a bunch of code in Firefox related to the FullScreen API which later became the Fullscreen API, and it left me very nervous about the bugs that can creep in with such inconsistencies. When I Google this, most people seem to use "Autocomplete." Should we do that everywhere? I actually don't care as long as we're consistent in all places, here and in Thimble.
src/bramble/client/main.js
Outdated
@@ -309,6 +311,14 @@ define([ | |||
_state.allowJavaScript = data.allowJavaScript; | |||
} else if (eventName === "tutorialVisibilityChange") { | |||
_tutorialVisible = data.visible; | |||
} else if (eventName === "TagHintsChange") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a leaky abstraction, and I'd like to harmonize these event types into a single autoCompleteChange
event. See my comment below.
Thanks for the review @humphd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small wording changes, and this is ready to go! Great work.
src/bramble/client/main.js
Outdated
@@ -909,6 +914,14 @@ define([ | |||
this._executeRemoteCommand({commandCategory: "bramble", command: "BRAMBLE_DISABLE_SCRIPTS"}, callback); | |||
}; | |||
|
|||
BrambleProxy.prototype.enableAutocomplete = function(callback) { | |||
this._executeRemoteCommand({commandCategory: "bramble", command: "START_AUTO_COMPLETE"}, callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the command name to BRAMBLE_ENABLE_AUTOCOMPLETE
src/bramble/client/main.js
Outdated
}; | ||
|
||
BrambleProxy.prototype.disableAutocomplete = function(callback) { | ||
this._executeRemoteCommand({commandCategory: "bramble", command: "STOP_AUTO_COMPLETE"}, callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the command name to BRAMBLE_DISABLE_AUTOCOMPLETE
Sorry I missed that. |
Excellent work, @hkirat, thank you! A note for Thimble devs about this change. This PR, along with similar ones in process right now, makes changes to the code used to create git checkout master
git pull upstream master
git submodule update --init
npm install
npm run build Updating your submodules and npm modules is not strictly necessary in this case, but it also won't hurt (i.e., it's always safe to do these two things). The final line If you do all this and Thimble still can find the function in needs on the |
* Included new state in StateManager.js * Added events to implement AutoComplete toggle * Added start and stop functions in bramble * Added allowAutoCorrect to main.js * Fixes typos * Added toggle functionality to JS and CSS hints * Changed all variable names to Autocomplete * Emitted a single event(autocompleteChange) when Hints Change * Added note in README related to new getAutocomplete function * Modified Remote Command Strings
* Included new state in StateManager.js * Added events to implement AutoComplete toggle * Added start and stop functions in bramble * Added allowAutoCorrect to main.js * Fixes typos * Added toggle functionality to JS and CSS hints * Changed all variable names to Autocomplete * Emitted a single event(autocompleteChange) when Hints Change * Added note in README related to new getAutocomplete function * Modified Remote Command Strings
* Included new state in StateManager.js * Added events to implement AutoComplete toggle * Added start and stop functions in bramble * Added allowAutoCorrect to main.js * Fixes typos * Added toggle functionality to JS and CSS hints * Changed all variable names to Autocomplete * Emitted a single event(autocompleteChange) when Hints Change * Added note in README related to new getAutocomplete function * Modified Remote Command Strings
In reference to #1920.
The P.R. adds logic to handle toggling of auto complete