Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Insert Adjustment Setting and Limit Insert to once #197

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NotMyself
Copy link
Contributor

@NotMyself NotMyself commented Sep 2, 2021

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
Copy link
Contributor Author

@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
Copy link

Looking forward to this functionality!

@kazemicode
Copy link

Would love to see this functionality integrated into the plugin

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.

Line adjustment on code insert does not update selection Insert Code - can repeat insert multiple times
3 participants