How can I configure JSDoc or VSCode to NOT use leading star/asterix in block comments - jsdoc

I find the leading star/asterix very annoying,
the moment I press EnterKey inside a block comment a leading star is inserted.
I would like my block comments to simply look like this
I do not see any specific jsdoc extension in my installed ones, let me know if I need one.
If it a configuration I am missing please let me know which file/settings I need to change.
Thank you.

Unfortunately you can't.
Despite disabling JSDoc autocompletion, VSCode still completes doc comments
completeJSDocs: false does not fully disable autocompletion
However, the leading * is not auto inserted once you have a non * line.
Ex:
/** ENTER HERE WILL INSERT A ASTERISK
a ENTER HERE WILL NOT
*/

Related

VSCode, Asciidoc, how to disable syntax hint?

Using
VSCode v1.54.4
asciidoctor.asciidoctor-vscode extension v2.8.8
Ubuntu 20.04.2
Whenever I type a colon : in the body text, there is an intellisense popup which comes up. As I rarely use attributes, I must dismiss that syntax hint by ESC. But from time to time, I accidentally insert the syntax hint and had to manually delete all the inserted characters.
Is there anyway to disable this syntax hint and ONLY for Asciidoc documents (*.adoc)
This answer is for Markdown documents, but describes the suggestion options that are available.
Based on your question, you might consider adjusting the "editor.acceptSuggestionOnEnter" item, so that accidental insertions of suggestions happens less frequently.

Github - link to function in source

I know I can have anchors to a certain line, but if the source changes that line might become irrelevant. Example:
...source.php#L33 < line 33 may become line 40 later :(
Is there some way to tell GitHub to link to a certain function or property from the source, without specifying the line?
(The source is written in PHP code.)
AFAIK, no, but you can link to a certain revision of the file, and thus, you can know for sure that line will always point at the start of the function.
The URL looks like /{user}/{repo}/blob/{hash}/{file}#L{line}
To get it, click "Commits", select the last commit, click "Browse code", and find your file and line as usual.
documentation
Yes you can. Newer browsers support highlighting a portion of text and scrolling to it.
Example: common.c#:~:text=static%20ssize_t%20led_current_store
All you have to do is to add this to the end of your URL:
#:~:text=function_name
Some browsers do not support this, though: https://caniuse.com/url-scroll-to-text-fragment
Enjoy!

how to freely format comments in cc-mode

I'm quite new to cc-mode and I'd like to configure it to allow me to freely format and use tabs in multiline comments. This is important to me because I want to use cog.py in my source file and need to be able to format the python source in the comment correctly. I'd be ok with comments not beeing autoindented at all, however I'd like to keep auto indenting the rest of the source code.
Example:
...
/*
[[[cog
import cog
for x in ['a','b','c']:
>cog.outl(x)
]]]
*/
...
In the line marked with > I'd like to press TAB to indent the line. cc-mode simply does nothing at all if i do so. I could use spaces there (which is inconvenient) but every (semi-)automatic re-indentation of this block would cause the spaces to vanish and therefore the python code to be incorrectly indented (which is what happens if i happen to press tab somewhere on this line after indenting it with spaces).
I tried to start emacs without my .init to be sure this is default behavior and not modified by my configuration so far. I've done google searches and read the documentation of the cc-mode variables / functions I stumbled upon (cc-mode online docs) while searching for a solution (i.e. c-indent-comments-syntactically-p, c-indent-command, c-tab-always-indent,...) but none of these seemed to solve my question.
EDIT1:
Thanks to abo-abo's idea of a "multi-major-mode" setup i've stumbled upon mmm-mode and have set up automatic switching to python mode for a cog section, which fixes most of my problems.
The only remaining problem is reindenting the whole file or a region containing a cog section. Can I somehow tell cc-mode to not change anything in comments while reindenting the file? mmm-mode + that would be a perfect solution for me.
You can use M-i to force a tab indent on the lines that you want, so you can use it to indent your comments.
You can also change your comments to use // instead. Just select your python code snippet, and do M-x comment-region:
// def foo(x):
// print 'hi'
Then the autoindent won't mess up your indentation.

Eclipse: Automatic line wrapping to specified width

I'd like for my lines, especially within comments, to be automatically managed so they don't get too long.
I remember once I had a configuration for vim which automatically moved the word I was typing to the next line once I reached 72 characters. It wasn't smart enough to rearrange the paragraph if I edit it, but it was a start.
Is there something that can manage these for me? I have a tendency to write really long comments in my code, and it helps to make them look neat by having consistent width, but it's always a pain to do this because oftentimes editing a sentence requires editing the entire rest of the paragraph.
I have just recently discovered the Ctrl+Shift+F feature. It is amazing and superior to Ctrl+I which is what I was using up till now, but I noticed that it does not do anything to clean up my comments.
Update: The answers are correct when working with Java in Eclipse. It seems like I have to wait for the CDT to incorporate this feature.
In "Windows -> Preferences", go to "Java -> Code style -> Formatter" to customize the formatter (called when you click Ctrl+Shift+F). In the tab "comment", you can set the maximum line width for comments (it can be different then the line width for code).
Tip: in the preferences, "Java -> Editor -> Save actions", you can make Eclipse to automatically format your file when you save it, so your code is always correctly indented !
The automatic formatting of Eclipse great no question.
If your comments are reformatted depends on what comment type and how you already have inserted line breaks.
Writing for example one very long line comment starting with // will be broken down by the formatter into multiple lines.
However you later edit the formatted lines - e.g. delete parts of it the formatter will leave them as they are. Only over-long lines will be changed.
Just in difference to block comments like this: /* comment */
Those comments will always be re-formatted in case the line is too short or too long.
If you want to format your header comment, you have to check Enable header comment formatting - that was the trick for me.
Obviously, to use this, you must create new formatter profile.

Rebind keys in Emacs to change commenting style in source code

I am trying to document certain sections of my code using Doxygen. I want to use the javadoc
style of comments viz
/**
* My Documentation goes here
*/
Now in Emacs I can comment out a certain block of text by selecting it and by pressing Meta+;. This comments out the lines by placing a // in front of all the lines selected.
Since most of the time I will be writing comments in my code which will be documented using Doxygen, I want to rebind the Meta+; to give me a javadoc style of comments.
How do I do that?
Use doxymacs. You'll have to rebind keys to your taste, but the bindings it comes with are pretty good.
Code is not documentation. Wouldn't you want to use javadoc style comments only for documentation?
It sounds like you actually want a snippet/skeleton system to insert a java-doc template that you can flesh out. If so I recommend yasnippet.