Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 4be2a8a

Browse files
committed
- Tweak Quick Edit error/feedback strings
- Fix comments to reflect Quick Edit error related API changes - Fix outdated FileSyncManager docs
1 parent 8c6d382 commit 4be2a8a

5 files changed

Lines changed: 22 additions & 19 deletions

File tree

src/editor/CSSInlineEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ define(function (require, exports, module) {
162162
* @param {!{line:Number, ch:Number}} pos
163163
* @return {?$.Promise} synchronously resolved with an InlineWidget, or
164164
* {string} if pos is in tag but not in tag name, class attr, or id attr, or
165-
* null if we're not going to provide anything.
165+
* null if we're not even close to a context where we could provide anything.
166166
*/
167167
function htmlToCSSProvider(hostEditor, pos) {
168168

src/editor/EditorManager.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ define(function (require, exports, module) {
164164
* @param {!Editor} editor The host editor
165165
* @param {Array.<{priority:number, provider:function(...)}>} providers
166166
* prioritized list of providers
167-
* @param {string=} defaultErrorMsg Default error message to display if no initial provider found
167+
* @param {string=} defaultErrorMsg Default message to display if no providers return non-null
168168
* @return {$.Promise} a promise that will be resolved when an InlineWidget
169169
* is created or rejected if no inline providers have offered one.
170170
*/
@@ -279,10 +279,10 @@ define(function (require, exports, module) {
279279
* An optional priority parameter is used to give providers with higher priority an opportunity
280280
* to provide an inline editor before providers with lower priority.
281281
*
282-
* @param {function(!Editor, !{line:number, ch:number}):?$.Promise} provider
282+
* @param {function(!Editor, !{line:number, ch:number}):?($.Promise|string)} provider
283283
* @param {number=} priority
284-
* The provider returns a promise that will be resolved with an InlineWidget, or returns null
285-
* to indicate the provider doesn't want to respond to this case.
284+
* The provider returns a promise that will be resolved with an InlineWidget, or returns a string
285+
* indicating why the provider cannot respond to this case (or returns null to indicate no reason).
286286
*/
287287
function registerInlineEditProvider(provider, priority) {
288288
if (priority === undefined) {
@@ -297,10 +297,10 @@ define(function (require, exports, module) {
297297
* An optional priority parameter is used to give providers with higher priority an opportunity
298298
* to provide an inline editor before providers with lower priority.
299299
*
300-
* @param {function(!Editor, !{line:number, ch:number}):?$.Promise} provider
300+
* @param {function(!Editor, !{line:number, ch:number}):?($.Promise|string)} provider
301301
* @param {number=} priority
302-
* The provider returns a promise that will be resolved with an InlineWidget, or returns null
303-
* to indicate the provider doesn't want to respond to this case.
302+
* The provider returns a promise that will be resolved with an InlineWidget, or returns a string
303+
* indicating why the provider cannot respond to this case (or returns null to indicate no reason).
304304
*/
305305
function registerInlineDocsProvider(provider, priority) {
306306
if (priority === undefined) {
@@ -946,7 +946,7 @@ define(function (require, exports, module) {
946946
*
947947
* @param {Array.<{priority:number, provider:function(...)}>} providers
948948
* prioritized list of providers
949-
* @param {string=} errorMsg Error message to display if no initial provider found
949+
* @param {string=} errorMsg Default message to display if no providers return non-null
950950
* @return {!Promise} A promise resolved with true if an inline widget is opened or false
951951
* when closed. Rejected if there is neither an existing widget to close nor a provider
952952
* willing to create a widget (or if no editor is open).

src/extensions/default/JavaScriptQuickEdit/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ define(function (require, exports, module) {
4242
*
4343
* @param hostEditor {!Editor} editor
4444
* @param {!{line:Number, ch:Number}} pos
45-
* @return {functionName: {string}, reason: {string}}
45+
* @return {functionName: string, reason: string}
4646
*/
4747
function _getFunctionName(hostEditor, pos) {
4848
var token = hostEditor._codeMirror.getTokenAt(pos, true);
@@ -109,7 +109,7 @@ define(function (require, exports, module) {
109109
* @param {!string} functionName
110110
* @return {?$.Promise} synchronously resolved with an InlineWidget, or
111111
* {string} if js other than function is detected at pos, or
112-
* null if we're not going to provide anything.
112+
* null if we're not ready to provide anything.
113113
*/
114114
function _createInlineEditor(hostEditor, functionName) {
115115
// Use Tern jump-to-definition helper, if it's available, to find InlineEditor target.

src/nls/root/strings.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@ define({
180180
"FILE_FILTER_CLIPPED_SUFFIX" : "and {0} more",
181181

182182
// Quick Edit
183-
"ERROR_QUICK_EDIT_PROVIDER_NOT_FOUND" : "No Quick Edit provider found for current cursor position",
184-
"ERROR_CSSQUICKEDIT_CLASSNOTFOUND" : "CSS Quick Edit: place cursor in class name",
185-
"ERROR_CSSQUICKEDIT_IDNOTFOUND" : "CSS Quick Edit: place cursor in id name",
186-
"ERROR_CSSQUICKEDIT_UNSUPPORTEDATTR" : "CSS Quick Edit: place cursor in tag name, class name, or id name",
183+
"ERROR_QUICK_EDIT_PROVIDER_NOT_FOUND" : "No Quick Edit available for current cursor position",
184+
"ERROR_CSSQUICKEDIT_CLASSNOTFOUND" : "CSS Quick Edit: incomplete class attribute",
185+
"ERROR_CSSQUICKEDIT_IDNOTFOUND" : "CSS Quick Edit: incomplete id attribute",
186+
"ERROR_CSSQUICKEDIT_UNSUPPORTEDATTR" : "CSS Quick Edit: place cursor in tag name, class attribute, or id attribute",
187187
"ERROR_TIMINGQUICKEDIT_INVALIDSYNTAX" : "CSS Timing Function Quick Edit: invalid syntax",
188188
"ERROR_JSQUICKEDIT_FUNCTIONNOTFOUND" : "JS Quick Edit: place cursor in function name",
189189

190190
// Quick Docs
191-
"ERROR_QUICK_DOCS_PROVIDER_NOT_FOUND" : "No Quick Docs provider found for current cursor position",
191+
"ERROR_QUICK_DOCS_PROVIDER_NOT_FOUND" : "No Quick Docs available for current cursor position",
192192

193193
/**
194194
* ProjectManager

src/project/FileSyncManager.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929
* FileSyncManager is a set of utilities to help track external modifications to the files and folders
3030
* in the currently open project.
3131
*
32-
* Currently, we look for external changes purely by checking file timestamps against the last-sync
33-
* timestamp recorded on Document. Later, we will use actual native directory-watching callbacks
34-
* instead.
32+
* Currently, we detect external changes purely by checking file timestamps against the last-sync
33+
* timestamp recorded on Document. Brackets triggers this check whenever an external change was detected
34+
* by our native file watchers, and on window focus. We recheck all open Documents, but with file caching
35+
* the timestamp check is a fast no-op for everything other than files where a watcher change was just
36+
* notified. If watchers/caching are disabled, we'll essentially check only on window focus, and we'll hit
37+
* the disk to check every open Document's timestamp every time.
3538
*
3639
* FUTURE: Whenever we have a 'project file tree model,' we should manipulate that instead of notifying
3740
* DocumentManager directly. DocumentManager, the tree UI, etc. then all listen to that model for changes.

0 commit comments

Comments
 (0)