Skip to content

Commit ac29b28

Browse files
committed
chore: remove facilities for temporary files
Signed-off-by: Lorenz Leutgeb <[email protected]>
1 parent a669d86 commit ac29b28

File tree

6 files changed

+2
-78
lines changed

6 files changed

+2
-78
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- use more subtle styling when a reaction involves the local radicle identity (italic text vs border & background)
99
- show "you" instead of local identity's alias
1010
- on hover show the truncated DId next to each identity
11-
- **settings:** add config to toggle excluding temporary files created by the extension, e.g. those used to produce the diff of a patch's changed files, from the list of recently opened files. This is enabled by default. This currently works only partly, but should automatically be fully working when [the underlying VS Code bug](https://github.com/microsoft/vscode/issues/157395#issuecomment-2080293320) is fixed. ([#94](https://github.com/cytechmobile/radicle-vscode-extension/issues/94))
1211
- **patch-list:** show diff for copied and moved files of a patch too when available ([#100](https://github.com/cytechmobile/radicle-vscode-extension/issues/100))
1312
- **patch-list:** show path to containing directory for each changed file of a patch ([#100](https://github.com/cytechmobile/radicle-vscode-extension/issues/100))
1413
- **patch-list:** feat(patch-list): increase count of fetched patches per status to 500 ([#100](https://github.com/cytechmobile/radicle-vscode-extension/issues/100))

package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,6 @@
443443
}
444444
],
445445
"configuration": [
446-
{
447-
"properties": {
448-
"radicle.hideTempFiles": {
449-
"scope": "application",
450-
"type": "boolean",
451-
"default": "true",
452-
"description": "Exclude temporary files generated by the extension (e.g. old/new versions of files changed in patches) from being listed among the recently opened or in search."
453-
}
454-
}
455-
},
456446
{
457447
"title": "Advanced",
458448
"properties": {

src/constants.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/helpers/config.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export interface ExtensionConfig {
1313
'radicle.advanced.pathToRadBinary': string
1414
'radicle.advanced.pathToNodeHome': string
1515
'radicle.advanced.httpApiEndpoint': string
16-
'radicle.hideTempFiles': boolean
1716
}
1817

1918
/**
@@ -33,10 +32,7 @@ export function getConfig<K extends keyof ExtensionConfig>(
3332
case 'radicle.advanced.httpApiEndpoint':
3433
// if the config has the value of the empty string (default) then return `undefined`
3534
// @ts-expect-error
36-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
3735
return config.get<ExtensionConfig[K]>(configKey)?.trim() || undefined
38-
case 'radicle.hideTempFiles':
39-
return config.get<ExtensionConfig[K]>(configKey)
4036
default:
4137
return assertUnreachable(configKey)
4238
}
@@ -56,8 +52,6 @@ export function setConfig<K extends keyof ExtensionConfig>(
5652
case 'radicle.advanced.pathToNodeHome':
5753
case 'radicle.advanced.httpApiEndpoint':
5854
return config.update(configKey, value, ConfigurationTarget.Global)
59-
case 'radicle.hideTempFiles':
60-
return config.update(configKey, value, ConfigurationTarget.Global)
6155
default:
6256
return assertUnreachable(configKey)
6357
}

src/helpers/configWatcher.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { workspace } from 'vscode'
22
import {
3-
validateHideTempFilesConfigAlignment,
43
validateHttpdConnection,
54
validateRadCliInstallation,
65
validateRadicleIdentityAuthentication,
@@ -52,11 +51,6 @@ const configWatchers = [
5251
usePatchStore().resetAllPatches()
5352
},
5453
},
55-
{
56-
configKey: 'radicle.hideTempFiles',
57-
onConfigChange: validateHideTempFilesConfigAlignment,
58-
onBeforeWatcherRegistration: validateHideTempFilesConfigAlignment,
59-
},
6054
] satisfies OnConfigChangeParam[]
6155

6256
/**
@@ -65,7 +59,6 @@ const configWatchers = [
6559
*/
6660
export function registerAllConfigWatchers(): void {
6761
configWatchers.forEach((cw) => {
68-
cw.onBeforeWatcherRegistration?.()
6962
onConfigChange(cw.configKey, cw.onConfigChange)
7063
})
7164
}

src/ux/settings.ts

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { sep } from 'node:path'
2-
import { ConfigurationTarget, commands, workspace } from 'vscode'
3-
import { extTempDir } from '../constants'
4-
import { getConfig } from '../helpers'
5-
import { log } from '../utils'
1+
import { commands, workspace } from 'vscode'
2+
import type { getConfig } from '../helpers'
63

74
/**
85
* Opens the Settings UI with the options filtered to show only the specified config
@@ -19,48 +16,3 @@ export function openSettingsFocusedAtConfig(config: Parameters<typeof getConfig>
1916
config,
2017
)
2118
}
22-
23-
/**
24-
* Checks extension config for user's desired behaviour and ensure's the
25-
* native vscode config is set to match.
26-
*/
27-
export function validateHideTempFilesConfigAlignment() {
28-
const excludeGlob = `${extTempDir}${sep}**`
29-
30-
const shouldExclude = getConfig('radicle.hideTempFiles')
31-
32-
const searchExcludeConfigKey = 'search.exclude'
33-
const searchExcludeConfig = workspace.getConfiguration().get<object>(searchExcludeConfigKey)
34-
35-
if (!searchExcludeConfig) {
36-
log(
37-
`Didn't find any configuration for key "${searchExcludeConfigKey}". Bailing validation of config alignment.`,
38-
'warn',
39-
)
40-
41-
return
42-
}
43-
44-
const isAlreadyConfigedToExclude = Boolean(
45-
Object.entries(searchExcludeConfig).find(
46-
([key, value]) => key === excludeGlob && value === true,
47-
),
48-
)
49-
50-
if (shouldExclude && !isAlreadyConfigedToExclude) {
51-
const newSearchExcludeConfig = { ...searchExcludeConfig, [excludeGlob]: true }
52-
workspace
53-
.getConfiguration()
54-
.update(searchExcludeConfigKey, newSearchExcludeConfig, ConfigurationTarget.Global)
55-
} else if (!shouldExclude && isAlreadyConfigedToExclude) {
56-
// @ts-expect-error Type '{}' has no matching index signature for type 'string'.
57-
const { [excludeGlob]: _, ...searchExcludeConfigWithoutExcludeGlob } = searchExcludeConfig
58-
workspace
59-
.getConfiguration()
60-
.update(
61-
searchExcludeConfigKey,
62-
searchExcludeConfigWithoutExcludeGlob,
63-
ConfigurationTarget.Global,
64-
)
65-
}
66-
}

0 commit comments

Comments
 (0)