atom-jinja2 icon indicating copy to clipboard operation
atom-jinja2 copied to clipboard

I am not able to comment out selections

Open rajsinghUSA opened this issue 7 years ago • 6 comments

Does the ability to comment out selections not exist?

rajsinghUSA avatar Apr 17 '17 03:04 rajsinghUSA

@rajsinghUSA do you mean that cmd + / (or equivalent) comments out with <!-- --> instead of {# #}?

If so, go to Atom > Config then under ".html.jinja.text": add

commentEnd: " #}"
commentStart: "{# "

davidrpmorris avatar May 03 '17 01:05 davidrpmorris

@davidrpmorris I meant, that I am unable to do only comment out a selected portion of code, like if I only wanted to comment out class="myclass":

<p {#class="myclass"#}>Something here</p>

But as for your comment, I DEFINITELY would rather use {# #} instead of <!-- --> for HTML (Jinja Templates) syntax. However, I went to Atom's Edit > Config which opened config.cson, but there is no entry for ".html.jinja.text" so I added it myself on a new line at the very bottom (and all the way to the left) and placed commentStart: "{# " and commentEnd: " #}" after it:

".html.jinja.text":
    commentStart: "{# "
    commentEnd: " #}"

However, this did not change any behavior. Restarting atom doesn't resolve it either.

rajsinghUSA avatar May 04 '17 02:05 rajsinghUSA

@rajsinghUSA

Oops I left out 'editor'. This is how it should look:

".html.jinja.text":
  editor:
    commentEnd: " #}"
    commentStart: "{# "

davidrpmorris avatar May 04 '17 12:05 davidrpmorris

@davidrpmorris, thank you, that works to switch to {# #}.

Any idea about my original question about only commenting out a selected portion of code, like if I only wanted to comment out class="myclass":

<p {#class="myclass"#}>Something here</p>

Currently, I can only comment out complete lines, not just selected text.

rajsinghUSA avatar May 07 '17 03:05 rajsinghUSA

@rajsinghUSA Check out this thread: https://discuss.atom.io/t/comment-selected-text-not-entire-line/2788/9

Seems like this works for HTML:

    'atom-workspace atom-text-editor:not([mini])':
    'cmd-/': 'block-comment:toggle'

davidrpmorris avatar May 07 '17 19:05 davidrpmorris

@davidrpmorris I tried that (except with ctrl+/), but it didn't work.

rajsinghUSA avatar May 08 '17 16:05 rajsinghUSA