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

Convert numbers to strings, so StringMatch can match it. #11484

Merged
merged 1 commit into from
Jul 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/extensions/default/PrefsCodeHints/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ define(function (require, exports, module) {
return null;
}

// Convert integers to strings, so StringMatch.stringMatch can match it.
if (option.type === "number" || option.valueType === "number") {
values = values.map(function (val) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sprintr use $.map(values, function (val) { here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess raw ES5 should be faster

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this. I think the one you have above should work fine.

return val.toString();
});
}

// filter through the values.
hints = $.map(values, function (value) {
var match = StringMatch.stringMatch(value, query, stringMatcherOptions);
Expand Down Expand Up @@ -332,8 +339,7 @@ define(function (require, exports, module) {
}

// Put quotes around completion.
completion = quoteChar + completion;
completion = completion + quoteChar;
completion = quoteChar + completion + quoteChar;

// Append colon and braces, brackets and quotes.
if (!ctxInfo.shouldReplace) {
Expand Down