microsoft / microsoft/vscode

Chat: allow an inline file reference to display a readable label instead of the raw basename

Open
#333,951 0 comments 0 reactions 1 assignee Claimed by @justschen View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Feature Request

### Problem

An inline reference always renders as the raw basename of the file:

```js
// addFileAndFolderEntries
const label = this.labelService.getUriBasenameLabel(uri);
const insert = `${prefix}file:${label}`; // "#file:" / "@file:"
```

There is no way to give it a different display text. `filterText` includes the relative path, so a badly named file can at least be *found* by path — but the string that lands in the prompt is the basename, verbatim.

The point of inline references (as opposed to attachment chips) is that they sit at a specific position in the sentence, so you can write

> compare the ownership section of `#file:tenancy-agreement.md` against `#file:house-rules.md`

instead of leaning on "this" / "that" and hoping the model binds the pronouns to the right chips.

That only works while the basename is readable. Documents exported from external systems routinely are not — a Confluence export lands as e.g. `Confluence_export_20260812_1234567890_.md`. Dropping that into the middle of a sentence destroys the readability that inline references exist to provide, and the reference is also long enough to make the surrounding prose hard to edit.

### Request

Let an inline file reference carry a display label distinct from the basename. Any of these would solve it:

1. Render the reference as a readable label (e.g. the Markdown H1 / frontmatter `title`, or a user-typed alias) while keeping the underlying URI in the variable data — the variable already stores `data: uri` separately from the inserted text, so the model would still receive the real file.
2. Allow the user to edit the label of an inserted reference in place.
3. Provide a `chat.*` setting to render inline references by a shorter or alternative form (e.g. path-relative stem without extension).

### Workarounds and why they fall short

- **Rename the file** — the export is regenerated, so this has to be re-applied every time; it also diverges the local name from the upstream page.
- **`#sym:`** — inserts the heading text, which reads well, but it attaches the symbol's range rather than the whole file, and `addSymbolEntries` sources candidates only from `outlineService.getCachedModels()` (no workspace-symbol fallback), so the file must already be open.
- **Hardlink under a nicer name** — duplicates the entry in the picker and breaks whenever the exporter writes by delete-then-create.

None of these is worth the upkeep for what is a presentation concern.

### Version

```
Version: 1.135.0 (user setup)
Commit: 08d4889f9ec4a1685d257b9b95de036c8e1ce1e5
Date: 2026-08-25T14:26:52Z
Electron: 42.8.1
OS: Windows_NT x64 10.0.26200
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.