#226 ✓resolved
Daniel Lucraft

Autoindenter is too eager/gets it wrong

Reported by Daniel Lucraft | May 26th, 2010 @ 10:32 AM

Please attach examples of when this happens to this bug. Thanks

Comments and changes to this ticket

  • agmcleod

    agmcleod May 27th, 2010 @ 07:06 PM

    Take a block of code in ruby, whether it be a method, loop, if statement, etc. Put your caret at the end of the "end" call, and start typing. The end will shift forward aligning with the next tab location.

    def my_method
      puts "test"
    end
    

    Then when you put the caret after end, and say hit your "a" key,

    Becomes:

    def my_method
      puts "test"
      enda
    
  • Daniel Lucraft

    Daniel Lucraft May 28th, 2010 @ 09:44 AM

    That IS the correct indentation. enda is presumably a method call at that point.

    So just to confirm, you think it shouldn't correct the indentation in this case, even though it is correct?

  • Roger

    Roger May 28th, 2010 @ 05:51 PM

    trying to type in a try finally block is hard...

    desired would be:

    try {
    int a = 3; } finally { a = 4; }

    (which it doesn't seem to allow)

    or

    try {
    int a = 3; } finally {
    a = 4; }

    which does seem to work right.

  • Roger

    Roger June 24th, 2010 @ 06:09 PM

    • Tag set to python

    with python code, it won't let you move to a new indentation level:

    if True:

    do more stuff
    

    go

    gets translated into:

    if True:

    do more stuff
    go
    

    no matter what.

  • Roger

    Roger July 6th, 2010 @ 06:50 PM

    • Milestone order changed from “0” to “0”

    editing yaml is a bit difficult, as well. Example, creating:

    mutes:
    settings: 2.0 : 3.0 4.0 : 5.0

  • Mat Schaffer

    Mat Schaffer September 12th, 2010 @ 05:29 PM

    • Tag cleared.

    The indenter keeps moving me to the left margin when doing JavaScript in HTML. For example, type this (<c> is cursor location):

          <script type="text/javascript" charset="utf-8">
            function myfunction () {<c>}
          </script>
    

    then hit enter and you get

          <script type="text/javascript" charset="utf-8">
            function myfunction () {
    <c>}
          </script>
    

    Dan 110519: this appears to work now.

  • delisa

    delisa September 14th, 2010 @ 02:33 PM

    • Tag set to indenter

    In C-like languages, like Java, the indenter moves lines that are in the correct position to one level too many if something is appended to the closing brace line.

    Example

    This works:

        if(condition) {
          //stuff goes here...
        }
    

    but if i add a new clause:

        if(condition) {
    
    
    [Dan: this is fixed in https://github.com/redcar/redcar/commit/d2abc28c13967fa7fd248aef78399905d6b68c91 Still working on improving indentation.)
           } else {
    
           }
    

    Ideally the cursor position should also be on a new line and indented when creating braces.
    Example

        if(condition) {<c>}
    

    Should become this when i press enter:

        if(condition) {
            <c>
        }
    
  • ntzanos

    ntzanos November 21st, 2010 @ 11:39 AM

    • Assigned user set to “Daniel Lucraft”

    An example from redcar with python. I posted this on its own about a month ago but nobody has seen the ticket.

  • Konstantin Haase
  • Daniel Lucraft

    Daniel Lucraft January 21st, 2011 @ 09:12 AM

    (Copied from Michal's bug)

    Sometimes the indentation just won't let me remove indentation, for example, I want to comment this out:

    =begin def method
    
    #dostuff
    end =end
    

    but I cannot remove those indented spaces like so:

    =begin def method
    
    #dostuff
    end =end
    

    There is very painful workaround as it really braks one's flow:

    # =begin def method
    
    #dostuff
    end # =end
    
  • Michal Hantl

    Michal Hantl January 21st, 2011 @ 09:20 AM

    Correction:
    I got the whitespace wrong in the bug, this is a simple example:

    I want to comment out method b

    class A
      def this_method_can_be_commented_out
       #putting =beign before it works, because indentation of the line before is 0
      end
    
      def this_method_cannot_be_commented_out
       #putting =beign before will result in indentation, because indentation of the line before is 1
      end
    end
    

    If you try doing =begin =end around the second method:

    class A
      def this_method_can_be_commented_out
       #putting =beign before it works, because indentation of the line before is 0
      end
    
      =begin <- you will not be able to remove the space before =begin
      def this_method_cannot_be_commented_out
      end
    end
    

    workaround:

    class A
      def this_method_can_be_commented_out
       #putting =beign before it works, because indentation of the line before is 0
      end
    
    #this line has to be inserted here to provide 0 indentation
    =begin
      def this_method_cannot_be_commented_out
      end
    =end
    end
    

    There is no problem with =end though.

  • Daniel Lucraft

    Daniel Lucraft May 19th, 2011 @ 09:54 PM

    • State changed from “open” to “resolved”

    Everything reported in this thread appears to be fixed by these two commits:

    https://github.com/redcar/redcar/commit/d2abc28c13967fa7fd248aef783...
    https://github.com/redcar/redcar/commit/25fc2af430f825db9768b9079d9...

    Let me know if this doesn't work for you.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A programmer's text editor for Gnome.

People watching this ticket

Attachments

Tags

Referenced by

Pages