File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,8 +112,12 @@ module.exports = class Prettier extends Rule {
112112
113113 differences . forEach ( ( difference ) => {
114114 let message = "" ;
115- let { line, column } = getLocFromIndex (
116- difference . offset ,
115+ // `difference.offset` is the offset from the beginning
116+ // of the template, ie. it is the index
117+ let { offset, deleteText = "" } = difference ;
118+ let { line, column } = getLocFromIndex ( offset , this . source ) ;
119+ let { line : endLine , column : endColumn } = getLocFromIndex (
120+ offset + deleteText . length ,
117121 this . source
118122 ) ;
119123
@@ -139,8 +143,8 @@ module.exports = class Prettier extends Rule {
139143 message,
140144 line,
141145 column,
142- endLine : line ,
143- endColumn : column ,
146+ endLine,
147+ endColumn,
144148 source,
145149 isFixable : true ,
146150 } ) ;
Original file line number Diff line number Diff line change 3535 line : 1 ,
3636 column : 34 ,
3737 endLine : 1 ,
38- endColumn : 34 ,
38+ endColumn : 35 ,
3939 source : "{{#my-component}}{{/my-component}}\n" ,
4040 isFixable : true ,
4141 } ,
5252 message : 'Replace `⏎·data-bar="lol"⏎·····` with ` data-bar="lol"`' ,
5353 line : 1 ,
5454 column : 13 ,
55- endLine : 1 ,
56- endColumn : 13 ,
55+ endLine : 3 ,
56+ endColumn : 5 ,
5757 source : `<div data-foo
5858 data-bar="lol"
5959 some-other-thing={{haha-morethaneightychars}}>
7070 line : 1 ,
7171 column : 4 ,
7272 endLine : 1 ,
73- endColumn : 4 ,
73+ endColumn : 5 ,
7474 source : "test\n" ,
7575 isFixable : true ,
7676 } ,
112112 line : 2 ,
113113 column : 6 ,
114114 endLine : 2 ,
115- endColumn : 6 ,
115+ endColumn : 7 ,
116116 source :
117117 '{{#my-component class="class1 class2"}}\n test \n\n{{/my-component}}' ,
118118 isFixable : true ,
You can’t perform that action at this time.
0 commit comments