OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 WebInspector.SASSSupport = {} | 5 WebInspector.SASSSupport = {} |
6 | 6 |
7 /** | 7 /** |
8 * @param {string} url | 8 * @param {string} url |
9 * @param {string} content | 9 * @param {string} content |
10 * @return {!Promise<!WebInspector.SASSSupport.AST>} | 10 * @return {!Promise<!WebInspector.SASSSupport.AST>} |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 if (disabled) { | 243 if (disabled) { |
244 var oldRange1 = WebInspector.TextRange.createFromLocation(this.range .startLine, this.range.startColumn); | 244 var oldRange1 = WebInspector.TextRange.createFromLocation(this.range .startLine, this.range.startColumn); |
245 var edit1 = new WebInspector.SourceEdit(this.document.url, oldRange1 , "/* "); | 245 var edit1 = new WebInspector.SourceEdit(this.document.url, oldRange1 , "/* "); |
246 var oldRange2 = WebInspector.TextRange.createFromLocation(this.range .endLine, this.range.endColumn); | 246 var oldRange2 = WebInspector.TextRange.createFromLocation(this.range .endLine, this.range.endColumn); |
247 var edit2 = new WebInspector.SourceEdit(this.document.url, oldRange2 , " */"); | 247 var edit2 = new WebInspector.SourceEdit(this.document.url, oldRange2 , " */"); |
248 this.document.edits.push(edit1, edit2); | 248 this.document.edits.push(edit1, edit2); |
249 return; | 249 return; |
250 } | 250 } |
251 var oldRange1 = new WebInspector.TextRange(this.range.startLine, this.ra nge.startColumn, this.range.startLine, this.name.range.startColumn); | 251 var oldRange1 = new WebInspector.TextRange(this.range.startLine, this.ra nge.startColumn, this.range.startLine, this.name.range.startColumn); |
252 var edit1 = new WebInspector.SourceEdit(this.document.url, oldRange1, "" ); | 252 var edit1 = new WebInspector.SourceEdit(this.document.url, oldRange1, "" ); |
253 var oldRange2 = new WebInspector.TextRange(this.range.endLine, this.rang e.endColumn - 2, this.range.endLine, this.range.endColumn); | 253 |
254 var propertyText = this.document.text.extract(this.range); | |
255 var endsWithSemicolon = propertyText.slice(2, -2).trim().endsWith(";"); | |
dgozman
2016/05/30 18:27:11
No need to slice from the start?
lushnikov
2016/07/11 18:55:09
Done.
| |
256 var oldRange2 = new WebInspector.TextRange(this.range.endLine, this.valu e.range.endColumn + (endsWithSemicolon ? 1 : 0), this.range.endLine, this.range. endColumn); | |
254 var edit2 = new WebInspector.SourceEdit(this.document.url, oldRange2, "" ); | 257 var edit2 = new WebInspector.SourceEdit(this.document.url, oldRange2, "" ); |
255 this.document.edits.push(edit1, edit2); | 258 this.document.edits.push(edit1, edit2); |
256 }, | 259 }, |
257 | 260 |
258 remove: function() | 261 remove: function() |
259 { | 262 { |
260 console.assert(this.parent); | 263 console.assert(this.parent); |
261 var rule = this.parent; | 264 var rule = this.parent; |
262 var index = rule.properties.indexOf(this); | 265 var index = rule.properties.indexOf(this); |
263 rule.properties.splice(index, 1); | 266 rule.properties.splice(index, 1); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 mapping.set(oldProperty.name, newProperty.name); | 684 mapping.set(oldProperty.name, newProperty.name); |
682 mapping.set(oldProperty.value, newProperty.value); | 685 mapping.set(oldProperty.value, newProperty.value); |
683 if (oldProperty.name.text.trim() !== newProperty.name.text.trim()) | 686 if (oldProperty.name.text.trim() !== newProperty.name.text.trim()) |
684 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp ertyIndex); | 687 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp ertyIndex); |
685 if (oldProperty.value.text.trim() !== newProperty.value.text.trim()) | 688 if (oldProperty.value.text.trim() !== newProperty.value.text.trim()) |
686 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro pertyIndex); | 689 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro pertyIndex); |
687 if (oldProperty.disabled !== newProperty.disabled) | 690 if (oldProperty.disabled !== newProperty.disabled) |
688 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new PropertyIndex); | 691 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new PropertyIndex); |
689 } | 692 } |
690 } | 693 } |
OLD | NEW |