| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { | 7 SourceFrame.SourcesTextEditor = class extends TextEditor.CodeMirrorTextEditor { |
| 8 /** | 8 /** |
| 9 * @param {!SourceFrame.SourcesTextEditorDelegate} delegate | 9 * @param {!SourceFrame.SourcesTextEditorDelegate} delegate |
| 10 */ | 10 */ |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 _trailingWhitespaceOverlayMode(mimeType) { | 534 _trailingWhitespaceOverlayMode(mimeType) { |
| 535 var modeName = CodeMirror.mimeModes[mimeType] ? | 535 var modeName = CodeMirror.mimeModes[mimeType] ? |
| 536 (CodeMirror.mimeModes[mimeType].name || CodeMirror.mimeModes[mimeType])
: | 536 (CodeMirror.mimeModes[mimeType].name || CodeMirror.mimeModes[mimeType])
: |
| 537 CodeMirror.mimeModes['text/plain']; | 537 CodeMirror.mimeModes['text/plain']; |
| 538 modeName += '+trailing-whitespaces'; | 538 modeName += '+trailing-whitespaces'; |
| 539 if (CodeMirror.modes[modeName]) | 539 if (CodeMirror.modes[modeName]) |
| 540 return modeName; | 540 return modeName; |
| 541 | 541 |
| 542 function modeConstructor(config, parserConfig) { | 542 function modeConstructor(config, parserConfig) { |
| 543 function nextToken(stream) { | 543 function nextToken(stream) { |
| 544 var pos = stream.pos; | |
| 545 if (stream.match(/^\s+$/, true)) | 544 if (stream.match(/^\s+$/, true)) |
| 546 return true ? 'trailing-whitespace' : null; | 545 return true ? 'trailing-whitespace' : null; |
| 547 do | 546 do |
| 548 stream.next(); | 547 stream.next(); |
| 549 while (!stream.eol() && stream.peek() !== ' '); | 548 while (!stream.eol() && stream.peek() !== ' '); |
| 550 return null; | 549 return null; |
| 551 } | 550 } |
| 552 var whitespaceMode = {token: nextToken}; | 551 var whitespaceMode = {token: nextToken}; |
| 553 return CodeMirror.overlayMode(CodeMirror.getMode(config, mimeType), whites
paceMode, false); | 552 return CodeMirror.overlayMode(CodeMirror.getMode(config, mimeType), whites
paceMode, false); |
| 554 } | 553 } |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 */ | 870 */ |
| 872 _setHighlighter(highlighter, selectionStart) { | 871 _setHighlighter(highlighter, selectionStart) { |
| 873 var overlayMode = {token: highlighter}; | 872 var overlayMode = {token: highlighter}; |
| 874 this._codeMirror.addOverlay(overlayMode); | 873 this._codeMirror.addOverlay(overlayMode); |
| 875 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection
Start}; | 874 this._highlightDescriptor = {overlay: overlayMode, selectionStart: selection
Start}; |
| 876 } | 875 } |
| 877 }; | 876 }; |
| 878 | 877 |
| 879 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; | 878 SourceFrame.SourcesTextEditor.LinesToScanForIndentationGuessing = 1000; |
| 880 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; | 879 SourceFrame.SourcesTextEditor.MaximumNumberOfWhitespacesPerSingleSpan = 16; |
| OLD | NEW |