File tree Expand file tree Collapse file tree
src/languageservice/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -840,14 +840,16 @@ export class YamlCompletion {
840840
841841 if ( schema . schema . propertyNames && schema . schema . additionalProperties && schema . schema . type === 'object' ) {
842842 const propertyNameSchema = asSchema ( schema . schema . propertyNames ) ;
843- const label = propertyNameSchema . title || 'property' ;
844- collector . add ( {
845- kind : CompletionItemKind . Property ,
846- label,
847- insertText : '$' + `{1:${ label } }: ` ,
848- insertTextFormat : InsertTextFormat . Snippet ,
849- documentation : this . fromMarkup ( propertyNameSchema . markdownDescription ) || propertyNameSchema . description || '' ,
850- } ) ;
843+ if ( ! propertyNameSchema . deprecationMessage && ! propertyNameSchema . doNotSuggest ) {
844+ const label = propertyNameSchema . title || 'property' ;
845+ collector . add ( {
846+ kind : CompletionItemKind . Property ,
847+ label,
848+ insertText : '$' + `{1:${ label } }: ` ,
849+ insertTextFormat : InsertTextFormat . Snippet ,
850+ documentation : this . fromMarkup ( propertyNameSchema . markdownDescription ) || propertyNameSchema . description || '' ,
851+ } ) ;
852+ }
851853 }
852854 }
853855
Original file line number Diff line number Diff line change @@ -1480,6 +1480,22 @@ test1:
14801480 expect ( completion . items [ 0 ] . insertText ) . to . be . equal ( '${1:property}: ' ) ;
14811481 expect ( completion . items [ 0 ] . documentation ) . to . be . equal ( 'Property Description' ) ;
14821482 } ) ;
1483+ it ( 'should not suggest propertyNames with doNotSuggest' , async ( ) => {
1484+ const schema : JSONSchema = {
1485+ type : 'object' ,
1486+ additionalProperties : true ,
1487+ propertyNames : {
1488+ title : 'property' ,
1489+ doNotSuggest : true ,
1490+ } ,
1491+ } ;
1492+ schemaProvider . addSchema ( SCHEMA_ID , schema ) ;
1493+ const content = '' ;
1494+ const completion = await parseSetup ( content , 0 , content . length ) ;
1495+
1496+ expect ( completion . items . length ) . equal ( 0 ) ;
1497+ } ) ;
1498+
14831499 it ( 'should suggest enum based on type' , async ( ) => {
14841500 const schema : JSONSchema = {
14851501 type : 'object' ,
You can’t perform that action at this time.
0 commit comments