Make typing | while creating a link autocomplete the selected file path

Use case or problem

When creating an internal wikilink, the dropdown of matching files appears. If you type # with a file highlighted, that file title gets autocompleted into the link, which is really handy.

If you type | to add custom text while a file or block is highlighted, it just keeps the characters you have already typed and types the |.

Proposed solution

It would be a nice shortcut if typing | worked like typing # does and autocompleted the highlighted file or block link.

Example

If I’m trying to link to my daily note 2022-01-21, typing [[2022-01 and then highlighting the note title and typing # will fill in [[2022-01-21# and start the block search,

If I type [[2022-01 and then highlight the note title and type |, it just leaves [[2022-01|.

Related feature requests

This request to automatically add a | after hitting Tab while creating a link is somewhat related; although it is about adding a | automatically instead of adding text automatically when | is typed.

it’s implemented this way otherwise you couldn’t (easily) add an alias to a non existing note.