thehogfather / brackets-code-folding

Code folding extension for brackets IDE
134 stars 42 forks source link

Code folding fails to collapse code in haml and rb files correctly #40

Closed ghost closed 10 years ago

ghost commented 10 years ago

Like stated in title. Updated to last version (which now allows to collapse code in ruby and haml files) and collapsing is not working correctly. Arrows appear in incorrect lines - it looks like these appear line before comment and line before code block in function

That's sample file (controller, pages_controller.rb) generated by rails g scaffold page

(I've added line numbers, to clarify where arrows are shown)

1 class PagesController < ApplicationController
2 before_action :set_page, only: [:show, :edit, :update, :destroy]
3 
4 # GET /pages
5   def index
6     @pages = Page.all
7   end
8
9   # GET /pages/:id
10   def show
11  end
12
13  # GET /pages/new
14  def new
15    @page = Page.new
16  end
17
18  # POST /pages
19  # POST /pages.json
20  def create
21    @page = Page.new(page_params)
22
23    respond_to do |format|
24      if @page.save
25        format.html { redirect_to page_path(@page.id), notice: 'Page was successfully created.' }
26        format.json { render action: 'show', status: :created, location: @page }
27      else
28        format.html { render action: 'new' }
29        format.json { render json: @page.errors, status: :unprocessable_entity }
30      end
31    end
32  end

Arrows appear only in lines 3 (blank line, before comment) 8 (blank line, before comment) 12 (blank line, before comment) 17 (blank line, before comment) 22 (blank line, before code block) 23 (code block, correctly) 24 (code block, correctly) 27 (code block, correctly)

Also, should appear in these lines 5, 14, 20 - functions

Also in .haml files when trying to collapse code, it collapse only part of a block, for example if structure looks like

%html
  %head
    %script 
  %body
    .first
    .second

    .third

When using arrow next to %body tag, it collapses all code until the empty line before .third tag

thehogfather commented 10 years ago

Thanks for raising the issue. I have tried with a range of indent based files and it seems to work. If you get some time do test it out and raise any issues you encounter.

ghost commented 10 years ago

Used for last 2 days. Seems to be working alright now, thanks for quick update :+1: