codetour
codetour copied to clipboard
Disable Insert Adjustment Setting and Limit Insert to once
Fixes #196 Fixes #187
This PR fixes a couple of issues we were running into this week.
- Inserting code causes the tour step line numbers to get out of sync with the step selection.
- The line adjustment that is done can cause inappropriate updates to the tour files.
- Code can be inserted multiple times potentially causing an issue.
To fix these things, the following updates were made.
- added a new setting
codetour.adjustOnInsertCodeSnippet. - command
codetour.insertCodeSnippetchecks setting prior to doing any adjustments. - command
codetour.insertCodeSnippetchecks 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.
@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.
Looking forward to this functionality!
Would love to see this functionality integrated into the plugin