File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
src/languageservice/services Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -684,19 +684,19 @@ export class YAMLCompletion extends JSONCompletion {
684684 }
685685 if ( propertySchema . enum ) {
686686 if ( ! value && propertySchema . enum . length === 1 ) {
687- value = this . getInsertTextForGuessedValue ( propertySchema . enum [ 0 ] , '' ) ;
687+ value = ' ' + this . getInsertTextForGuessedValue ( propertySchema . enum [ 0 ] , '' ) ;
688688 }
689689 nValueProposals += propertySchema . enum . length ;
690690 }
691691 if ( isDefined ( propertySchema . default ) ) {
692692 if ( ! value ) {
693- value = this . getInsertTextForGuessedValue ( propertySchema . default , '' ) ;
693+ value = ' ' + this . getInsertTextForGuessedValue ( propertySchema . default , '' ) ;
694694 }
695695 nValueProposals ++ ;
696696 }
697697 if ( Array . isArray ( propertySchema . examples ) && propertySchema . examples . length ) {
698698 if ( ! value ) {
699- value = this . getInsertTextForGuessedValue ( propertySchema . examples [ 0 ] , '' ) ;
699+ value = ' ' + this . getInsertTextForGuessedValue ( propertySchema . examples [ 0 ] , '' ) ;
700700 }
701701 nValueProposals += propertySchema . examples . length ;
702702 }
@@ -740,7 +740,7 @@ export class YAMLCompletion extends JSONCompletion {
740740 }
741741 }
742742 if ( ! value || nValueProposals > 1 ) {
743- value = '$1' ;
743+ value = ' $1' ;
744744 }
745745 return resultText + value + separatorAfter ;
746746 }
Original file line number Diff line number Diff line change @@ -49,6 +49,14 @@ suite('Auto Completion Tests', () => {
4949 } ) . then ( done , done ) ;
5050 } ) ;
5151
52+ it ( 'Autocomplete on default value (without :)' , done => {
53+ const content = 'directory' ;
54+ const completion = parseSetup ( content , 10 ) ;
55+ completion . then ( function ( result ) {
56+ assert . equal ( result . items [ 2 ] . insertText , 'directory: ${1:bower_components}' ) ;
57+ } ) . then ( done , done ) ;
58+ } ) ;
59+
5260 it ( 'Autocomplete on default value (without value content)' , done => {
5361 const content = 'directory: ' ;
5462 const completion = parseSetup ( content , 12 ) ;
You can’t perform that action at this time.
0 commit comments