After sorting the array is serialized using JSON.stringify. The idea here is to get the serialized version of every item and only change the order. This probably requires tokenization of the array to understand at what line/column an element starts and ends. The tokenization in vscode is done through TextMate grammar. All this infrastructure is alreay there, the only question is whether or not an extension can utilize it: https://stackoverflow.com/questions/60800414/how-to-tokenize-code-in-vscode-extension
After sorting the array is serialized using
JSON.stringify
. The idea here is to get the serialized version of every item and only change the order. This probably requires tokenization of the array to understand at what line/column an element starts and ends. The tokenization in vscode is done through TextMate grammar. All this infrastructure is alreay there, the only question is whether or not an extension can utilize it: https://stackoverflow.com/questions/60800414/how-to-tokenize-code-in-vscode-extension