-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(modes): custom modes under custom path not showing #8499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
import { mkdir } from "fs/promises" | ||
import { join } from "path" | ||
import { ExtensionContext } from "vscode" | ||
|
||
export async function getGlobalFsPath(context: ExtensionContext): Promise<string> { | ||
return context.globalStorageUri.fsPath | ||
} | ||
import { getSettingsDirectoryPath } from "./storage" | ||
|
||
export async function ensureSettingsDirectoryExists(context: ExtensionContext): Promise<string> { | ||
const settingsDir = join(context.globalStorageUri.fsPath, "settings") | ||
await mkdir(settingsDir, { recursive: true }) | ||
return settingsDir | ||
// getSettingsDirectoryPath already handles the custom storage path setting | ||
return await getSettingsDirectoryPath(context.globalStorageUri.fsPath) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import * as path from "path" | |
import * as fs from "fs/promises" | ||
import { fileExistsAtPath } from "./fs" | ||
import { GlobalFileNames } from "../shared/globalFileNames" | ||
import { getSettingsDirectoryPath } from "./storage" | ||
import * as yaml from "yaml" | ||
|
||
const deprecatedCustomModesJSONFilename = "custom_modes.json" | ||
|
@@ -26,7 +27,7 @@ export async function migrateSettings( | |
] | ||
|
||
try { | ||
const settingsDir = path.join(context.globalStorageUri.fsPath, "settings") | ||
const settingsDir = await getSettingsDirectoryPath(context.globalStorageUri.fsPath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Using getSettingsDirectoryPath() here will create the settings directory before the existence check below. That makes the early-return branch ("No settings directory found, no migrations necessary") unreachable. Consider removing the existence check/log or computing the path without side effects before checking, so logs reflect actual conditions. |
||
|
||
// Check if settings directory exists first | ||
if (!(await fileExistsAtPath(settingsDir))) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.