No html comments in eRuby templates. How to enable?

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
green1000
Posts: 7
Joined: Tue Apr 02, 2013 6:16 pm

No html comments in eRuby templates. How to enable?

Post by green1000 »

There is no html comments in eruby. As a block comment it puts # instead of <!-- -->
How to have html comments along with ruby's comments on keyboard shortcuts?
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: No html comments in eRuby templates. How to enable?

Post by Aivars »

I just tried it (New eRuby, typed some html, selected, block comment and got <!-- -->). I might be doing something wrong, so please give some step by step instructions on reproducing the problem.
Blumentals Software Programmer
green1000
Posts: 7
Joined: Tue Apr 02, 2013 6:16 pm

Re: No html comments in eRuby templates. How to enable?

Post by green1000 »

Aivars wrote:I just tried it (New eRuby, typed some html, selected, block comment and got <!-- -->). I might be doing something wrong, so please give some step by step instructions on reproducing the problem.
Yes, works well. I had to correctly set keyboard shortcuts.

But there is another problem. I wrote about it already in the feedback form. It's not a big problem but a little inconvenient, force you to make needless mouse movements and clicks.

The editor puts line comment (// in js, # in ruby) exactly in the place where the cursor is but not at the start of the line, e.g:
alert("hello w//orld") <-- if cursor was between "w" and "o" and I pressed shortcuts for comment

Other editors place comment sign at the beginning of the line always even if cursor is in the middle of the line:
// alert("hello world") <-- let's say cursor was between "w" and "o"

Or is it configurable?
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: No html comments in eRuby templates. How to enable?

Post by Aivars »

I don't think it's configurable, but a plugin can be written to do this. If you want me to, I can try to write the plugin for you, just let me know exactly how it should behave.
Blumentals Software Programmer
green1000
Posts: 7
Joined: Tue Apr 02, 2013 6:16 pm

Re: No html comments in eRuby templates. How to enable?

Post by green1000 »

Aivars wrote:I don't think it's configurable, but a plugin can be written to do this. If you want me to, I can try to write the plugin for you, just let me know exactly how it should behave.
Oh, what a service. For now I do not need. Nevertheless, thank you.

But I was right, there is a situation that there is no html comments in eRuby templates. I figured out when it happens. Please see the example:

Code: Select all

<%  if(@somevar) %>
   <p><%= @somevar %></p>   // no html comments here, only #
<% end %>
If I need to comment a true html section that is <% %> between <% %>, than only ruby comments # are available for it. No html <!-- -->. Neither keyboard shortcuts nor block comment button from toolbar put <!-- -->. Only #. It is a little unexpected when happens.
green1000
Posts: 7
Joined: Tue Apr 02, 2013 6:16 pm

Re: No html comments in eRuby templates. How to enable?

Post by green1000 »

No there are html comments!

The direction you select the line matters:

Code: Select all

<%  if(@somevar) %>
   <p><%= @somevar %></p>    // select a line from the end to the beginning <--- |, ruby comment
   <p><%= @somevar %></p>    // select a line from the beginning to the end | --->, HTML comment
<% end %>
Wow :) Is this a design decision or an accidental behavior? It is convenient.
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: No html comments in eRuby templates. How to enable?

Post by Aivars »

I think it depends on cursor position and whether cursor is at the ruby code block or in html code block. I'm not sure why it adds ruby comments when the cursor is in the beginning of the line, to me it doesn't make much sense but there was probably a reason for this behavior. If it gets annoying, let me know and I'll add it to bug/request tracker.
Blumentals Software Programmer
Post Reply