Indentation in the Sonic Pi Editor

I’m having issues with indentation in the Sonic Pi editor. For some reason, after I complete the end on a function definition, the next function definition is indented instead of being at the same level as the previous define. Is there a way to turn this off in the editor? Thanks for your help.

define :ca do |*args|
output = Array.new(args.length())

for x in 0..args.length()-1 do
    output[x] = args[x]
  end
  
  return(output)

end

define :pm do |*args|
notes = args[0]

    for x in 0..(notes.length()-1)/2 do
        if (notes[2*x] != "r") then
          play notes[2*x]
        end
        
        sleep notes[2*x+1]
      end
    end

Hi @klynn47 - that’s weird, I’m not seeing the same behaviour on my system.

Could you possibly let us know which version of Sonic Pi you’re running and on which operating system?

It is version 3.3.1 on Windows 11

Hi there,

yep, I can confirm that this is an issue as you mention in v3.3.1. However, in the latest v4 BETA release, the indentation is fine :slight_smile:

So the problem should be resolved when you upgrade from v3.3.1. Apologies for the inconvenience until then.

Thanks for your response. I appreciate it

1 Like