Skip to content

Add toc config#447

Merged
artempyanykh merged 1 commit intoartempyanykh:mainfrom
ficd0:add-toc-config
Jan 26, 2026
Merged

Add toc config#447
artempyanykh merged 1 commit intoartempyanykh:mainfrom
ficd0:add-toc-config

Conversation

@ficd0
Copy link
Copy Markdown
Contributor

@ficd0 ficd0 commented Dec 7, 2025

Added config option code_action.toc.include which is a list of integers. This is
the new default:

[code_action]
# Enable/disable "Table of Contents" code action
toc.enable = true
# Heading levels to include when generating a Table of Contents
toc.include = [1, 2, 3, 4, 5, 6]

These are the heading levels that will be included when generating a Table of
Contents. Keeping the default setting results in identical behavior to before.
However, changing the array allows us to exclude certain levels from the TOC.

I updated tests accordingly. This PR partially implements #91.

Asciicast demo available:

asciicast

Copy link
Copy Markdown
Owner

@artempyanykh artempyanykh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thanks for the contribution @ficd0!

The change looks good to me, modulo a few suggested improvements. Let me know if you want to address those.

@ficd0
Copy link
Copy Markdown
Contributor Author

ficd0 commented Jan 25, 2026

I'm happy to address them, thanks for the helpful review comments. I'll mark ping you here when it's ready for review. 🙂

@ficd0 ficd0 marked this pull request as draft January 25, 2026 18:00
Added config option code_action.toc.include which is a list of integers.
These are the heading levels that will be included when generating a
Table of Contents. Updated tests accordingly. Partially implements artempyanykh#91
@ficd0 ficd0 marked this pull request as ready for review January 25, 2026 18:44
@ficd0
Copy link
Copy Markdown
Contributor Author

ficd0 commented Jan 25, 2026

@artempyanykh ready for review, thanks for all the guidance! I have some experience with OCaml but it's my first time programming in F#

@artempyanykh artempyanykh merged commit ece1e6b into artempyanykh:main Jan 26, 2026
3 checks passed
@artempyanykh
Copy link
Copy Markdown
Owner

Thanks for the contribution @ficd0!

@ficd0
Copy link
Copy Markdown
Contributor Author

ficd0 commented Jan 26, 2026

Thanks for the merge and for fixing my mistakes in the next commit. I'm too used to 1. Ocaml syntax for type constructors like int array and 2. The ocaml compiler yelling at me for unused bindings like in Rust.

Since F# allows type cons syntax as well as cons<type>, it really throws me off. Is it possible to get the linter to point these out? Same with unused bindings?

P.S. getting my development environment set up and figuring out how to run tests, formatting etc. Was a bit challenging. I think some contributor documentation would be super helpful for new contributors!

@artempyanykh
Copy link
Copy Markdown
Owner

@ficd0 no worries at all, appreciate the contribution! Agreed that contributor's guide would be helpful.
On the linters side, I found tooling somewhat lacking, sadly. I'll try to find time to give it another go in case there were improvements to fsharplint and/or some compiler flags to yell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants