Skip to content

Commit

Permalink
remove file extension from labels in the prompt attachment selection …
Browse files Browse the repository at this point in the history
…dialog (#239116)

[prompts]: remove file extension from labels in the prompt attachment selection dialog
  • Loading branch information
legomushroom authored Jan 29, 2025
1 parent 8c5563e commit b3f0b18
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Codicon } from '../../../../../base/common/codicons.js';
import { KeyCode, KeyMod } from '../../../../../base/common/keyCodes.js';
import { Schemas } from '../../../../../base/common/network.js';
import { isElectron } from '../../../../../base/common/platform.js';
import { dirname } from '../../../../../base/common/resources.js';
import { basename, dirname } from '../../../../../base/common/resources.js';
import { compare } from '../../../../../base/common/strings.js';
import { ThemeIcon } from '../../../../../base/common/themables.js';
import { URI } from '../../../../../base/common/uri.js';
Expand Down Expand Up @@ -52,6 +52,7 @@ import { ChatRequestAgentPart } from '../../common/chatParserTypes.js';
import { IChatVariableData, IChatVariablesService } from '../../common/chatVariables.js';
import { ILanguageModelToolsService } from '../../common/languageModelToolsService.js';
import { PromptFilesConfig } from '../../common/promptSyntax/config.js';
import { PROMPT_SNIPPET_FILE_EXTENSION } from '../../common/promptSyntax/contentProviders/promptContentsProviderBase.js';
import { IChatWidget, IChatWidgetService, IQuickChatService, showChatView, showEditsView } from '../chat.js';
import { imageToHash, isImage } from '../chatPasteProviders.js';
import { isQuickChat } from '../chatWidget.js';
Expand Down Expand Up @@ -947,9 +948,11 @@ const selectPromptAttachment = async (options: ISelectPromptOptions): Promise<vo
const files = await promptInstructions.listNonAttachedFiles()
.then((files) => {
return files.map((file) => {
const fileBasename = basename(file);
const fileWithoutExtension = fileBasename.replace(PROMPT_SNIPPET_FILE_EXTENSION, '');
const result: IQuickPickItem & { value: URI } = {
type: 'item',
label: labelService.getUriBasenameLabel(file),
label: fileWithoutExtension,
description: labelService.getUriLabel(dirname(file), { relative: true }),
tooltip: file.fsPath,
value: file,
Expand Down

0 comments on commit b3f0b18

Please sign in to comment.