marksman icon indicating copy to clipboard operation
marksman copied to clipboard

code-action: TOC improvements

Open keynmol opened this issue 2 years ago • 1 comments

Closes #19

  1. Double indent links in TOC - otherwise they're not rendered as nested lists at all
  2. Enable YAML frontmatter parsing, and propagate it into the document index
  3. Add logic to decide an insertion point for TOC - under yaml front matter, at document beginning, under the single h1 title
  4. Refactor and extract code action logic away from Server
  5. Add helpers and tests to actually assert on the document contents after inserting TOC

TODO

  • [ ] Tests that iteratively invoking code action does not add any more newlines (this is premonition - I'm pretty sure it's broken now :-/)

keynmol avatar Jun 10 '22 15:06 keynmol

@keynmol I checked out locally to try things out. I think something got lost during rebase, as all this insertion logic from CodeActions.fs is not wired into Server.fs and is used only inside tests.

artempyanykh avatar Aug 14 '22 09:08 artempyanykh

@artempyanykh This should be ready for review/another manual test

keynmol avatar Aug 25 '22 09:08 keynmol

@keynmol could you rebase on the latest main please?

artempyanykh avatar Aug 25 '22 09:08 artempyanykh

Done

keynmol avatar Aug 25 '22 09:08 keynmol

image

artempyanykh avatar Aug 25 '22 09:08 artempyanykh

keynmol avatar Aug 25 '22 17:08 keynmol

Awesome! I did a bit of testing and it worked great. There was just one case where TOC ate a new line 2022-08-25 20 14 58

LMK if you'd like to merge as is or fix the issue.

artempyanykh avatar Aug 25 '22 19:08 artempyanykh

I'd rather merge as is (as long as it doesn't lines repeatedly), and then add this case to the tests with some other testing infra improvements

keynmol avatar Aug 25 '22 19:08 keynmol

image

artempyanykh avatar Aug 25 '22 19:08 artempyanykh