Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…guage-server into intel
  • Loading branch information
928PJY committed Aug 30, 2018
2 parents d5f2bf7 + 90fc8c0 commit 5b015fc
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions src/languageservice/services/yamlCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,37 +538,42 @@ export class YAMLCompletion {
let value;
let nValueProposals = 0;
if (propertySchema) {
if (nValueProposals === 0) {
var type = Array.isArray(propertySchema.type) ? propertySchema.type[0] : propertySchema.type;
if (!type) {
if (propertySchema.properties) {
type = 'object';
} else if (propertySchema.items) {
type = 'array';
if (propertySchema.default !== undefined) {
value = ` \${1:${propertySchema.default}}`
}
else {
if (nValueProposals === 0) {
var type = Array.isArray(propertySchema.type) ? propertySchema.type[0] : propertySchema.type;
if (!type) {
if (propertySchema.properties) {
type = 'object';
} else if (propertySchema.items) {
type = 'array';
}
}
switch (type) {
case 'boolean':
value = ' $1';
break;
case 'string':
value = ' $1';
break;
case 'object':
value = '\n\t';
break;
case 'array':
value = '\n\t- ';
break;
case 'number':
case 'integer':
value = ' ${1:0}';
break;
case 'null':
value = ' ${1:null}';
break;
default:
return propertyText;
}
}
switch (type) {
case 'boolean':
value = ' $1';
break;
case 'string':
value = ' $1';
break;
case 'object':
value = '\n\t';
break;
case 'array':
value = '\n\t- ';
break;
case 'number':
case 'integer':
value = ' ${1:0}';
break;
case 'null':
value = ' ${1:null}';
break;
default:
return propertyText;
}
}
}
Expand Down

0 comments on commit 5b015fc

Please sign in to comment.