vscode-markdown icon indicating copy to clipboard operation
vscode-markdown copied to clipboard

"markdown.extension.toc.levels" is ignored when using multi-root workspace

Open whut opened this issue 10 months ago • 1 comments

What's the problem

When I add multiple folders to a Visual Studio Code workspace, I expect to settings from particular folder .vscode/settings.json be respected. This does not happen for markdown.extension.toc.levels.

What's the expected result

Markdown All-In-One should respect per-folder TOC level settings in multi-root workspace.

Maybe also other Markdown All-In-One settings should do that.

How to reproduce

  1. Create two folders, each containing a Markdown file with multiple header levels: with ##, ### and #### headers
  2. Open first folder in vscode and generate the TOC. It will just contain contain all header levels
  3. Open second folder in vscode, set in .vscode/settings.json: `"markdown.extension.toc.levels": "2..3" and generate the TOC
  4. Note that the TOC correctly contain only H2 and H3 levels
  5. Now open new Visual Studio Code instance, and add both folders to new workspace using File → Add Folder to Workspace...
  6. Update Table of Contents in both files
  7. Note that in the second folder, the TOC is regenerated with all header levels, even though the .vscode/settings.json is set just to H2 and H3

Other information

I do not know the topic, but looks like it happens because:

  1. markdown.extension.toc.levels in package.json does not set scope property, which then defaults to window.

  2. window scoped settings in multi-root workspaces are ignored

I hope this setting can be changed to be resource. Maybe some others also should.

whut avatar Apr 18 '24 14:04 whut