From be7f45066802c8f2050436f618d095c435fe3916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=AE=89=E7=B5=AE?= <74345648+ChengAnXu2014@users.noreply.github.com> Date: Fri, 30 Apr 2021 18:29:53 +0800 Subject: [PATCH] Edited Indentation Options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Edited the section of 《Indentation Options》。 Add some detailed usages and examples. --- docs/reference/metadata.md | 100 +++++++++++++++++++++++++++++++++---- 1 file changed, 91 insertions(+), 9 deletions(-) diff --git a/docs/reference/metadata.md b/docs/reference/metadata.md index 172c6f1d..4acd64da 100644 --- a/docs/reference/metadata.md +++ b/docs/reference/metadata.md @@ -175,37 +175,77 @@ Indentation options control aspects of the auto-indentation mechanism. `increaseIndentPattern` : *Regex.* If it matches on the current line, - the next line will be indented one level further. + lines after current line will be indented one level further. + + If in `.tmPreferences`: ```xml increaseIndentPattern - insert regex here + + ``` + + Then in `view`: + + ``` + line1 + line2 + increase + after increase1 + after increase2 ``` `decreaseIndentPattern` : *Regex.* If it matches on the current line, - the next line will be unindented one level. + current line and lines after current line will be unindented one level. + + If in `.tmPreferences`: ```xml decreaseIndentPattern - insert regex here + + ``` + + Then in `view`: + + ``` + line1 + line2 + decrease + after decrease1 + after decrease2 ``` `bracketIndentNextLinePattern` : *Regex.* If it matches on the current line, - only the next line will be indented one level further. + only the next non-whitespace line will be indented one level further. + + If in `.tmPreferences`: ```xml bracketIndentNextLinePattern - insert regex here + + ``` + + Then in `view`: + + ``` + line1 + line2 + line3 + bracket + + first non-whitespace line after bracket + after bracket2 + after bracket3 ``` `disableIndentNextLinePattern` : *Regex.* If it matches on the current line, the next line will not be indented further. + Deprecated in ST3, use unIndentedLinePattern instead. ```xml disableIndentNextLinePattern @@ -214,15 +254,57 @@ Indentation options control aspects of the auto-indentation mechanism. `unIndentedLinePattern` : *Regex.* + If the `increaseIndentPattern` and/or `decreaseIndentPattern` *Regex.* also matches on the current line. The auto-indenter will ignore - lines matching this regex - when computing the next line's indentation level. + the effects made by `increaseIndentPattern` and/or `decreaseIndentPattern` + when computing the indentation level of lines after current line. + + If in `.tmPreferences`: ```xml + increaseIndentPattern + unIndentedLinePattern - insert regex here + ``` + Then in `view`: + + ```xml + lineone only match increaseIndentPattern's Regex effects made + after lineone1 + after lineone2 + linetwo only match increaseIndentPattern's Regex effects made + after linetwo1 + after linetwo2 + unindented both match increaseIndentPattern and unIndentedLinePattern's Regex effects ignored + after unindented1 + after unindented2 + ``` + + If in `.tmPreferences`: + + ```xml + decreaseIndentPattern + + unIndentedLinePattern + + ``` + + Then in `view`: + + ```xml + 0START0 + lineone only match decreaseIndentPattern's Regex effects made + after lineone1 + after lineone2 + linetwo only match decreaseIndentPattern's Regex effects made + after linetwo1 + after linetwo2 + unindented both match decreaseIndentPattern and unIndentedLinePattern's Regex effects ignored + after unindented1 + after unindented2 + ``` ### Completions Options