Open MilesMcBain opened 1 week ago
probably related to #1387
It seems that there are two separate issues to be solved for Quarto support.
Problem 1 lies here: https://github.com/foambubble/foam/blob/master/packages/foam-vscode/src/core/model/workspace.ts#L72-L86
ListByIdentifier
can never match a file with an extension other than markdown at the moment. mdNeedle
won't match due to '.md' extension. needle
Can't match because it has no extension, while key
has an extension (e.g. '.qmd'). So links without extensions to non-md files seem to be always resolved as type 'placeholder' at present.
Problem 2 relates to #1387. For the [[
autocompletion to work the WikilinkCompletionProvider
needs to be associated with the 'quarto' language. In my hacked up solution I added it do the mdDocSelector
like:
export const mdDocSelector = [
{ language: 'markdown', scheme: 'file' },
{ language: 'markdown', scheme: 'untitled' },
{ language: 'quarto', scheme: 'file' },
{ language: 'quarto', scheme: 'untitled' },
];
This is not a great solution for you as you probably prefer not to explicitly maintain quarto related code. So a possible solution is to read languages from config, but then you have to configure two related pieces of config - the notes file extension, and the languages to provide language services for, and I can see people not understanding that as it feels like double entry.
Thanks @MilesMcBain - here are my comments:
needle
would match. Also, if you change the default extension to be qmd
even (the inappropriately named) mdNeedle
would give you a match- am I missing something?foam.selectors
or foam.languages
(need to think of a proper name)Re 1.:
I may be misunderstanding how the notes extensions config is meant to work. I had assumed if I configure qmd
in notes extensions, then I would be table to link to those files without an extension like I can do with md
files currently. I can confirm if I include the extension, then the link is resolved properly (not as a placeholder).
On my branch I hacked this in to try to make it work like I had imagined: https://github.com/MilesMcBain/foam/blob/9f1e07a39a0f25d06718ed5811e3ecfa3eefe4a5/packages/foam-vscode/src/core/model/workspace.ts#L86-L89
Which seemed to work okay for my usecase, but then a bunch of tests failed, so I couldn't make you a PR.
I think just rolling with the default as qmd will probably suit my needs so thanks for pointing out that option.
Yeah I feel that part of the codebase is a bit clunky, we are reviewing it as part of https://github.com/foambubble/foam/pull/1391 -
still, an identifier is basically the minimum reverse path that can uniquely locate a resource. e.g. a valid identifier to a file located in this/is/my/path/to/file.pdf
is [[file.pdf]]
or [[to/file.pdf]]
or [[path/to/file.pdf]]
, depending on whether there are other file.pdf
in the repo and what their path is.
So a [[file/to/project.qmd]]
or even [[project.qmd]]
will link a note to the qmd file.
Of course to treat that file as a note you need to configure Foam (although arguably that should just work out of the box and be part of the defaults)
Describe the bug
I have configured:
I have tried this configuration in my project local config, and global configuration in appropriate
settings.json
files.I cannot see any effect from this configuration. If I create a file with the
qmd
extension I cannot create links to it, and the link auto ompletion triggered by[[
does included it. From within the .qmd file wiki links are not highlighted and cannot be used to jump to other files.Small Reproducible Example
No response
Steps to Reproduce the Bug or Issue
"foam.files.notesExtensions": "qmd Qmd rmd Rmd"
quarto_test.qmd
.[[quarto_test]]
.quarto_test.md
Expected behavior
The links can be created to files with
.qmd
extension, and used to navigate to those files.Screenshots or Videos
No response
Operating System Version
Windows 11 22H2 22621.4169
Visual Studio Code Version
1.93.0
Additional context
Version: 1.93.0 (system setup) Commit: 4849ca9bdf9666755eb463db297b69e5385090e3 Date: 2024-09-04T13:02:38.431Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22621