aaron-bond / better-comments

https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
MIT License
849 stars 161 forks source link

Is it possible to add additional @ annotation tags like @inject? #115

Open Mon-Tea opened 6 years ago

Mon-Tea commented 6 years ago

Hello, I want to add e.g. @inject and some other @ annotation tags to highlight it in php classes.

If I use this:

{
    "tag": "@inject",
    "color": "#FF8C00",
    "strikethrough": false,
    "backgroundColor": "transparent"
},

the highlighting highlights the next line also. How can I do this with only this line where @inject is inside?

Thanks for help and that great extension.

aaron-bond commented 6 years ago

Hey there. This should work OOTB. Can you send a screenshot of what you see?

Mon-Tea commented 6 years ago

Yes I can.. here it comes ;) screenshot 2018-10-25 um 19 50 00

Mon-Tea commented 6 years ago

Perhaps it has a conflict with another extension.. i tested to deactivated Intelephense, because I thought the highlights of @api @var @param @return comes from that ext. but that doesn't comes from that extension..

aaron-bond commented 6 years ago

Hmmm. That's very strange. If you add just "inject" without the "@" I assume it's fine?

aaron-bond commented 6 years ago

Ah wait, I think I know the cause. If you put a space and some random character in the same line after @inject what happens?

Mon-Tea commented 6 years ago

If I only use inject without the @ the @inject and the next line are both without highlight

If I make a space and some text behind the @inject it works like expected, but @inject has no params like @api. How does @api works? it has the behaviour I expect for @inject ...

I also want to change @param (with some colour) \RM\RmArticle\Domain\Repository\TagRepository (with another colour) description (with a third colour) ... I should open another issue for that ?

aaron-bond commented 6 years ago

Do you mean you want @param to be one colour and the rest of the text some other colour?

Mon-Tea commented 6 years ago

the 2nd issue i think @param (one color) \path\to\repository or something OR a $variable (a 2nd color) and the description behind that the first or a third colour... but that would be the next issue ;)

the problem here is that the text from the first \ to the last \ is gray and only the TagRepository is coloured screenshot 2018-10-25 um 20 17 49 It looks like this

shouldn't I open another issue for that?...

aaron-bond commented 6 years ago

Let me investigate first. I have a feeling it's related to @ but I'm not sure. I'll update this thread when I know more

Mon-Tea commented 6 years ago

Thank you ;)

aaron-bond commented 6 years ago

I'm having some trouble replicating this: image

That's using this setting: image

Any ideas?

Mon-Tea commented 6 years ago

I removed all other extensions, so this wasn't the reason. I use Better Comments Version 2.0.2 - installed it yesterday so I think it's the newest one.

I have this better comments config:

"better-comments.multilineComments": true,
    "better-comments.highlightPlainText": false,
    "better-comments.tags": [
        // RED
        {    
            "tag": "@deprecated",
            "color": "#FF4500",
            "strikethrough": false,
            "backgroundColor": "transparent"
        },
        {
            "tag": "@ignorevalidation",
            "color": "#FF7676",
            "strikethrough": false,
            "backgroundColor": "transparent"
        },

        // GREEN
        {
            "tag": "@validate",
            "color": "#84E93B",
            "strikethrough": false,
            "backgroundColor": "transparent"
        },

        // BLUE
        {
            "tag": "@inject",
            "color": "#3498DB",
            "strikethrough": false,
            "backgroundColor": "transparent"
        },

        // LIGHT ORANGE
        {
            "tag": "info",
            "color": "#F5C343",
            "strikethrough": false,
            "backgroundColor": "transparent"
        },

        // LIGHT GREEN
        {
            "tag": "todo",
            "color": "#21EA3F",
            "strikethrough": false,
            "backgroundColor": "transparent"
        },
    ],

I removed the theme config so it looks like this screenshot 2018-10-26 um 08 36 45

Mon-Tea commented 6 years ago

Some interesting: @api, @var, @param & @deprecated comes from VS Code itself. Perhaps the problem comes from there ?

It looks like this without any extensions: screenshot 2018-10-26 um 09 01 32

Mon-Tea commented 6 years ago

You forgot php after the <? on top of your test-file... perhaps this is a hint? And near all php-files miss the closing ?> tag, because they don't need it.

aaron-bond commented 5 years ago

I was never able to replicate this issue. I copied your settings over but I still get this result: image

jdsans commented 4 years ago

Restating VScode seemed to do the trick for me!

j-krl commented 3 years ago

I am getting the same issue where the @ tags don't work, but the other default tags do. I haven't changed any settings.

Screen Shot 2021-10-26 at 7 47 08 PM
deefdragon commented 3 years ago

I think some extra options to configure how to highlight the tag, vs what comes after it, would be really great in allowing the user to customize annotations like this, but it would also make each tag more complicated to configure.