import { TextEditor , TextDocumentContentChangeEvent } from 'vscode' ; import { VSCodeApi } from '../Api/VSCodeApi' ; import { IDocommentDomain , CodeType } from './IDocommentDomain' ; import { StringUtil } from '../Utility/StringUtil' ; import { Configuration } from '../Entity/Config/Contributes/Configuration' ; export class DocommentDomain implements IDocommentDomain { public _event : TextDocumentContentChangeEvent ; public _vsCodeApi : VSCodeApi ; public _activeEditor : TextEditor ; public _config : Configuration ; public Execute ( activeEditor , event , languageId , config ) { this . _event = event ; this . _activeEditor = activeEditor ; this . _vsCodeApi = new VSCodeApi ( activeEditor ) ; this . _config = config ; if ( ! this . _vsCodeApi . IsLanguage ( languageId ) ) return ; this . Init ( ) ; if ( ! this . IsTriggerDocomment ( ) ) return ; if ( ! this . IsInScope ( ) ) return ; const code = this . GetCode ( ) ; const codeType = this . GetCodeType ( code ) ; console . debug ( codeType ) ; if ( codeType === null ) return ; const docomment = this . GeneDocomment ( code , codeType ) ; console . debug ( docomment ) ; if ( StringUtil . IsNullOrWhiteSpace ( docomment ) ) return ; this . WriteDocomment ( code , codeType , docomment ) ; this . MoveCursorTo ( code , codeType , docomment ) ; } public Init ( ) { } public IsTriggerDocomment ( ) { return false ; } public IsInScope ( ) { return false ; } public GetCode ( ) { return null ; } public GetCodeType ( code ) { return CodeType . None ; } public GeneDocomment ( code , codeType ) { return null ; } public WriteDocomment ( code , codeType , docommnet ) { } public MoveCursorTo ( code , codeType , docomment ) { } public dispose ( ) { } }