More intelligent indentation when pasting code
When pasting code, the indentation of the pasted code can be adjusted to the cursor position.
For instance, code in clipboard:
if(true) {
System.out.println(“Hello”);
}Pasting in the following location ( I represents cursor):
for(int i = 0; i < 100; i++) {
I
}Should result in:
Submitted by Zef Hemel on 26 February 2010 at 14:19
for(int i = 0; i < 100; i++) {
if(true) {
System.out.println(“Hello”);
}
}
Issue Log
(see also Spoofax/30)
+1
Shouldn’t be very hard using IAutoEditStrategy.
Fixed in 20653. However, it’s only active if the cursor is on a blank line right now, to avoid repeated code pasting resulting in:
module foostrategies
strategies
strategies
It would do this since it doesn’t know that certain language constructs like the “strategies” keyword shouldn’t be indented, while others, like “a = b”, should be.
Maybe it can be improved a bit by using the pretty printer definition, but rarely have I seen a metaprogrammer disciplined enough to write a proper, pretty pretty printer.
Update:
11:30:29 want ik heb geen completions in mijn project, lijkt het, Chip_Zero
11:38:25 Chip_Zero: interessant, met het nieuwe past behavior lukt het me eigenlijk niet om nog goed te pasten in stratego, hij indent altijd fout, wat ik ook probeer :D
[…]
11:57:47 <Chip_Zero> wat wel had moeten werken is copyen met leading indentation op de eerste regel
11:57:53 <Chip_Zero> maar da’s ook wat vervelend
11:59:40 <Chip_Zero> verder kan ik eigenlijk ook niet goed zien wat de intended indentation is van “foo\n bar\n”. misschien moet die feature er maar weer uit
12:00:14 hmm, ja
12:00:21 zo is het iig irritant (voor mij)
12:00:30 <Chip_Zero> op dit moment werkt het iig helemaal neit :)Disabled this feature for now. Not sure if it can be salvaged to work predictably.
Log in to post comments