better-comments icon indicating copy to clipboard operation
better-comments copied to clipboard

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

Open Mon-Tea opened this issue 5 years ago • 18 comments

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.

Mon-Tea avatar Oct 25 '18 17:10 Mon-Tea

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

aaron-bond avatar Oct 25 '18 17:10 aaron-bond

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

Mon-Tea avatar Oct 25 '18 17:10 Mon-Tea

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..

Mon-Tea avatar Oct 25 '18 17:10 Mon-Tea

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

aaron-bond avatar Oct 25 '18 17:10 aaron-bond

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?

aaron-bond avatar Oct 25 '18 17:10 aaron-bond

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 ?

Mon-Tea avatar Oct 25 '18 18:10 Mon-Tea

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

aaron-bond avatar Oct 25 '18 18:10 aaron-bond

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?...

Mon-Tea avatar Oct 25 '18 18:10 Mon-Tea

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

aaron-bond avatar Oct 25 '18 18:10 aaron-bond

Thank you ;)

Mon-Tea avatar Oct 25 '18 18:10 Mon-Tea

I'm having some trouble replicating this: image

That's using this setting: image

Any ideas?

aaron-bond avatar Oct 25 '18 20:10 aaron-bond

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 avatar Oct 26 '18 06:10 Mon-Tea

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 avatar Oct 26 '18 07:10 Mon-Tea

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.

Mon-Tea avatar Oct 26 '18 07:10 Mon-Tea

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

aaron-bond avatar May 15 '19 11:05 aaron-bond

Restating VScode seemed to do the trick for me!

jdsans avatar Jul 11 '20 18:07 jdsans

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

j-krl avatar Oct 27 '21 01:10 j-krl

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.

deefdragon avatar Nov 13 '21 09:11 deefdragon