Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line comment style #4

Closed
vovayatsyuk opened this issue Mar 17, 2013 · 1 comment
Closed

Line comment style #4

vovayatsyuk opened this issue Mar 17, 2013 · 1 comment

Comments

@vovayatsyuk
Copy link

Aptana inserts comment symbol after indentation:

# class Comment
  # attr_reader :context
# 
  # def initialize(context, start_chars, end_chars, disable_indent)
    # @context, @start_chars, @end_chars = context, start_chars, end_chars
    # @disable_indent = (disable_indent == 'YES')
  # end

While other editors insert comment in the begining of the line:

#class Comment
#  attr_reader :context
#
#  def initialize(context, start_chars, end_chars, disable_indent)
#    @context, @start_chars, @end_chars = context, start_chars, end_chars
#    @disable_indent = (disable_indent == 'YES')
#  end

Aptana is also inserts one space just after comment symbol.

I'd like to know opinion of Aptana developers about this. Would you like to change your behaviour and make the comment action like in other editors? Or you have the reason to do it in different way?

@btsai
Copy link

btsai commented Mar 28, 2013

It looks like source.ruble/lib/comment.rb is missing some code.

Change line 218 from:
index = l.index(/\S/)

to:
index = @disable_indent ? 0 : l.index(/\S/)

Then in your language bundle (like ruby.ruble/bundle.rb or js.ruble/bundle.rb), in the block:
env 'source.ruby' do |e|

add:
e['TM_COMMENT_DISABLE_INDENT'] = 'YES'

Personally, to avoid any problems with the wrong value being passed in for TM_COMMENT_DISABLE_INDENT, I would also change line 8 of source.ruble/lib/comment.rb from:
@disable_indent = (disable_indent == 'YES')

to:
@disable_indent = (disable_indent.downcase == 'yes')

I submitted a pull request:
#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants