microsoft / codetour

VS Code extension that allows you to record and play back guided tours of codebases, directly within the editor.
https://aka.ms/codetour
MIT License
4.36k stars 113 forks source link

Disable Insert Adjustment Setting and Limit Insert to once #197

Open NotMyself opened 3 years ago

NotMyself commented 3 years ago

Fixes #196 Fixes #187

This PR fixes a couple of issues we were running into this week.

  1. Inserting code causes the tour step line numbers to get out of sync with the step selection.
  2. The line adjustment that is done can cause inappropriate updates to the tour files.
  3. Code can be inserted multiple times potentially causing an issue.

To fix these things, the following updates were made.

  1. added a new setting codetour.adjustOnInsertCodeSnippet.
  2. command codetour.insertCodeSnippet checks setting prior to doing any adjustments.
  3. command codetour.insertCodeSnippet checks the line of text at the insert location to see if the code block already contains that line. If so, it early outs due to the code already being inserted prior.
NotMyself commented 3 years ago

@lostintangent take a look at this method of detecting duplicate inserts. I think it works as expected. But I am unsure if pulling the entire contents of the doc to do a comparison is the best approach.

jesposito commented 3 years ago

Looking forward to this functionality!

kazemicode commented 2 years ago

Would love to see this functionality integrated into the plugin