import * as vscode from 'vscode' ; import { DevToolsExtensionContext } from "../../devToolsExtensionContext" ; import { AZDocumentSymbolsLibrary } from "../../symbollibraries/azDocumentSymbolsLibrary" ; import { AZSymbolInformation } from "../../symbollibraries/azSymbolInformation" ; import { AZSymbolKind } from "../../symbollibraries/azSymbolKind" ; import { ALCodeAction } from '../alCodeAction' ; export class ALSortVariablesCommand extends ALCodeAction { constructor ( context ) { super ( context , "SortVariables" ) ; } collectCodeActions ( docSymbols , symbol , document , range , diagnostics , actions ) { if ( ! this . canRunOnSave ( document ) ) { let edit = undefined ; if ( ( symbol ) && ( ( symbol . isALObject ( ) ) || ( symbol . kind == AZSymbolKind . VarSection ) || ( symbol . kind == AZSymbolKind . GlobalVarSection ) ) && ( ! symbol . containsDiagnostics ) && ( symbol . selectionRange ) && ( symbol . selectionRange . start . line == range . start . line ) ) { let action = new vscode . CodeAction ( "Sort variables (AZ AL Dev Tools)" , vscode . CodeActionKind . QuickFix ) ; action . command = { command : "azALDevTools.sortVariables" , title : "Sort Variables" , arguments : [ document , symbol . range ] } ; actions . push ( action ) ; } } } }