Shortcut to run a whole block section?


#1

Say I have any code on VS Code:

function es(n::Int) 
    isprime = trues(n) 
    isprime[1] = false 
    for i in 2:isqrt(n) 
        if isprime[i] 
        for j in i^2:i:n 
                    isprime[j] = false
                end
            end
        end
        return filter(x -> isprime[x], 1:n) 
    end

If I place the cursor on the first line and I press ctrl+Enter only the first line is executed. Other programs such as Rstudio+R would execute the whole block detecting automatically its closing end or brackets.

I know we can manually select the lines we want and execute them, but it’s a much slower procedure and strangelly breaks all indentation to the right.

What combination of keys let me execute the whole block from my position?
Or do we need to modify something on the settings?


#2

Alt+Enter. And we are probably going to change it so that Ctrl+Enter does what you want it to do.


#3

OK, it works, though every line adds is incrementally tabbed to the right.


#4

Yes, that is also known, and hopefully we’ll fix it soon :slight_smile: