Docco ignore blocks of comments - coffeescript

I am using docco as a tool for creating coffeescript documentation.
By default, every comment I make in coffeescript source is treated as documentation and moved to the left (explainatory) column.
The problem is, in my source there are some lines of code commented out, left as alternate options, which I want to remain in the right (code) column.
Is there a way to tell docco- "do not touch that, leave this like it is a normal code"?
"#!" or "#ignore" maybe?
Thanks in advance.

Have you tried it? It will ignore #! hashbang lines.
Ignore hashbangs and interpolations...
l.commentFilter = /(^#![/]|^\s*#\{)/
languages
languages = buildMatchers languages
From the source, line 277 https://github.com/jashkenas/docco/blob/master/docco.litcoffee
If nothing else, you should be able to edit the source to add whatever opt out you would like there.

Related

Line Notes for VSCode

Is there any way by which I can add a useful message to a line in VS Code Editor which is not written in code but is like a note (Similar to like comments on a line in a Pull Request in Git) which can be deleted later on.
Here are the two extensions that I came across, hope this helps:
1). Line Note: https://marketplace.visualstudio.com/items?itemName=tkrkt.linenote
2). Code Annotation: https://marketplace.visualstudio.com/items?itemName=tkcandrade.code-annotation
I preferred Code Annotation for it's seemingly active org admin and the team of contributors and for marking notes as DONE or PENDING feature.
The "Line note" extension https://marketplace.visualstudio.com/items?itemName=tkrkt.linenote is probably what you are looking for…
Many languages allow you to append a comment to the end of a line. In python for example, you could have the following:
import numpy as np
a = 13.6 # a is the density of material
anser = a * b # where b is the volume in meters/cubic centimeters
...
Do not know what your language is but maybe this could work.
Comments can be added to code based on what language you are using. They are not specfic to the editor for the most part.
For example, in C++ you can comment by putting double slashes before the line such as // Random Comment.
Look up the commenting syntax for whatever code language you are using.

Multi-line commenting in VB

Something that has always burned me up in programming, not just VB, is how inefficient it is to make multi-line comments. I'm not exactly a neat freak, but I do like comments to all be about the same length, around 80 characters including leading whitespace. But, to do this, I have to manually control how long the comments are. And the really frustrating part is when the change to only a few words requires an unreasonable amount of work.
I have found many questions on StackOverflow asking about multi-line commenting, but none to actually address this feature.
Wouldn't it make sense to have a commenting feature in VB, Eclipse, etc. to enter a a mini word processing mode mode that would low simple features like word wrap that would format the comment automatically? Is there one available that I'm just missing?
Or am I just being lazy? But, if it is a good idea, how can it be suggested to Microsoft, Eclipse.org, and others.
The only way to do multi-line comments in VB.NET is to do a lot of single line comments.
Really, the only option you have is the single tick (') in front of a line.
You can use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U to comment or uncomment selected lines of text. In C# you can use /* ... */ to comment an entire block of code.
Look for more information on Custom Writing

Highlighting line which are not correctly formated [Eclipse]

So I have some formatting rule to follow, such as :
Space on each side of operator (*, =, +, %, etc)
No space at the end of a line
No more than 80 chars per line
Is there a way to highlight in red line containing formating error?
The eclipse auto-formating tool is no good because either :
It will change to many line (old code not written by me)
or it won't (only my code)
Because I must follow some "colorfull" guideline :
You must change formating error relative to operators in old code but nothing else
Your code must be correctly formated.
Any ideas?
Thanks
You can select which lines of code you want to format. The Eclipse formatting tool doesn't have to run across the entire file. To do this: select the lines you want to format, then press Ctrl-Shift-F.
You could try using the Eclipse Checkstyle Plugin.
You'll need to configure it with just the rules that you need (the default configuration is very strict, so create a new one with just the rules you care about).
This will highlight all lines with formatting issues. I don't think it's possible to ignore old code using the plugin.
Talk to whoever created that coding guideline. It does not make sense in the long run, because editing code in Eclipse will always apply all current formatting rules (which violates that guideline) or none, if you disable the formatter (which leads to you writing bad code).
If there is really no way around that guideline, then you should split your workflow into 2 phases: Reformat all existing code one time to fulfill that operator guideline. You may use any tool you like, even just a regular expression search and replace might be fine.
After that has been done, configure Eclipse to auto-format only changed lines, but always apply all formattings to each changed line. There is no good reason to not re-format the other 75 characters in an existing line of code, if you already touched 5 characters of it.

How can I keep footnotes together with message text when top-posting?

I want better control of the footnote positioning within an email message. I could write the code to modify footnote-mode to do what I want, but first I want to see if somebody else has already solved this problem.
When I am top-posting with message-mode and add an entry with footnote-mode the footnotes go to the end of the buffer, but instead I want it to come before the previous message citation which starts out with something like:
Elvis Presley <the.king#graceland.com> writes:
If I have a signature automatically added based on footnote-signature-separator then the footnotes get positioned before the signature, however in email I don't use a signature. And furthermore, when I use a closing like:
-Elvis
or
Thanks,
Elvis
then I usually want to footnotes to come after that closing.
What I would like is to have the best optimal position detected automatically whether I am top-posting or in-line posting. I expect the best solution will be to use text-properties-at to detect gnus-cite-* lines and maybe to define text properties for the footnotes section. And/or maybe overlays?
Also note that suggestions like the following will not work:
(setq footnote-signature-separator "^-- $\\|#.*writes:")
Not only is that overly simplistic for the kind of positioning control I would like, but it also simply does not work correctly.

How can I compare 2 files and ignore any changes in comments?

I'm using C# and VB.NET.
I often (every days...) add comments to existing source files. When I check-in these files, I would like to have my merge tool to ignore any changes made to comments - I just want to be sure that I did not change the code.
I use WinMerge and Team Foundation Control Server (yes, no chance : Subversion was not an option when I accepted this job :o). Both of them can ignore white spaces but cannot ignore comments. Result : I have to carefully look at all the changes that I have made to each file before checking them in. And this is pretty cumbersome.
(Well, since most of my co-workers do not comment at all -- hey, they use pretty long namespace/class/methods/property/type/constant names that tell it all, guys ! -- it's a lot of work.)
Any suggestions ?
All the best,
Sylvain.
BeyondCompare has a filter for ignoring "unimportant" changes and comments belong to that category by default.
Compare++ has an option "Ignore comment changes" and "Ignore pure formatted changes" which should honor your request.
You said you used WinMerge - well it has the ability to filter out comments.
However it only works for comments that are on a separate line, so for example:
int i; // comment
will be detected as different from
int i;
It sounds like you're using commenting as a tool to understand the code as you work with it. That's an interesting idea, the equivalent of highlighting a book or taking notes. But you need to make sure you strip out all these transient comments before working with others.
Before comparing or promoting, run your source files through a filter program that strips the comment. This could be a one-liner perl script.
To make it easier, use a distinctive pattern for your non-permanent comments, to make them easier to filter out (and to distinguish between these transient comments, and comments you really want to leave in the source). E.g. if you were writing in C++, always comment using
//Sylvain: this is my comment here.
or some other pattern that is even easier to grep for.
If the content of the comments are not something you care about, and do not matter, why not delete them?
If well documented code that is readable and understandable is part of what you create, why not review changes to that meta-data?
Adding comment to your code is smell that your code is hard to read, code should be self describing, like someone has said that , good code is like good joke, it does not need to be explained. It is better to change your variable name, put section of your code into a subroutine. Re factoring is better than commenting. Even you find a tool to solve you commenting problem, it does not solve the real problem that is make you code easy to understand.