File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export default class Tokenizer {
32
32
private buildRulesBeforeParams ( cfg : TokenizerOptions ) : TokenRule [ ] {
33
33
return this . validRules ( [
34
34
{
35
- type : TokenType . BLOCK_COMMENT ,
35
+ type : TokenType . DISABLE_COMMENT ,
36
36
regex :
37
37
/ ( \/ \* * s q l - f o r m a t t e r - d i s a b l e * \* \/ [ \s \S ] * ?(?: \/ \* * s q l - f o r m a t t e r - e n a b l e * \* \/ | $ ) ) / uy,
38
38
} ,
Original file line number Diff line number Diff line change @@ -28,6 +28,27 @@ export default function supportsDisableComment(format: FormatFn) {
28
28
` ) ;
29
29
} ) ;
30
30
31
+ // Issue #906
32
+ it ( 'preserves indentation between /* sql-formatter-disable */ and /* sql-formatter-enable */' , ( ) => {
33
+ const result = format ( dedent `
34
+ /* sql-formatter-disable */
35
+ SELECT
36
+ foo
37
+ FROM
38
+ bar;
39
+ /* sql-formatter-enable */
40
+ ` ) ;
41
+
42
+ expect ( result ) . toBe ( dedent `
43
+ /* sql-formatter-disable */
44
+ SELECT
45
+ foo
46
+ FROM
47
+ bar;
48
+ /* sql-formatter-enable */
49
+ ` ) ;
50
+ } ) ;
51
+
31
52
it ( 'does not format text after /* sql-formatter-disable */ until end of file' , ( ) => {
32
53
const result = format ( dedent `
33
54
SELECT foo FROM bar;
You can’t perform that action at this time.
0 commit comments