jgclark / vscode-todo-highlight Goto Github PK
View Code? Open in Web Editor NEWVSCode Extension to highlight TODOs etc.
License: MIT License
VSCode Extension to highlight TODOs etc.
License: MIT License
In Latex comments are started by %
.
This is not handled in your extension, please add the support.
Thanks.
Please add your extension to open-vsx registry to be able install extension into vscodium.
I know that i'm able install extension from VSIX file, but it would be very nice to have availability install extension more "native" way
Hi just,
as a proposal for the default style for this project.
I played around with a lot of different configurations and with darkmode vscode this one looks the best IMHO but it looks only best if there is space around the keywords.
"todohighlight.isCaseSensitive": true,
"todohighlight.keywords": [
{
"text": "TODO",
"color": "#eeeeee",
"regex": {
"pattern": ".?TODO.?"
},
"backgroundColor": "#4b8d6b",
"border": "1px",
"borderRadius": "3px",
"fontStyle": "oblique",
"letterSpacing": "0px"
},
{
"text": "FIXME",
"regex": {
"pattern": ".?FIXME.?"
},
"color": "#eeeeee",
"backgroundColor": "#ff6666",
"border": "1px",
"borderRadius": "3px",
"letterSpacing": "0px"
},
],
Is it possible to mayme let the font of the keywords appear smaller so the backgrounds looks better?
Did not find anything in:
https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions
Don't search "TODO" in the files specified in .gitignore.
Add a setting to choose is user want follow or not follow rules in .gitignore is a good possibility.
I can't get this extension to work in VS Code v1.80.1 (the latest release as of today). I've tried every troubleshooting step I can think of, including:
settings.json
Have an option that when running the List Annotated Highlights
command, add results into the Problem tab, not the Output tab.
Alternatively, have a new setting isProblem
per highlight, that automatically adds them to the Problem tab.
Hi, like title, add a way to use a custom file to load settings.
like: todohighlight.json
, todohighlight.rc
, todohighlight.js
...etc, in the root path.
always should have support for settings.json
This way the user will have 2 options, custom file
and vscode configuration
to load the configuration.
Expiration blocks seem to be very convenient thing to use. What do you think about highlighting them?
// TODO (@lubien) [>0]: Refactor for stable.
Following the example configuration on the project homepage, I created the following custom config:
"todohighlight.keywords": [
{
"regex": {
"pattern": "(<h2>.*?<\/h2>)"
},
"color": "white",
"backgroundColor": "#8A4400",
"isWholeLine": false
},
{
"regex": {
"pattern": "\\(screenshot: ([^)]+)\\)"
},
"color": "White",
"backgroundColor": "Red",
"isWholeLine": false
}
]
both regex are ignored. The expressions are not wrong, they simply are not picked up.
However, if I use this variant, everything works as expected:
"todohighlight.keywords": [
{
"text": "test1",
"color": "white",
"backgroundColor": "#8A4400",
"isWholeLine": false
},
{
"text": "test2",
"color": "White",
"backgroundColor": "Red",
"isWholeLine": false
}
]
I'd really prefer to specify a series of regex rather than an endless list of strings, so any help would be greatly appreciated.
Thank you
I want to highlight all occurences of words like @ToDo
or @Note
in my code, but I have troubles doing so and I don't really know what's the issue. I added the C++ files to the files list & the extension works fine if instead of regex I just write "text": "@Note"
. Here's my settings.json:
"todohighlight.isEnable": true,
"todohighlight.keywords": [
{
"text": "Notes",
"regex": {
"pattern": "@\\p{Lu}\\w*:?"
},
"color": "#dbb302",
"backgroundColor": "rgba(0,0,0,0)"
}
],
"todohighlight.include": [
"**/*.js",
"**/*.jsx",
"**/*.ts",
"**/*.tsx",
"**/*.html",
"**/*.css",
"**/*.scss",
"**/*.php",
"**/*.rb",
"**/*.txt",
"**/*.mdown",
"**/*.md",
"**/*.cpp",
"**/*.hpp",
"**/*.c",
"**/*.h"
]
List highlighted annotations, will get the file address after character encoding, but it cannot be jumped.
For exampleοΌ
file:///Users/xxx/src/app/%28page%29/%28auth%29/components/user-auth-form.tsx#189
Hope to get:
file:///Users/xxx/src/app/(page)/(auth)/components/user-auth-form.tsx#189
This is a problem, right?
The extension is only highlighting todohighlight.keywordsPattern and using the default style. here is my configuration
//Todo highlight ...
"todohighlight.isEnable": true,
"todohighlight.isCaseSensitive": true,
"todohighlight.keywords": [
"DEBUG:", // without further details, this will use the defaultStyle
"REVIEW:", // as will this
{
"text": "todo:",
"before": {
"contentText": "β‘" // can add text before or after the highlight
},
"color": "red",
"border": "1px solid red",
"borderRadius": "2px", //NOTE: using borderRadius along with `border` or you will see nothing change
"backgroundColor": "rgba(0,0,0,.2)"
},
{
"text": "note:", // this is further refined by the regex pattern below
"color": "#ff0000",
"backgroundColor": "yellow",
"overviewRulerColor": "grey",
"before": {
"contentText": "π‘π¦" // can add text before or after the highlight
},
"regex": {
"pattern": "(?<=^|\\\\s)note[:]?" // in this example, highlight `NOTE:` with or without the `:` and that's not part of another word. (I.e.: The above will highlight 'NOTE' but not the "note" in 'SIDENOTE').
/**
* NOTE: remember to escapse the backslash if there's any in your regexp (using \\\\ instead of single backslash)"
* Positive lookbehind (`(?<=...)`) is only supported in Node.js v9 and up.
* If your VSCode version is built on an earlier version the example above may not work.
* bynoted byNOTE NOTEing NOTE:
**/
},
"isWholeLine": false
},
{
"text": "topic:",
"color": "green",
"backgroundColor": "rgba(0,0,0,0)", // INFO: setting the last parameter to zero (alpha channel) disables the background colour
"border": "none",
"before": {
"contentText": "π" // can add text before or after the highlight
},
"isWholeLine": false
},
],
"todohighlight.keywordsPattern": "todo:|fixme:|pop:|note:|topic", //highlight `TODO:`,`FIXME:` or content between parentheses
"todohighlight.defaultStyle": {
"color": "white",
"backgroundColor": "#9930ff",
"cursor": "pointer",
"borderRadius": "3px",
"padding":"1px",
"isWholeLine": false,
//other styling properties goes here ...
},
"todohighlight.include": [
"**/*.js",
"**/*.jsx",
"**/*.ts",
"**/*.tsx",
"**/*.html",
"**/*.php",
"**/*.css",
"**/*.scss",
"**/*.md",
"**/*.mmd",
"**/*.markdown",
"**/*.mdown",
"**/*.txt",
"**/*.rb",
"**/*.go",
"**/*.dart"
],
"todohighlight.exclude": [
"**/node_modules/**",
"**/bower_components/**",
"**/dist/**",
"**/build/**",
"**/.vscode/**",
"**/.github/**",
"**/_output/**",
"**/*.min.*",
"**/*.map",
"**/.next/**"
],
"todohighlight.maxFilesForSearch": 5120,
"todohighlight.toggleURI": false
}
A user has suggested it would be ideal if some of the settings could be controlled by the main VSC settings UI.
I think this will be too difficult for the advanced cases, but it might be possible for a simple list of keywords.
Not too important, but when settings are changed, the previous highlights are not reseted and VSCode needs to be restarted once.
Even if specifying todohighlight.include = []
and todohighlight.exclude = [ "**/*.* "]
, keywords still get highlighted in all files.
Maybe the issue is the fact that the inclusion and exclusion is not directly handled in the function updateDecorations
in src/extension.js
.
Perhaps adding something like this into the updateDecorations
function will work:
// the function isFileNameOk checks for the include and exclude settings
if (!isFileNameOk(activeEditor.document.fileName)) {
return;
}
The default values of todohighlight.defaultStyle
and todohighlight.keywords
are not taken over into the config when you select them (so they are not in the default config). At least VSCode settings do. Currently you have to look them up in the code. Maybe they are just missing in the package.json
?
(I am not sure if they could then be removed from the code, although that could probably be another Issue).
Is there any plan to support multi root Workspaces?
In our Projekt it's really nice to have multiple Folders in one workspace. Most of them have their own .vscode Folder with a settings.json.
I have a few keywords that i only want to highlight in one folder -> to do so i edited the settings.json in this folder. Sadly these keywords don't seem to be recogniced... if i put the same keywords in the User settings.json they work just fine... i think it could be a problem with the API Change linked below, but i'm not so sure about that.
https://github.com/microsoft/vscode/wiki/Adopting-Multi-Root-Workspace-APIs#do-i-need-to-do-anything
When editing settings of the extension or some other actions, it may duplicate the Before / After content text.
In my example, I was using 1 emoji, then I edited the configuration so I replaced by the emoji by "a", and I got 3 emoji + "a".
I take this opportunity to say that we need to focus a view to get the keywords matched, updated and stylized.
Could be nice if it does without having to do it manually.
It would be nice if one could apply different highlights in different file types.
For example, the following should highlight only in java files:
"[java]": {
"todohighlight.keywords": [ "why do you use java in the first place??" ]
}
For this, the scope needs to be set to language-overridable
I think, see https://code.visualstudio.com/api/references/contribution-points#contributes.configuration.
Ps: Thanks for revive this extension!
Low priority, but might save some people from thinking the extension is broken or digging through settings like I did.
Right now, the List highlighted annotations only works when you have a folder open (and probably a workspace but I haven't tried that). When you are working on individual files in one or more editors, the command returns 0 results. In lieu of this, it might be beneficial for the response message to mention this caveat. Currently, it simply returns: "No results" even though the file I'm looking at clearly has highlights.
Hope that makes sense, aside from that minor thing, loving this extension!
I want to color the text of keywords but leave the backgroundcolor transparent.
While regex
shows up in the list, before
does not.
I don't know if these can have more than the one argument?
This is a problem I've had with the original extension for a long time. I'd like the border of a line to be colored, but keep the original text color.
Right now the text becomes white when I turn the text color off with a border.
Can this version help there?
As mentioned in #69, the include
and exclude
settings weren't actually wired up previously, so the default behavior was to enable the extension globally. IMO, include
should be undefined or an empty list by default - which would enable the extension globally1. Then if the user wants, they can limit which files types the extension considers by putting file types (or languages as mentioned in this comment) in the includes
setting. This makes more sense than than shipping the extension with a predefined list of (mostly web-dev related) file types that it works with and forcing users to add the file types that are specific to how they use vscode.
There are a couple reasons I think this is an improvement:
include
option to their settings, but while still keeping the benefit of actually having the setting wired up for those that want to use it.**/*
, as the readme explicitly warns against2, or, rather absurdly, adding every file extension they are likely to work withAfter the release of version 2.0.4, I took a closer look at the extension.
Thanks here for the quick reply and the improvements.
Unfortunately, I currently have no time to set up JS myself and to learn to fix and improve things myself. Maybe in a few months time.
#29 was probably not really understandable and I had also made some wrong assumptions, therefore now again in more detail:
I understand now how it is done with the styles. In todohighlight.defaultStyle
and also in todohighlight.keywords
DecorationRenderOptions are used for the style .
Additionally in todohighlight.keywords
there is text
and regex
which is defined by itself.
With this knowledge it is true that {...}
for "before" cannot be removed.
Currently, the autocompletion for this looks like this:
We could of course define all parts from DecorationRenderOptions
in the settings.json
. But I would suggest to extend the documentation and show only the most important options as now.
One possibility would be to extend the following descriptions and indicate that all options from DecorationRenderOptions are possible:
vscode-todo-highlight/package.json
Line 158 in 6b10ef6
vscode-todo-highlight/package.json
Line 110 in 6b10ef6
"markdownDescription": "... Further options can be found [here](https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions).",
regex
property improve or simplifyA quick fix is to fix the settings.json
, because currently regex is not defined correctly. The following should work, but would need to be tested:
vscode-todo-highlight/package.json
Line 135 in 6b10ef6
"regex": {
+ "type": "object",
- "pattern": {
- "type": "string",
- "description": "The RegEx pattern to use for matching instead of the text value.REMEMBER to escape the backslash if there's any in your regexp (using \\\\ instead of single backslash)"
+ "properties": {
+ "pattern": {
+ "type": "string",
+ "description": "The RegEx pattern to use for matching instead of the text value.REMEMBER to escape the backslash if there's any in your regexp (using \\\\ instead of single backslash)"
+ }
}
},
But since regex
is defined by us, I would suggest to simplify it permanently, since a new object for a single parameter makes little sense. This would then simplify in settings.json
as follows, but also needs some code adjustments:
"regex": {
- "pattern": {
- "type": "string",
- "description": "The RegEx pattern to use for matching instead of the text value.REMEMBER to escape the backslash if there's any in your regexp (using \\\\ instead of single backslash)"
- }
+ "type": "string",
+ "description": "The RegEx pattern to use for matching instead of the text value.REMEMBER to escape the backslash if there's any in your regexp (using \\\\ instead of single backslash)"
},
In your README you say wayou's extension is unmaintained but in the marketplace its last update date is:
10/29/2021, 12:31:46 AM
I think from interactions in the last few days, that I've identified something that's unhelpful for new users: there are no default settings loaded into the user's settings, or otherwise applied.
I think #31, #52 and possibly #69 show elements of this.
I'm travelling so can't investigate further right now, but I think #31 (comment) is relevant.
Hello
thank you for creating release 2 of this plugin and sharing your great work!
Could you please think about offering support for dark/light (or day/night) themes and allow us to define colors depending on it?
Somethin like that:
{
"text": "### β¦",
"regex": {
// this is a 'TODO Highligt' bug: Regex for "start of line": ^ does not work,
// probably because it uses wrong Regex option 'multilne / single' line parsing
"pattern": "(?<=(?:\\r\\n?|\\n)\\s*)(#{3}(:|\\s).*)(?=\\r\\n?|\\n)?"
},
// keep the backward compatibility
"color": "red",
"backgroundColor": "rgba(245, 39, 145, 0.09)",
// The new dark/light mode
"LightModeColor": {
"color": "β¦",
"backgroundColor": "β¦"
},
"DarkModeColor": {
"color": "β¦",
"backgroundColor": "β¦",
}
},
Thanks a lot, kind regards,
Thomas
I had added "**/*.py"
to "todohighlight.include"
and the results were displayed correctly by listAnnotations
.
If you remove the entry in the settings and run listAnnotations
again, the ui is correctly set to 0 ( ), but the info is still displayed in the output window and the info message "No results" is not shown.
This cannot be changed by restarting VSCode. Running listAnnotations
has the same effect as before the restart.
I think that maybe in the following function at the right position only the following line is missing:
vscode-todo-highlight/src/extension.js
Line 70 in 6b10ef6
window.outputChannel.clear();
Since I can't test it, I didn't create a pull request.
When using in a vscode remote session, the output from VSCode-TODO-Highlight doesn't seem to format well for making the links (successfully) clickable. Representative screenshot attached:
I suspect the actual problem is VS Code expects filename[:line[:column]]
format when a full URL path is used, instead of the filename#line
format which is possibly supported only when using a local filesystem path? But that's just a theory, which needs to be tested.
Suggestion: try outputting the filename[:line[:column]]
format instead, see if it works in both local and vscode-remote contexts.
Hi,
thanks for taking over maintaining this extension.
When preparing the VS Code extension recommendations for my team, I ran into the issue of two seemingly identical versions of this extension existing on the Visual Studio Marketplace. When searching for it in VS Code, the outdated version is on place one and this one on place four, so I am pretty sure people are still installing the older version, certainly in my team as well.
On a first glance, this version seems just like a copy of the unmaintained original, also, it has not been forked via the GitHub fork feature, so no connection is shown there.
Only when you scroll down in the README.md, you can find some information about this being a fork and the reason behind it. On VS Marketplace you can not see any information about that at all.
Had I been in a hurry, I would have installed the outdated version as well, as a consequence.
To contribute to others not doing the same and promoting this version, I opened Issue #187 on the outdated repository, asking one of the contributors to update the README.md there, so that it points to this repository.
In addition, I would suggest for the README.md of this project, as well as the VS Marketplace site to shorten the history chapter and move it to the top, e.g. like this:
This extension was started and maintained by wayou until 2018. jgclark then picked it up in mid-2020, as the original extension was no longer maintained. See CHANGELOG.md for more details.
Cheers
It would be easier if we could navigate through the TODOs and view the code at the same time.
With the current configuration, we can't because either we have the ouput terminal opened, either we have the code, not both.
You could inspire yourself from this VSC extension I was using before, and which is doing this great.
It offers some tools like expand / collapse tree, filter, refresh, group by tag and especially 3 different views, shown in the screenshots below (tree, flat tree and list).
I'm currently using your extension + the one I linked, but it would be better if these two features were in only one extension.
I am using the regex pattern option exactly as per the example, but it doesn't seem to work.
When I only specify a regex, it doesn't match anything. When I add the text, it will match, but then it doesn't respect the regex.
The example in the readme specifies both a text and regex, but that doesn't seem to be the way.
Compare:
See how DENOTE: is still matched.
I'm using this extension for some time now. It works fine in .js and .php files, but shows no effect in .py files. I think it worked before, but I'm not writing Python often so I can say when.
The current version in 2.0.8 with VSCode 1.77.3 on Windows.
The example Language Specific keywords of the doesn't work in version 2.0.4
"[markdown]": {
"todohighlight.keywords": [
{
"text": "BRACKETS:",
"color": "#000000",
"backgroundColor": "pink",
"regex": {
"pattern": "(?<=\\{)[^\\}\\n]+(?=\\})" // highlight things in {ss} but not including line breaks
}
}
]
}
I could look into it, but I'm not sure if that's a good idea if @elazarcoh is done with the PR to transfer this extension to TS.
I like to display my TODOs in the Problems view, and obviously as the setting to enable that is "Enable Diagnostics", that was never the primary focus of this extension. However, they're not errors. When they're tagged as errors, I can't filter them without hiding the serious issues I need to deal with.
It would be great to either always display them as Info, or to make the level configurable. I'm not sure if this is related to #1 or not. I would have thought #1 was accomplished with "Enable Diagnostics", so maybe I'm actually requesting what you've already proposed.
When changing to a new tab, highlighted words are the correct color. But, after a short time the color is greyed out for all words.
An example is probably better:
After a short time (really short, I cannot take a picture before it changes :( ):
The before, would be with all the word with the same highlighted color than the colons
For me it was not immediately clear from the README that higlighting and listAnnotations do not work the same way and so I had expected at first that everything that is higlighted also appears in the list.
While the former works in all files, even in the settings, listAnnotations respects todohighlight.include
and todohighlight.exclude
and is more or less an own independent function.
I would suggest the following options:
Is there a way to do the pattern matching only in the comment without adding it in the regex? An option in the setting could be nice, this could use the language syntax to detect comment section and perform the regex matching.
If there is already a solution I didn't find one that could work on all language.
Hi! I just started using this extension after noticing that the original version isn't maintained anymore, it looks great so far. Here's a crosspost of an issue I filed at the original repo:
In the Golang context
package, context.TODO()
is the catch-all use case. This TODO should not be highlighted.
Bigger picture, should any TODO that looks like a function be highlighted?
Not sure what a good way to implement this would be, but I figured it's worth flagging.
Hello,
thank you for taking over the development of this extension.
My C++ linter expects a TODO annotation to specify a user:
// TODO: gather params etc...
will result in an error:
Missing username in TODO; it should look like "// TODO(my_username): Stuff." [readability/todo] [2]
would it be possible to support highlighting annotations that have a username between the annotation and the ":" between parenthesis ?
Thank you
I'm using the extension to highlight citation commands in latex. But these commands don't need to be highlighted if inside a comment. This is doable using regex but it would be nice if there was a option for it.
Hi Jonathan,
first of all, thank you for continuing this extension!
In my case (VS Code1.47.2 and TODO Highlight 1.21) your example for the "NOTE" regex is not working (nothing gets highlighted at all).
"regex": {
"pattern": "(?<=^|\\\\s)NOTE[:]?" // in this example, highlight `NOTE:` with or without the `:` and that's not part of another word. (I.e.: The above will highlight 'NOTE' but not the "note" in 'SIDENOTE').
/**
* NOTE: remember to escapse the backslash if there's any in your regexp (using \\\\ instead of single backslash)"
* Positive lookbehind (`(?<=...)`) is only supported in Node.js v9 and up.
* If your VSCode version is built on an earlier version the example above may not work.
* bynoted byNOTE NOTEing NOTE:
**/
},
Like with Textmate rules two backslashes are sufficient, better: exactly what is required - at least on my side (the first one is needed to let the 2nd one survive the processing before the rule is passed to the regex engine.
Additionally, the "[:]?" part will not exclude "NOTEing" from being marked because it doesn't differentiate any further the case where the terminal colon is missing.
Here ist what's working for me.
"regex": {
"pattern": "(?<=^|\\s)NOTE[:]?(?!\\w)"
To answer #35 (comment) I propose the following roadmap:
"markdownDeprecationMessage": "...",
) to the pattern
property itself according to VSCode autocompletion. But I would write one to todohighlight.keywords
saying that the property is simplified to regex: "..."
and mention this issue. (I don't know how aggressively it will be pointed out then, but hopefully a few users will get it that way.)A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.