Add generic modes to json code edit

work on the folding detector. There is an issue with the number of available fold levels