@@ -17,7 +17,7 @@ import { nodeHolder } from "../utils/yamlServiceUtils";
1717import { CompletionItem , CompletionItemKind , CompletionList , TextDocument , Position , Range , TextEdit , InsertTextFormat } from 'vscode-languageserver-types' ;
1818
1919import * as nls from 'vscode-nls' ;
20- import { YAMLDocument } from '../parser/yamlParser' ;
20+ import { YAMLDocument , SingleYAMLDocument } from '../parser/yamlParser' ;
2121
2222const localize = nls . loadMessageBundle ( ) ;
2323
@@ -63,7 +63,7 @@ export class YAMLCompletion {
6363 return Promise . resolve ( result ) ;
6464 }
6565
66- const jsonDocument = yamlDocument . documents . length > 0 ? yamlDocument . documents [ 0 ] : null ;
66+ const jsonDocument : SingleYAMLDocument = yamlDocument . documents . length > 0 ? yamlDocument . documents [ 0 ] : null ;
6767 if ( jsonDocument === null ) {
6868 return Promise . resolve ( result ) ;
6969 }
@@ -229,7 +229,7 @@ export class YAMLCompletion {
229229 return ! ! stringArray . some ( arrayEntry => arrayEntry === key ) ;
230230 }
231231
232- private getPropertyCompletions ( schema : SchemaService . ResolvedSchema , doc , node : Parser . ASTNode , addValue : boolean , collector : CompletionsCollector , separatorAfter : string ) : void {
232+ private getPropertyCompletions ( schema : SchemaService . ResolvedSchema , doc : SingleYAMLDocument , node : Parser . ASTNode , addValue : boolean , collector : CompletionsCollector , separatorAfter : string ) : void {
233233 const nodeProperties : Parser . PropertyASTNode [ ] = ( < Parser . ObjectASTNode > node ) . properties ;
234234 const hasMatchingProperty = ( key : string , propSchema : JSONSchema ) : boolean => {
235235 return nodeProperties . some ( ( propertyNode : Parser . PropertyASTNode ) : boolean => {
@@ -265,7 +265,7 @@ export class YAMLCompletion {
265265 if ( schemaProperties ) {
266266 Object . keys ( schemaProperties ) . forEach ( ( key : string ) => {
267267 //check for more than one property because the placeholder will always be in the list
268- if ( s . node . properties . length > 1 || this . arrayIsEmptyOrContainsKey ( s . schema . firstProperty , key ) ) {
268+ if ( s . node [ ' properties' ] . length > 1 || this . arrayIsEmptyOrContainsKey ( s . schema . firstProperty , key ) ) {
269269 const propertySchema = schemaProperties [ key ] ;
270270 if ( ! propertySchema . deprecationMessage &&
271271 ! propertySchema [ "doNotSuggest" ] &&
@@ -285,7 +285,7 @@ export class YAMLCompletion {
285285 } ) ;
286286 }
287287
288- private getValueCompletions ( schema : SchemaService . ResolvedSchema , doc , node : Parser . ASTNode , offset : number , document : TextDocument , collector : CompletionsCollector , types : { [ type : string ] : boolean } ) : void {
288+ private getValueCompletions ( schema : SchemaService . ResolvedSchema , doc : SingleYAMLDocument , node : Parser . ASTNode , offset : number , document : TextDocument , collector : CompletionsCollector , types : { [ type : string ] : boolean } ) : void {
289289
290290
291291 let offsetForSeparator = offset ;
0 commit comments