Skip to content
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

Auto completion for links to headings / sections in other files #894

Open
gavbarnett opened this issue Feb 3, 2021 · 4 comments
Open

Auto completion for links to headings / sections in other files #894

gavbarnett opened this issue Feb 3, 2021 · 4 comments
Labels
Area: Auto completion Code completion and suggestion, aka IntelliSense. Area: Link (Reserved) Markdown link processing, URI recognition, slugification. Help wanted Looking for help. Issue: Feature Something brand new. Needs Discussion We haven't decided what to do.

Comments

@gavbarnett
Copy link
Contributor

gavbarnett commented Feb 3, 2021

Proposal

When adding a link to a local file autocomplete should be implemented on section headers. This currently works within files but not across files.

The autocomplete on section would appear only after the "#" was typed.

[link to mysection in myfile](/myfile#mysection)

This is similar to other add-ons that autocomplete functions from other files if those files are included. By virtue of getting to this point below the file could be considered included within the link scope and the section headers listed.

[link to mysection in myfile](/myfile#      )
@yzhang-gh
Copy link
Owner

We need to somehow unify

} else if (/\[[^\]]*\]\(#[^\)]*$/.test(lineTextBefore)) {
/* ┌───────────────────────────┐
│ Anchor tags from headings │
└───────────────────────────┘ */

and

} else if (/\[[^\]]*?\]\([^\)]*$/.test(lineTextBefore)) {
/* ┌────────────┐
│ File paths │
└────────────┘ */

@yzhang-gh yzhang-gh added Area: Auto completion Code completion and suggestion, aka IntelliSense. Issue: Enhancement Improvements in existing features. labels Feb 4, 2021
@Lemmingh
Copy link
Collaborator

Lemmingh commented Feb 4, 2021

We have no idea about how target rendering system understands URIs.

There is no uniform practice.

I remember to see similar requests before.


IMHO, as an ordinary text editor (not a specialized one), features, of course including path completion, should only work for globally accepted conventions.

An alternative solution is adding another section (ILinkDefinitionProvider) to the plugin draft. But seeing the tight budget that highlight.js faces nowadays, I am hesitant about it. We've got three urgently needed systems (IExportingActionProvider, IHeadingInfoProvider, IMathRenderingProvider) to design.

@Lemmingh Lemmingh added Res: Out of scope Issue: Feature Something brand new. Help wanted Looking for help. and removed Issue: Enhancement Improvements in existing features. Res: Out of scope labels Feb 4, 2021
@yzhang-gh yzhang-gh added the Needs Discussion We haven't decided what to do. label Feb 4, 2021
@yzhang-gh
Copy link
Owner

I think this feature can be useful (although I don't think it will be done in a near future).

@hellt
Copy link

hellt commented Jul 12, 2021

it seems there is an extension that does that - https://marketplace.visualstudio.com/items?itemName=TomasHubelbauer.vscode-markdown-link-suggestions. Maybe that will help?

And I also miss this functionality very much, as cross-file cross-heading links are part of any decent documentation

@Lemmingh Lemmingh added the Area: Link (Reserved) Markdown link processing, URI recognition, slugification. label Sep 19, 2021
@Lemmingh Lemmingh changed the title Section link to other files autocomplete Auto completion for links to headings / sections in other files Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Auto completion Code completion and suggestion, aka IntelliSense. Area: Link (Reserved) Markdown link processing, URI recognition, slugification. Help wanted Looking for help. Issue: Feature Something brand new. Needs Discussion We haven't decided what to do.
Projects
None yet
Development

No branches or pull requests

4 participants