vscode-offensiveterm-highlight
Many organizations are contributing to the Inclusive Naming Initiative which helps projects and companies make consistent, responsible choices to remove harmful language.
Highlights configued offensive terms like Blacklist , Master , etc and other annotations within your code.
This plugin is inspired from an existing plugin TODO Highlight. The plugin is developed in such a way that, a user can configure list of offensive words to be highlighted in an array.
Config
blacklist ,whitelist are built-in keywords. You can override the look by customizing the setting.
To customize the keywords and other stuff, command + , (Windows / Linux: File -> Preferences -> User Settings) open the vscode file settings.json .
|
type |
default |
description |
offensivetermhighlight.isEnable |
boolean |
true |
Toggle the highlight, default is true. |
offensivetermhighlight.isCaseSensitive |
boolean |
true |
Whether the keywords are case sensitive or not. |
offensivetermhighlight.keywords |
array |
N/A |
An array of keywords that will be hilighted. You can also specify the style for each keywords here. See example below for more infomation. |
offensivetermhighlight.keywordsPattern |
string |
N/A |
Specify keywords via RegExp instead of offensivetermhighlight.keywords one by one. NOTE that if this presents, offensivetermhighlight.keywords will be ignored. And REMEMBER to escapse the back slash if there's any in your regexp (using \ instead of signle back slash). |
offensivetermhighlight.defaultStyle |
object |
N/A |
Specify the default style for custom keywords, if not specified, build in default style will be applied. See all available properties on VSCode doc DecorationRenderOptions section |
offensivetermhighlight.include |
array |
[
"**/*.js" ,
"**/*.jsx" ,
"**/*.ts" ,
"**/*.tsx",
"**/*.html" ,
"**/*.php" ,
"**/*.css",
"**/*.scss" ] |
Glob patterns that defines the files to search for. Only include files you need, DO NOT USE {**/*.*} for both permormance and avoiding binary files reason. For backwards compatability, a string combine all the patterns is also valid "{**/*.js,**/*.jsx,**/*.ts,**/*.tsx,**/*.html,**/*.php,**/*.css,**/*.scss}" |
offensivetermhighlight.exclude |
array |
[
"**/node_modules/**" ,
"**/dist/**",
"**/bower_components/**" ,
"**/build/**",
"**/.vscode/**" ,
"**/.github/**" ,
"**/_output/**" ,
"**/*.min.*" ,
"**/*.map" ] |
Glob pattern that defines files and folders to exclude while listing annotations. For backwards compatability, a string combine all the patterns is also valid "{**/node_modules/**,**/bower_components/**,**/dist/**,**/build/**,**/.vscode/**,**/_output/**,**/*.min.*,**/*.map}" |
offensivetermhighlight.maxFilesForSearch |
number |
5120 |
Max files for searching, mostly you don't need to configure this. |
offensivetermhighlight.toggleURI |
boolean |
false |
If the file path within the output channel not clickable, set this to true to toggle the path patten between <path>#<line> and <path>:<line>:<column> . |
an example of customizing configuration:
{
"offensivetermhighlight.isEnable": true,
"offensivetermhighlight.isCaseSensitive": true,
"offensivetermhighlight.keywords": [
"slave",
"master",
{
"text": "segregate",
"color": "#ff0000",
"backgroundColor": "yellow",
"overviewRulerColor": "grey"
},
{
"text": "segregation",
"color": "#000",
"isWholeLine": false,
}
],
"offensivetermhighlight.keywordsPattern": "blacklist|whitelist|\\(([^)]+)\\)", //highlight `blacklist:`,`whitelist:` or content between parentheses
"offensivetermhighlight.defaultStyle": {
"color": "red",
"backgroundColor": "#ffab00",
"overviewRulerColor": "#ffab00",
"cursor": "pointer",
"border": "1px solid #eee",
"borderRadius": "2px",
"isWholeLine": true,
//other styling properties goes here ...
},
"offensivetermhighlight.include": [
"**/*.js",
"**/*.jsx",
"**/*.ts",
"**/*.tsx",
"**/*.html",
"**/*.php",
"**/*.css",
"**/*.scss"
],
"offensivetermhighlight.exclude": [
"**/node_modules/**",
"**/bower_components/**",
"**/dist/**",
"**/build/**",
"**/.vscode/**",
"**/.github/**",
"**/_output/**",
"**/*.min.*",
"**/*.map",
"**/.next/**"
],
"offensivetermhighlight.maxFilesForSearch": 5120,
"offensivetermhighlight.toggleURI": false
}
| |