-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
New insert snippet option to exclude extra indentation #5155
New insert snippet option to exclude extra indentation #5155
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #5155 +/- ##
==========================================
+ Coverage 86.84% 86.94% +0.10%
==========================================
Files 558 560 +2
Lines 43734 44232 +498
Branches 6793 6854 +61
==========================================
+ Hits 37980 38457 +477
- Misses 5754 5775 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
src/snippets.js
Outdated
@@ -493,16 +493,16 @@ var SnippetManager = function() { | |||
tabstopManager.addTabstops(processedSnippet.tabstops, range.start, end, selectionId); | |||
}; | |||
|
|||
this.insertSnippet = function(editor, snippetText, replaceRange) { | |||
this.insertSnippet = function(editor, snippetText, replaceRange, removeExtraIndent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this feature flag kind of removeExtraIndent
a config option in autocomplete or similar instead of passing it through functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it needs to be passed per invocation to choose if indentation is needed, as snippets may or may not have indentation already
Considering that Line 1037 in c7d691d
Line 496 in c7d691d
{indent: false, range: undefined} ?
|
Missed that piece, yeah that sounds better instead of adding more parameters. I'll update it.
Good point, |
Looks good, Thank you. |
Personally I prefer the current one just because by default we add those indentations and it removes the need to explicitly type default arguments like
I think changing to |
Issue #, if available: N/A
Description of changes:
By default, when item is inserted, ace will modify snippet and add indentation to match previous code line. However some tooling may already include the proper indent format, thus creating improperly indented code when inserted. This change adds the option to exclude those extra indentations.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.