path -> uri: core, share slash command

This commit is contained in:
Dallin Romney 2024-12-12 11:53:14 -08:00
parent e0ba578411
commit 5846b32d61
3 changed files with 13 additions and 17 deletions

View file

@ -1,4 +1,7 @@
import fs from "fs";
import { homedir } from "node:os";
import { fileURLToPath } from "node:url";
import path from "path";
import { languageForFilepath } from "../../autocomplete/constants/AutocompleteLanguageInfo.js";
import { SlashCommand } from "../../index.js";
@ -77,7 +80,7 @@ const ShareSlashCommand: SlashCommand = {
// folders are included. We default to using the first item in the list, if
// it exists.
const workspaceDirectory = workspaceDirs?.[0] || "";
outputDir = outputDir.replace(/^./, workspaceDirectory);
outputDir = outputDir.replace(/^./, fileURLToPath(workspaceDirectory));
}
if (!fs.existsSync(outputDir)) {

View file

@ -59,7 +59,3 @@ export function ctxItemToRifWithContents(
return rif;
}
// export function codeContextItemToMarkdownSource(
// item: ContextItemWithId,
// ): string {}

View file

@ -732,21 +732,18 @@ export class Core {
// URI TODO is this equality statement valid?
const filePath = getFullPath(uri);
if (filePath === getConfigJsonPath()) {
// Trigger a toast notification to provide UI feedback that config
// has been updated
// Trigger a toast notification to provide UI feedback that config has been updated
const showToast =
this.globalContext.get("showConfigUpdateToast") ?? true;
if (showToast) {
void this.ide.showToast("info", "Config updated");
// URI TODO - this is a small regression - add core -> toast functionality that handles responses to update global context here
// vscode.window
// .showInformationMessage("Config updated", "Don't show again")
// .then((selection) => {
// if (selection === "Don't show again") {
// this.globalContext.update("showConfigUpdateToast", false);
// }
// });
const selection = await this.ide.showToast(
"info",
"Config updated",
"Don't show again",
);
if (selection === "Don't show again") {
this.globalContext.update("showConfigUpdateToast", false);
}
}
}