Skip to content

Commit

Permalink
fix: reload icons on hide explorer arrow value change
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Aug 14, 2024
1 parent 176c999 commit 8f1fac4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions extension/build/get-hide-explorer-arrow-value.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { workspace } from 'vscode'

export let getHideExplorerArrowValue = (): boolean =>
workspace.getConfiguration('eyecons').get<boolean>('hideExplorerArrows') ??
true
6 changes: 2 additions & 4 deletions extension/build/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { setTimeout } from 'node:timers/promises'
import { workspace } from 'vscode'
import fs from 'node:fs/promises'
import path from 'node:path'
import os from 'node:os'

import { getHideExplorerArrowValue } from './get-hide-explorer-arrow-value'
import { generateThemeData } from './generate-theme-data'
import { generateIcons } from './generate-icons'
import { setupLoading } from './setup-loading'
Expand All @@ -20,9 +20,7 @@ export let build = async (): Promise<void> => {
let iconDefinitions = await generateIcons({ tmpDir })
let themeData = generateThemeData()

let hidesExplorerArrows =
workspace.getConfiguration('eyecons').get<boolean>('hideExplorerArrows') ??
true
let hidesExplorerArrows = getHideExplorerArrowValue()

let schema = {
folderNamesExpanded: {},
Expand Down
11 changes: 8 additions & 3 deletions extension/build/validate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'node:fs/promises'
import path from 'node:path'

import { getHideExplorerArrowValue } from './get-hide-explorer-arrow-value'
import { getFolderValue } from './get-folder-value'
import { getThemeValue } from './get-theme-value'
import { baseIcons } from '../../data/base-icons'
Expand All @@ -14,16 +15,20 @@ export let validate = async (): Promise<boolean> => {
let schema = path.join(destDir, 'index.json')
console.log('Validating schema', schema)

let schemaVale = await fs.readFile(schema, 'utf-8')
if (!schemaVale) {
let schemaValue = await fs.readFile(schema, 'utf-8')
if (!schemaValue) {
return false
}

let theme = await getThemeValue()
let folderValue = getFolderValue()
let schemaJson = JSON.parse(schemaVale)
let schemaJson = JSON.parse(schemaValue)
let fileNames: string[] = []

if (schemaJson.hideExplorerArrows !== getHideExplorerArrowValue()) {
return false
}

for (let { id } of [baseIcons, fileIcons].flat()) {
let iconHash = generateHash(id, theme, folderValue)
let iconDefinition: { iconPath: string } | undefined =
Expand Down

0 comments on commit 8f1fac4

Please sign in to comment.