'use strict' ; import { CompletionItem , CompletionItemKind } from 'vscode' ; import { PddlWorkspace } from 'pddl-workspace' ; import { FileInfo } from 'pddl-workspace' ; import { Delegate } from './Delegate' ; export class TypeDelegate extends Delegate { constructor ( public workspace ) { super ( ) ; } getTypeItems ( fileInfo ) { return this . getTypes ( fileInfo ) . map ( t => this . createType ( t ) ) ; } getTypes ( fileInfo ) { const domainInfo = this . workspace . asDomain ( fileInfo ) ; return domainInfo ? domainInfo . getTypes ( ) : [ ] ; } createType ( typeName ) { const completionItem = this . createCompletionItem ( typeName , 'Type' , '' , CompletionItemKind . Class ) ; completionItem . insertText = ' ' + typeName ; completionItem . filterText = '- ' + typeName ; return completionItem ; } }