fvclaus / vsc-sort-json-array

Visual Studio Code extension that sorts arrays
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

feature: Preserve formatting #9

Open fvclaus opened 4 years ago

fvclaus commented 4 years ago

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