Skip to content

Commit

Permalink
Fix #87
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Padovani committed Aug 11, 2018
1 parent d033f2d commit c09d746
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nested-fields-support",
"version": "6.3.1-1.0.2",
"version": "6.3.1-1.0.3",
"description": "Nested Support Plugin",
"license": "Apache-2.0",
"authors": [
Expand Down
7 changes: 5 additions & 2 deletions public/nested_support/parse_query/lib/from_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export function fromUser(text, model) {
}
} catch (e) {
if (query !== undefined) {
const cursorPos = ngModel.$parent.queryBarForm.$$element[0][0].selectionEnd;
const start = text.substr(0, cursorPos).lastIndexOf(' ') + 1;
const fieldPart = text.substr(text.substr(0, cursorPos).lastIndexOf(' ') + 1)
query.suggestions = buildSuggestions(fieldPart, start, cursorPos, e.message);
query.parseError = e.message;
query.query = text;
Expand Down Expand Up @@ -110,11 +113,11 @@ function buildSuggestions(fieldPart, start, end, errMsg) {
// }

if (parser.yy.possibleFields[fieldPart]) {
suggestions.concat(parser.yy.possibleFields[fieldPart].map(field => {
suggestions = parser.yy.possibleFields[fieldPart].map(field => {
const text = field.name;
const description = getDescription(field.name);
return {type, text, description, start, end};
}));
});
}
return suggestions;
}
Expand Down

0 comments on commit c09d746

Please sign in to comment.