how to highlight user specified words in vscode - ide

I need to have my vscode highlight specific words so I can leave different notes in the code and easily see them when I need to, for example: Note: with the color green and DEBUG with color red and so on.

Download and install TODO Highlight extension. After you download and install the extension, make sure you restart your VSCode. Now please follow the following steps in order to add custom keyword highlighting in your code.
On windows hold down Ctrl + Shift and on mac Command + Shift,
then press the key P.
a command line opens up.
On the command line type "open settings" and click on
"Preferences: open settings".
Settings window will open.
under the "search setting" input on the right handside look for the
three dots "..." and click on it.
Click on "Open settings.json".
"User Settings" tab will open.
It contains a split screen window. on the left side you see the defualt settings and on the right side you see the user settings
in the "search settings" type "todohighlight.keywords"
you will see "todohighlight.keywords": [].
Hover over it with your mouse
a little pen will show up on its left side
click on it
you'll see a drop-down select menu opens.
click on "Replace in settings".
you can now see "todohighlight.keywords": [] in the right pannel window (USER SETTINGS).
This is an array that contains json objects such as following:
"todohighlight.keywords": [
{
"text": "todo:",
"color": "#000000",
"backgroundColor": "DarkKhaki",
"overviewRulerColor": "DarkKhaki",
"border": "1px solid DarkKhaki",
"borderRadius": "3px",
"isWholeLine": false
},
{
"text": "note:",
"color": "#000000",
"backgroundColor": "#72824E",
"overviewRulerColor": "#72824E",
"border": "1px solid #72824E",
"borderRadius": "3px",
"isWholeLine": false
},
{
"text": "System.debug",
"color": "#000000",
"backgroundColor": "STEELBLUE",
"overviewRulerColor": "STEELBLUE",
"border": "1px solid STEELBLUE",
"borderRadius": "3px",
"isWholeLine": false
},
{
"text": "system.debug",
"color": "#000000",
"backgroundColor": "STEELBLUE",
"overviewRulerColor": "STEELBLUE",
"border": "1px solid STEELBLUE",
"borderRadius": "3px",
"isWholeLine": false
},
{
"text": "console.log",
"color": "#000000",
"backgroundColor": "STEELBLUE",
"overviewRulerColor": "STEELBLUE",
"border": "1px solid STEELBLUE",
"borderRadius": "3px",
"isWholeLine": false
},
{
"text": "|DEBUG|",
"color": "#000000",
"backgroundColor": "#72848A",
"overviewRulerColor": "#72848A",
"border": "1px solid #72848A",
"borderRadius": "3px",
"isWholeLine": true
},
{
"text": "attention:",
"color": "white",
"backgroundColor": "red",
"border": "1px solid red",
"borderRadius": "3px",
"isWholeLine": false
},
{
"text": "debug:",
"color": "white",
"backgroundColor": "red",
"border": "1px solid red",
"borderRadius": "3px",
"isWholeLine": false
}
],
"todohighlight.include": [
"**/*.js",
"**/*.jsx",
"**/*.ts",
"**/*.tsx",
"**/*.html",
"**/*.php",
"**/*.css",
"**/*.scss"
],
"todohighlight.exclude": [
"**/node_modules/**",
"**/bower_components/**",
"**/dist/**",
"**/build/**",
"**/.vscode/**",
"**/.github/**",
"**/_output/**",
"**/*.min.*",
"**/*.map",
"**/.next/**"
]
If you're not familiar with json notation copy the content of "todohighligh.keywords" from the sample above and past it to your "user settings" window in between the two [] brackets. you can change the values on the left side of : colon in between "" double quotes. if you would like to add more than two keywords simply add a comma after the last closing curly bracket } in your "user settings" and copy/past one json object (which is from one { open bracket to the first closing } bracket) and then change its content. you can add as many keywords as you'd like to.
MAKE SURE YOU SAVE THE FILE by holding down Ctrl(windows) / command(mac) and press the key "s" or from the menu bar go to File ->
Save
Edit Jun/2021 It's been a while since I published this post. I've updated the sample for more detailed highlighting. Post your comments down below if you need clarifications. Cheers!🍻
Edit Jun/2022 I've added both "todohighlight.include" and "todohighlight.exclude" keys with some sample values for, files/file name patterns, to include and exclude on the highlighting. Cheers!🍻

My answer may not apply your scene, but if someone wants to highlight any word,I prefer this plugin:
The following options can be configured
highlightwords.colors: this is an array of light/dark pairs for respective theme types, you can have as few or as many as you like
highlightwords.box: show highlights as a box around the selections if true, set highlight as background color if false
highlightwords.defaultMode: the initial mode when initialized. 0=default, 1=whole word, 2=ignore case, 3=whole word and ignore case
highlightwords.showSidebar provides a view in the explorer window for searching, changing options and removing highlights

Related

Calendar Object not updating when useState value that supplied markedDates gets changed

I am using the Calendar Object from react-native-calendars and one of the props for its supplied <Calendar> component is markedDates
It is supposed to have a format like the following...
"2022-09-12": {"activeOpacity": 0.5, "color": "white", "dots": [[Object]], "marked": true, "selected": false},
"2022-09-14": {"activeOpacity": 0.5, "color": "white", "dots": [[Object]], "marked": true, "selected": false},
"2022-09-16": {"activeOpacity": 0.5, "color": "white", "dots": [[Object]], "marked": true, "selected": false},
"2022-9-17": {"selected": true},
"2022-9-19": {"selected": false},
wherein selected if true, activates the selectedStyle on the date, and where dots is an array of dot objects that indicate the presence of dots beneath the date value.
The issue is, notice how '2022-9-17' is set to {selected: true} yet the Calendar does not reflect that. I am console.log-ing the value displayed above in a useEffect, but it does not reflect what is shown in the Calendar. Does anyone aware of Calendar know if there's a way to get around this, or if I'm doing something improperly? The Calendar is called like so...
return(
<View style={{height: maxHeight * 0.43}}>
<CalendarProvider date={selectedDay} onDateChanged={() => handleSetSelectedDay(selectedDay)}>
<Calendar
markingType={`multi-dot`}
markedDates={markedDateObjects}
hideExtraDays={true}
onDayPress={day => { handleDateClick(day) }}
// Other stuff irrelevant for the issue
/>
</CalendarProvider>
</View>
)

Can I connect to our site, via ajax, on behalf of the account owner and pull a booklet list? Shopify Theme app extension - App Block

I am creating an app block with theme app extension with a select menu for the online store. The goal is to allow users/merchants to install our app, add the app by using Add Block and then hit the select menu and select a booklet/pdf from our site to embed on their storefont in Shopify. 
I am currently using Shopify CLI 3.0 and have the app installed to our store with the select menu (on the right panel) but the values are hardcoded at the moment.
I wanted to know: 
Can I connect to our site, via ajax, on behalf of the account owner and pull a booklet list?
Can I dynamically update the drop-down menu with that booklet list?
I have the liquid file for the block looking like this:
app-block.liquid:
<iframe src='https://louddoc.com/embed.php?wpKey={{ block.settings.workpad_key }}&source=embed' allowfullscreen width='100%' height='1220' style='border: 0; overflow: hidden; width: 1px; min-width: 100%; max-width:950px;' scrolling='no'></iframe>
{% schema %}
{
"name": "Title for App",
"target": "section",
"stylesheet": "app.css",
"javascript": "app.js",
"settings": [
{
"type": "select",
"id": "workpad_key",
"label": "Embed your booklet to your store",
"options": [
{
"value": "5xsYPWgs3l3VbOK1izBx6j",
"label": "Booklet 1"
},
{
"value": "C8Ij8PqtVpDvVpVNVXDQhw",
"label": "Booklet 2"
},
{ "value": "hLxVnSxFJuLw3iCvpfLko1",
"label": "Booklet 3"
}
]
}
]
}
{% endschema %}```

Fixed column width on Datatables when scrollX is enabled

I have a dynamically filled datatable with fixed columns and scrollX enabled:
$('#products').DataTable({
"data": formattedData,
"scrollX": true,
"fixedColumns":{ "leftColumns": 0, "rightColumns": 1 }
});
The problem is, I need the columns to stop automatically calculating their width. Even if I try to force them on initialization...
$('#products').DataTable({
"order": [[ 0, "asc" ]],
"columnDefs": [
{ "title": "Name", "targets": 0, "width": "350px" },
{ "title": "Code", "targets": 1 },
{ "title": "Regular code", "targets": 2, "width": "500px" },
{ "title": "Special code", "targets": 3, "width": "300px" }
]
});
... if scrollX is enabled, the scrolling is enabled just if the columns are too small. And I want the scrolling enaled always, and the columns not changing their width.
Any idea about how to force the column width?
The same question was asked here but has no answer: https://datatables.net/forums/discussion/31403/scrollx-not-work-with-fixed-column-width
First disable autoWidth -> https://datatables.net/reference/option/autoWidth
In my humble opinion columns.width are useless to anything than relative percentages. Define minimum column widths in CSS instead
#products td:nth-child(1) { min-width: 350px; }
#products td:nth-child(3) { min-width: 500px; }
#products td:nth-child(4) { min-width: 300px; }
http://jsfiddle.net/f8uw6rLy/

nwjs / node webkit display scrollbars

For some reason it doesn't show me any scrollbars.
The overflowing content is simply hidden.
Middle-clicking with the mouse allows to scroll. It's just that the scrollbars are hidden.
Tried with CSS:
body: {
overflow-x: scroll;
overflow-y: scroll;
}
The above displays a disabled/useless scrollbars, that is I resize the window but the scrollbars stay nonfunctional.
This issue is barely mentioned online.
Using nwjs-v0.12.3-win-x64.
Does anyone know a solution? I just want simple scrollbars.
The complete code is on: https://jsfiddle.net/rtk1ebg1/
package.json:
{
"name": "hello",
"main": "index.html",
"window": {
"title": "Hey!",
"icon": "icon.png",
"toolbar": true,
"position": "center"
}
}
Try
body {
overflow: scroll;
}
Edited(forgot the main lines)
body {
height: 100%;
overflow: hidden;
width: 100%;
}

Smartclient: menu aligned right makes page wider

I'm using Smartclient, v 8.2 (LGPL).
I have a MenuButton that opens a Menu. The button is aligned right. the problem is that when the menu is displayed; the left side of the menu is aligned with the left side of the button, and there's no space for rendering the menu. As a result, when I click the menu button, the page becomes wider (horizontal scrollbar appears) in order to make space for rendering the menu. when the menu is hidden, the page returns to normal size.
is there any way to avoid this? What I would like is that the right side of the menu is aligned with the right side of the button.
I tried using the align property of the menu, but no matter what value I used, I always see the same behavior. Also I set overflow= "hidden", but still same problem.
this is small test case:
isc.Menu.create({
ID: "menu",
autoDraw: false,
showShadow: true,
shadowDepth: 10,
overflow: "hidden",
align: "right",
data: [
{title: "New", keyTitle: "Ctrl+N", icon: "icons/16/document_plain_new.png"},
{title: "Open", keyTitle: "Ctrl+O", icon: "icons/16/folder_out.png"},
{isSeparator: true},
{title: "Save", keyTitle: "Ctrl+S", icon: "icons/16/disk_blue.png"},
{title: "Save As", icon: "icons/16/save_as.png"}
]
});
isc.MenuButton.create({
ID: "menuButton",
autoDraw: false,
title: "File",
width: 100,
menu: menu
});
isc.HLayout.create({
width: "100%",
members: [
isc.Canvas.create({
width: "*",
height: 24,
backgroundColor: "lightgray"
}),
menuButton
]
})
I found the problem: if showShadow is set to true, then I see the issue described in the question. removing that attribute (default is false) solved the problem: menu is aligned to the right, and no scrollbars appear.