Skip to content

Commit 6789c80

Browse files
committed
Standardize variable naming, equality operators, and button tooltip strings
1 parent bf3711f commit 6789c80

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

packages/vscode/src/view/backend/message-handlers/handle-show-history-quick-pick.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -164,26 +164,26 @@ export const handle_show_history_quick_pick = async (
164164
quick_pick.items = items
165165

166166
if (history.length > 0) {
167-
const firstRecentItemIndex = items.findIndex((item, index) => {
168-
const recentSeparatorIndex = items.findIndex(
167+
const first_recent_item_index = items.findIndex((item, index) => {
168+
const recent_separator_index = items.findIndex(
169169
(i) =>
170-
i.label === 'recent' && i.kind == vscode.QuickPickItemKind.Separator
170+
i.label == 'recent' && i.kind == vscode.QuickPickItemKind.Separator
171171
)
172172
return (
173-
recentSeparatorIndex != -1 &&
174-
index > recentSeparatorIndex &&
173+
recent_separator_index != -1 &&
174+
index > recent_separator_index &&
175175
item.kind != vscode.QuickPickItemKind.Separator
176176
)
177177
})
178-
if (firstRecentItemIndex != -1) {
179-
quick_pick.activeItems = [items[firstRecentItemIndex]]
178+
if (first_recent_item_index != -1) {
179+
quick_pick.activeItems = [items[first_recent_item_index]]
180180
}
181181
} else if (pinned_history.length > 0) {
182-
const firstPinnedItemIndex = items.findIndex(
182+
const first_pinned_item_index = items.findIndex(
183183
(item) => item.kind !== vscode.QuickPickItemKind.Separator
184184
)
185-
if (firstPinnedItemIndex !== -1) {
186-
quick_pick.activeItems = [items[firstPinnedItemIndex]]
185+
if (first_pinned_item_index != -1) {
186+
quick_pick.activeItems = [items[first_pinned_item_index]]
187187
}
188188
}
189189

@@ -240,7 +240,7 @@ export const handle_show_history_quick_pick = async (
240240
const current_pinned_history = get_sorted_pinned_history()
241241
if (button_tooltip == 'Move up') {
242242
const current_index = current_pinned_history.findIndex(
243-
(p) => p.text === item_text
243+
(p) => p.text == item_text
244244
)
245245
if (current_index > 0) {
246246
;[
@@ -257,7 +257,7 @@ export const handle_show_history_quick_pick = async (
257257
}
258258
} else if (button_tooltip == 'Move down') {
259259
const current_index = current_pinned_history.findIndex(
260-
(p) => p.text === item_text
260+
(p) => p.text == item_text
261261
)
262262
if (current_index < current_pinned_history.length - 1) {
263263
;[
@@ -272,9 +272,9 @@ export const handle_show_history_quick_pick = async (
272272
current_pinned_history
273273
)
274274
}
275-
} else if (button_tooltip == 'Add to Pinned Prompts') {
276-
if (!current_pinned_history.some((p) => p.text === item_text)) {
277-
const entry_to_pin = history.find((h) => h.text === item_text)
275+
} else if (button_tooltip == 'Add to pinned') {
276+
if (!current_pinned_history.some((p) => p.text == item_text)) {
277+
const entry_to_pin = history.find((h) => h.text == item_text)
278278
if (entry_to_pin) {
279279
current_pinned_history.push(entry_to_pin)
280280
await provider.context.workspaceState.update(
@@ -283,9 +283,9 @@ export const handle_show_history_quick_pick = async (
283283
)
284284
}
285285
}
286-
} else if (button_tooltip == 'Remove from Pinned Prompts') {
286+
} else if (button_tooltip == 'Remove from pinned') {
287287
const index = current_pinned_history.findIndex(
288-
(p) => p.text === item_text
288+
(p) => p.text == item_text
289289
)
290290
if (index != -1) {
291291
current_pinned_history.splice(index, 1)
@@ -294,8 +294,8 @@ export const handle_show_history_quick_pick = async (
294294
current_pinned_history
295295
)
296296
}
297-
} else if (button_tooltip == 'Remove from Recent Prompts') {
298-
const index = history.findIndex((h) => h.text === item_text)
297+
} else if (button_tooltip == 'Remove from recent') {
298+
const index = history.findIndex((h) => h.text == item_text)
299299
if (index != -1) {
300300
history.splice(index, 1)
301301
await provider.context.workspaceState.update(history_key, history)
@@ -350,7 +350,7 @@ export const handle_show_history_quick_pick = async (
350350
to_quick_pick_item(
351351
item,
352352
'recents',
353-
updated_pinned_history.some((p) => p.text === item.text),
353+
updated_pinned_history.some((p) => p.text == item.text),
354354
undefined
355355
)
356356
)

0 commit comments

Comments
 (0)