Closed sandrock closed 2 years ago
Configuration files are read from directories in a project when that folder is open in VS Code. It seems like maybe you do not have a project open and are just opening loose Markdown files, in which case it uses only the user-level configuration you might have set in VS Code's Settings.
Also, the configuration for MD003's style
parameter is incorrect; it should be: https://github.com/DavidAnson/markdownlint/blob/f87f9d080002281d96ac32f119d8c99c028a6ddb/test/headings_good_setext_with_atx.json
You also seem to be running an old version of the extension. One of the INFO messages you show was removed from the code in March of 2021.
Using:
Visual Studio Code 1.52.1
with extension markdownlint v0.40.3 (fresh install)
on Window 10.
It seems like maybe you do not have a project open and are just opening loose Markdown files,
Yes.
in which case it uses only the user-level configuration you might have set in VS Code's Settings.
Oh.
So I created a user-levle configuration and it works. Thanks.
Is there any possibility to make the extension work when a folder is not open in Code?
Great! Without a directory open in Code, the extension doesn't know how far up the tree to look for configuration files. If it looked only in the current directory, it would apply the wrong settings sometimes. Opening a directory is a clear indication to this extension and others what the extent of a project is. Code itself stores workspace settings in ./.vscode
of a project and only knows where that is when a directory is open.
I understand the settings lookup process is done when a workspace is open. I would like to know what could go wrong if a similar process was implemented for when no workspace is open.
Code could look at each parent folder until it finds one of the known configuration file?
Why can't it look far up the tree to look for configuration files?
Okay. Thanks!
I'd like to point out that the current behavior is potentially problematic for multi-root workspaces, and that ideally tools like markdownlint should also include parent directories of a workspace folder when attempting to resolve config files.
Take this simplified example of a monorepo:
/repo
.markdownlint.jsonc
/project-a
/project-b
..
/project-z
It's feasible to configure a multi-root workspace where only some of the subprojects are configured as workspace folders:
// repo.code-workspace
{
"folders": ["/.../repo", "/.../repo/project-b", "/.../repo/project-x"]
}
This means that currently in the above example, linting is broken in project-b
and project-x
workspace folders because the repo root config file is in a parent of the workspace folder root.
Configuration files are able to reference things above the folder, root directory. That should be adequate for the scenario described here.
Hello, I'm trying to use the VS Code extension and cannot get the configuration file to work.
I have this log information from VS code:
I have configuration files at location
c:\Users\me\dd\project-xyz
andc:\Users\me\dd\project-abc
. I tried many formats:.markdownlint.cjs
.markdownlint.json
.markdownlint.yaml
VS code still shows me the warnings that I want to disable.
What am I doing wrong?