Skip to content

Commit

Permalink
fix json format
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicshuai committed Jan 3, 2020
1 parent 647aae0 commit 9916955
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"this" : [{"value": ""}, {"turnCount": ""}],
"turn" : [{
"dialogEvent": "value"
}],
"dialog" : [
{"item": ""},
{"listType": ""}
],
"#intent": [
"this" : {"value": "", "turnCount": ""},
"turn" : {
"dialogEvent": "value",
"recognitionResult": ""
},
"dialog" :
{"item": "",
"listType": ""}
,
"intent":
{"score": ""}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,25 +265,32 @@ export class LGServer {
}
}

if (Object.keys(tempVariable).length === 0) {
if (!tempVariable || Object.keys(tempVariable).length === 0) {
return null;
}

if (tempVariable instanceof Array) {
if (tempVariable instanceof Object) {
const completionList: CompletionItem[] = [];
for (const variable of tempVariable) {
Object.keys(variable).forEach(e => {
const item = {
label: e.toString(),
kind: CompletionItemKind.Property,
insertText: e.toString(),
documentation: '',
};
completionList.push(item);
});
}
Object.keys(tempVariable).forEach(e => {
const item = {
label: e.toString(),
kind: CompletionItemKind.Property,
insertText: e.toString(),
documentation: '',
};
completionList.push(item);
});

return completionList;
} else if (typeof tempVariable === 'string') {
return [
{
label: tempVariable,
kind: CompletionItemKind.Property,
insertText: tempVariable,
documentation: '',
},
];
}

return null;
Expand Down Expand Up @@ -340,7 +347,6 @@ export class LGServer {
completionList = completionList.concat(completionRootVariableList);

const matchResult = this.matchedStates(params);

if (
matchResult &&
matchResult.matched &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,3 @@ export function loadMemoryVariavles(path: string): object {
const varibles = JSON.parse(text);
return varibles;
}

console.log(__dirname);

0 comments on commit 9916955

Please sign in to comment.