import * as vscode from 'vscode' ; import { ALCodeFix } from "../alCodeFix" ; import { DevToolsExtensionContext } from '../../devToolsExtensionContext' ; import { AZDocumentSymbolsLibrary } from '../../symbollibraries/azDocumentSymbolsLibrary' ; import { AZSymbolInformation } from '../../symbollibraries/azSymbolInformation' ; export class ALCodeCopFixAA0008 extends ALCodeFix { constructor ( context ) { super ( context , "AA0008" ) ; } collectCodeActions ( docSymbols , symbol , document , range , diagnostics , actions ) { let settings = vscode . workspace . getConfiguration ( 'alOutline' , document . uri ) ; let fixOnSave = ! ! settings . get < boolean > ( 'fixCodeCopMissingParenthesesOnSave' ) ; if ( fixOnSave ) { let onSaveEdit = undefined ; for ( let i = 0 ; i < diagnostics . length ; i ++ ) { let diagCode = diagnostics [ i ] . code ; if ( ( diagCode ) && ( ( diagCode == this . diagnosticCode ) || ( diagCode . value == this . diagnosticCode ) ) ) { if ( ! onSaveEdit ) onSaveEdit = new vscode . WorkspaceEdit ( ) ; onSaveEdit . insert ( document . uri , diagnostics [ i ] . range . end , '()' ) ; } } if ( onSaveEdit ) { let actionKind = vscode . CodeActionKind . SourceFixAll . append ( 'al' ) ; let action = new vscode . CodeAction ( "Fix missing parentheses (AZ AL Dev Tools)" , actionKind ) ; action . edit = onSaveEdit ; actions . push ( action ) ; } } } }