import * as vscode from 'vscode' ; import { DevToolsExtensionContext } from "../../devToolsExtensionContext" ; import { AZSymbolKind } from '../../symbollibraries/azSymbolKind' ; import { AZSymbolInformation } from '../../symbollibraries/azSymbolInformation' ; import { AZDocumentSymbolsLibrary } from '../../symbollibraries/azDocumentSymbolsLibrary' ; import { ALCodeAction } from '../alCodeAction' ; export class ALSortReportColumnsCommand extends ALCodeAction { constructor ( context ) { super ( context , "SortReportColumns" ) ; } collectCodeActions ( docSymbols , symbol , document , range , diagnostics , actions ) { if ( ! this . canRunOnSave ( document ) ) { let edit = undefined ; if ( ( symbol ) && ( ( symbol . kind == AZSymbolKind . ReportDataItem ) || ( symbol . kind == AZSymbolKind . ReportColumn ) || ( symbol . kind == AZSymbolKind . ReportExtensionAddColumnChange ) || ( symbol . kind == AZSymbolKind . ReportExtensionObject ) || ( symbol . kind == AZSymbolKind . ReportObject ) ) && ( symbol . selectionRange ) && ( symbol . selectionRange . start . line == range . start . line ) ) { if ( symbol . kind == AZSymbolKind . ReportColumn ) symbol = symbol . findParentByKind ( AZSymbolKind . ReportDataItem ) ; if ( ( symbol ) && ( ! symbol . containsDiagnostics ) ) { let action = new vscode . CodeAction ( "Sort data item columns (AZ AL Dev Tools)" , vscode . CodeActionKind . QuickFix ) ; action . command = { command : "azALDevTools.sortReportColumns" , title : "Sort Report Columns" , arguments : [ document , symbol . range ] } ; actions . push ( action ) ; } } } } }