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

Don't generate new note file when link targeting existing file is opened #1379

Open
per1234 opened this issue Aug 5, 2024 · 0 comments
Open
Labels
bug Something isn't working foam-core Related to API, core model or feature
Milestone

Comments

@per1234
Copy link

per1234 commented Aug 5, 2024

Is your feature request related to a problem? Please describe.

I have Markdown links to asset files which don't have an extension in my documents. For example:

Add [this file](assets/.editorconfig) to the root of the new project.

If I Ctrl+left click on this link markup in the editor, Foam generates a new .editorconfig.md file instead of just opening the existing .editorconfig file in an editor (as VS Code does when the Foam extension is not installed), and also changes the path in the link markup:

Add [this file](.editorconfig) to the root of the new project.

With files that have an extension, this behavior can at least be worked around by adding the file extension to the list in the extension's foam.files.attachmentExtensions setting. However, this is not possible for files that don't have an extension, which is common for "dotfile" configuration files.

Describe the solution you'd like

Don't create a new note file if the target of a Markdown link already exists. In this case, it is obvious the user intended the link to target that existing file so it is silly to instead create a note.

Even where it is possible to work around this via the foam.files.attachmentExtensions setting, it shouldn't be necessary to do that. Foam should be smart enough to understand that valid Markdown links should be left alone and used as-is.

Describe alternatives you've considered

An alternative would be to make the foam.files.attachmentExtensions setting more flexible (e.g., supporting globs).

I would also be satisfied if a new setting was added to disable this automatic document creation feature entirely as I don't find it to be of value for my particular use case.

Screenshots or Videos

No response

@riccardoferretti riccardoferretti added bug Something isn't working foam-core Related to API, core model or feature labels Aug 8, 2024
@riccardoferretti riccardoferretti added this to the backlog milestone Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working foam-core Related to API, core model or feature
Projects
None yet
Development

No branches or pull requests

2 participants