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
7 stars 1 forks source link

Custom tags doesn't render in the first line of the file. #17

Open Gallucky opened 1 month ago

Gallucky commented 1 month ago

I am using the extension in vscode and everything worked great but now I am encountring an issue. Some of the customs tags do not work in the first line of the file while the 'todo', '!', '?' etc... works.

I even copy pasted the working tags and change the tag value to be for example ~ which works in all lines except the first one. It does work in the better-comments tags...

The '!':

{
     "tag": "!",
     "aliases": ["Deprecated", "Warning", "Error"],
     "color": "#FF2D00",
     "strikethrough": false,
     "underline": false,
     "backgroundColor": "transparent",
     "bold": false,
     "italic": false
},

The '~':

{
     "tag": "~",
     "color": "#2D9596",
     "strikethrough": false,
     "underline": true,
     "backgroundColor": "transparent",
     "bold": false,
     "italic": false
}
Zxynine commented 3 weeks ago

I am using the extension in vscode and everything worked great but now I am encountring an issue.

Some of the customs tags do not work in the first line of the file while the 'todo', '!', '?' etc... works.

I even copy pasted the working tags and change the tag value to be for example ~ which works in all lines except the first one.

It does work in the better-comments tags...

The '!':


{

     "tag": "!",

     "aliases": ["Deprecated", "Warning", "Error"],

     "color": "#FF2D00",

     "strikethrough": false,

     "underline": false,

     "backgroundColor": "transparent",

     "bold": false,

     "italic": false

},

The '~':


{

     "tag": "~",

     "color": "#2D9596",

     "strikethrough": false,

     "underline": true,

     "backgroundColor": "transparent",

     "bold": false,

     "italic": false

}

Hi, thanks for letting me know, what language are you encountering this problem in? To me it sounds like the language has a special first line marked in its settings and so I avoid putting highlights on it as I don't know if there was an easy way to find out what the special character used on first lines was so I excluded the most common ones. I think that the reason it worked in the original better comments was that it was not taking that into account and so some people had highlights when there shouldn't have been. I will look into it to see if there is something I can to, but this may just be a situation where someone will always have an issue with whatever decision I make.

Zxynine commented 3 weeks ago

I did a Quick Look over everything and can confirm that if the language specifies a special first line (ex: python with its shebang) I disable highlights for the first line. In python the shebang looks like "#!/usr/bin/python" or something similar, so depending on how the language configures the first line and how the user types it there can be a number of situations where depending on the tags you have defined, all of your scripts that use the special first line are treated as comments and hi-lighted which some could find annoying. I did notice a potential way to get around that by manually checking if the first line matches what was specified in the language definition, but I will need to do some testing.