Zxynine / EvenBetterComments

My take on the better-comments extension which incorporates many pull requests and multi tag definitions
https://marketplace.visualstudio.com/items?itemName=Tion.evenbettercomments
MIT License
11 stars 1 forks source link

Doesn’t work on multiline unless there is an extra star #16

Open Fred-Vatin opened 5 months ago

Fred-Vatin commented 5 months ago
VS Code OS Extension version
1.88.1 Win 10 x64 pro (french) 22H2 5.0.7

In some languages like js or CSS, block comments are /* */.

For some reason in those files, the extension refuses to highlight unless they use the block comment style of CPP, C or java namely /** */

It seems an extra * is required to highlight. It is not mentioned in the documentation.

Here is a CSS file: image

Settings:

    "evenbettercomments.allowFullBlockHighlights": true,
    "evenbettercomments.highlightTagOnly": false,
    "evenbettercomments.multilineComments": true,
    "evenbettercomments.monolineComments": true,
    "evenbettercomments.tags": [
        {
            "tag": "!",
            "aliases": [
                "Issue",
                "Problem"
            ],
            "CustomDecoration": {
                "backgroundColor": "#ff2f0079",
                "color": "white",
                "outline": "solid 1px",
                "outlineColor": "#ff0033",
                "borderRadius": "2px",
                "fontWeight": "bold",
                "fontStyle": "normal",
                "isWholeLine": false
            }
        },
        {
            "tag": "?",
            "aliases": [
                "Idea",
                "Info"
            ],
            "CustomDecoration": {
                "backgroundColor": "#3498db79",
                "color": "white",
                "outline": "solid 1px",
                "outlineColor": "#0099ff",
                "borderRadius": "2px",
                "fontWeight": "bold",
                "fontStyle": "normal",
                "isWholeLine": false
            }
        },
        {
            "tag": "TODO",
            "aliases": [
                "task"
            ],
            "CustomDecoration": {
                "backgroundColor": "#fdd80385",
                "color": "white",
                "outline": "solid 1px",
                "outlineColor": "#fdd703",
                "borderRadius": "2px",
                "fontWeight": "bold",
                "fontStyle": "normal",
                "isWholeLine": false
            }
        },
        {
            "tag": "***",
            "aliases": [
                "Important",
                "Wip",
                "~~~~~"
            ],
            "CustomDecoration": {
                "backgroundColor": "#69db187c",
                "color": "white",
                "outline": "solid 1px",
                "outlineColor": "#69db18",
                "borderRadius": "2px",
                "fontWeight": "bold",
                "fontStyle": "normal",
                "isWholeLine": false
            }
        },
        {
            "tag": "====",
            "aliases": [
                "----"
            ],
            "color": "white"
        }
    ],
Zxynine commented 3 months ago

Sorry I did not see this issue was opened, I can confirm that is how it works. Personally I dislike the JSDOC stytle comments with the asterisks on every line, but I also use an asterisk as a comment highlight, so I needed some way to ensure that people who use that style of comment formatting dont end up with everything highlighted when it wasnt intented to be. So as for now, any block comments with the extra asterisk at the start in JS based languages are considered JSDoc comments instead of regular comments. I think the best thing I can do is just make note of it in the documentation when I push the next update.

I am working on a new system for comment detection that should hopefully allow users to create their own custom regex handling of comments and tags if the defaults are not working the best for a specific language, that way everyone can have something that works for them. With that said, the regex system probably wont be available for another update or two as I am currently prioritising support for embedded languages.

Zxynine commented 3 months ago

I reread what you have stated and would like to clarify that the solution to get the comment highlights to work in comment blocks using /* */ is to remove the asterisk at the beginning of each line! If you read my last comment before this, give it a reread as I have just edited it to explain what is happening and why it is implemented as such. I am not entirely familiar with the standards of coding for those languages so if the asterisks are needed for certain features to work I will see what I can do to add an option to solve the issue.

I primarily work with C#, but have worked a fair bit in the other C based languages and personally I haven't seen the use of the /** */ style comments in those, but I also wouldn't put it past me to have missed it. Those styles I have found to only appear in the JS like languages and I know that they autocomplete in Typescript so likely JavaScript too meaning they are official comment styles for those languages.

By the way, thank you for the very detailed report! Extremely helpful to have the image with arrows and comments on it!

(EDIT) I was just looking into it, it does seem like its common for languages to put an asterisk on every line for the sake of indentation level / consistency, including C-based languages as I saw many people questioning why the asterisks were automatically being put when they press enter. Personally I havent had that problem and I dont know why. I did not however see them using the /** */ delimiter style though, just the extra asterisks on each line. IMO, you could just add an Alias to the comment styles to match * ISSUE which would fix your problem temporarily. I will look into what I might be able to do and how costly itll be to implement.