monaco-editor-core 0.56.0-dev-20251124 → 0.56.0-dev-20251217

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/esm/nls.keys.json +1 -1
  2. package/esm/nls.messages.cs.js +2 -2
  3. package/esm/nls.messages.de.js +2 -2
  4. package/esm/nls.messages.es.js +2 -2
  5. package/esm/nls.messages.fr.js +2 -2
  6. package/esm/nls.messages.it.js +2 -2
  7. package/esm/nls.messages.ja.js +2 -2
  8. package/esm/nls.messages.js +1 -1
  9. package/esm/nls.messages.json +1 -1
  10. package/esm/nls.messages.ko.js +2 -2
  11. package/esm/nls.messages.pl.js +2 -2
  12. package/esm/nls.messages.pt-br.js +2 -2
  13. package/esm/nls.messages.ru.js +2 -2
  14. package/esm/nls.messages.tr.js +2 -2
  15. package/esm/nls.messages.zh-cn.js +2 -2
  16. package/esm/nls.messages.zh-tw.js +2 -2
  17. package/esm/nls.metadata.json +34 -2
  18. package/esm/vs/base/browser/dom.js +1 -4
  19. package/esm/vs/base/browser/dom.js.map +1 -1
  20. package/esm/vs/base/browser/markdownRenderer.js +25 -11
  21. package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
  22. package/esm/vs/base/browser/ui/button/button.js +15 -8
  23. package/esm/vs/base/browser/ui/button/button.js.map +1 -1
  24. package/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css +3 -8
  25. package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
  26. package/esm/vs/base/browser/ui/list/list.css +1 -0
  27. package/esm/vs/base/browser/ui/toolbar/toolbar.js +3 -0
  28. package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
  29. package/esm/vs/base/common/async.js +11 -0
  30. package/esm/vs/base/common/async.js.map +1 -1
  31. package/esm/vs/base/common/codiconsLibrary.js +11 -2
  32. package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
  33. package/esm/vs/base/common/defaultAccount.js +6 -0
  34. package/esm/vs/base/common/defaultAccount.js.map +1 -0
  35. package/esm/vs/base/common/equals.js +73 -24
  36. package/esm/vs/base/common/equals.js.map +1 -1
  37. package/esm/vs/base/common/event.js +14 -4
  38. package/esm/vs/base/common/event.js.map +1 -1
  39. package/esm/vs/base/common/iterator.js.map +1 -1
  40. package/esm/vs/base/common/keybindings.js +0 -8
  41. package/esm/vs/base/common/keybindings.js.map +1 -1
  42. package/esm/vs/base/common/lifecycle.js +2 -2
  43. package/esm/vs/base/common/lifecycle.js.map +1 -1
  44. package/esm/vs/base/common/marshallingIds.js.map +1 -1
  45. package/esm/vs/base/common/observableInternal/index.js +1 -1
  46. package/esm/vs/base/common/observableInternal/index.js.map +1 -1
  47. package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +1 -1
  48. package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
  49. package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +16 -0
  50. package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
  51. package/esm/vs/base/common/observableInternal/utils/utils.js +11 -0
  52. package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
  53. package/esm/vs/base/common/product.js.map +1 -1
  54. package/esm/vs/base/common/strings.js +3 -1
  55. package/esm/vs/base/common/strings.js.map +1 -1
  56. package/esm/vs/editor/browser/controller/dragScrolling.js +2 -1
  57. package/esm/vs/editor/browser/controller/dragScrolling.js.map +1 -1
  58. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +73 -2
  59. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
  60. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +7 -51
  61. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
  62. package/esm/vs/editor/browser/controller/editContext/screenReaderUtils.js.map +1 -1
  63. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +7 -20
  64. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
  65. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +14 -44
  66. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map +1 -1
  67. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js +19 -0
  68. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js.map +1 -0
  69. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js +14 -1
  70. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js.map +1 -1
  71. package/esm/vs/editor/browser/controller/mouseHandler.js +5 -2
  72. package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
  73. package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
  74. package/esm/vs/editor/browser/observableCodeEditor.js +32 -15
  75. package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
  76. package/esm/vs/editor/browser/view.js +11 -2
  77. package/esm/vs/editor/browser/view.js.map +1 -1
  78. package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +5 -2
  79. package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
  80. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +10 -0
  81. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
  82. package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
  83. package/esm/vs/editor/browser/widget/multiDiffEditor/style.css +48 -0
  84. package/esm/vs/editor/common/config/fontInfo.js +1 -1
  85. package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
  86. package/esm/vs/editor/common/core/edits/edit.js +19 -0
  87. package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
  88. package/esm/vs/editor/common/core/edits/stringEdit.js +13 -0
  89. package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
  90. package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
  91. package/esm/vs/editor/common/core/text/positionToOffsetImpl.js +24 -10
  92. package/esm/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -1
  93. package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
  94. package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
  95. package/esm/vs/editor/common/cursor/cursorWordOperations.js +6 -3
  96. package/esm/vs/editor/common/cursor/cursorWordOperations.js.map +1 -1
  97. package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js +2 -2
  98. package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
  99. package/esm/vs/editor/common/languages/nullTokenize.js +1 -1
  100. package/esm/vs/editor/common/languages/nullTokenize.js.map +1 -1
  101. package/esm/vs/editor/common/languages/supports/tokenization.js +3 -0
  102. package/esm/vs/editor/common/languages/supports/tokenization.js.map +1 -1
  103. package/esm/vs/editor/common/languages.js +2 -1
  104. package/esm/vs/editor/common/languages.js.map +1 -1
  105. package/esm/vs/editor/common/model/decorationProvider.js +21 -1
  106. package/esm/vs/editor/common/model/decorationProvider.js.map +1 -1
  107. package/esm/vs/editor/common/model/textModel.js +49 -30
  108. package/esm/vs/editor/common/model/textModel.js.map +1 -1
  109. package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js +6 -3
  110. package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js.map +1 -1
  111. package/esm/vs/editor/common/model/tokens/annotations.js +177 -0
  112. package/esm/vs/editor/common/model/tokens/annotations.js.map +1 -0
  113. package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +131 -0
  114. package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -0
  115. package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js +9 -0
  116. package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js.map +1 -1
  117. package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js +9 -0
  118. package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js.map +1 -1
  119. package/esm/vs/editor/common/textModelEditSource.js +2 -0
  120. package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
  121. package/esm/vs/editor/common/textModelEvents.js.map +1 -1
  122. package/esm/vs/editor/common/viewLayout/lineDecorations.js.map +1 -1
  123. package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +1 -1
  124. package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
  125. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +54 -36
  126. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
  127. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +14 -1
  128. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
  129. package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
  130. package/esm/vs/editor/contrib/hover/browser/hover.css +1 -1
  131. package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +1 -1
  132. package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
  133. package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
  134. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +1 -0
  135. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
  136. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js +2 -0
  137. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
  138. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +33 -4
  139. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
  140. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -12
  141. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js.map +1 -1
  142. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -1
  143. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
  144. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
  145. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
  146. package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js +2 -1
  147. package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js.map +1 -1
  148. package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js +8 -0
  149. package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js.map +1 -0
  150. package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js +198 -0
  151. package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js.map +1 -0
  152. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js +40 -0
  153. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js.map +1 -0
  154. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +128 -65
  155. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
  156. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +69 -13
  157. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
  158. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +159 -94
  159. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
  160. package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +124 -50
  161. package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
  162. package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +393 -0
  163. package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -0
  164. package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
  165. package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js +20 -0
  166. package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js.map +1 -1
  167. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +59 -42
  168. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
  169. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +29 -8
  170. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
  171. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +78 -46
  172. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
  173. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js +9 -4
  174. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
  175. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +11 -4
  176. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
  177. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +81 -41
  178. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
  179. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js +48 -0
  180. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
  181. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +18 -15
  182. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
  183. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js +3 -4
  184. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js.map +1 -1
  185. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +6 -7
  186. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
  187. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +4 -5
  188. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
  189. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +4 -3
  190. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
  191. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +8 -8
  192. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
  193. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +9 -7
  194. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
  195. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +203 -41
  196. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
  197. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js +189 -0
  198. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js.map +1 -0
  199. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +85 -102
  200. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
  201. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +75 -32
  202. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -1
  203. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js +121 -0
  204. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js.map +1 -0
  205. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
  206. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
  207. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +22 -20
  208. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
  209. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +15 -5
  210. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
  211. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +39 -6
  212. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +10 -5
  213. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -1
  214. package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
  215. package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
  216. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
  217. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
  218. package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
  219. package/esm/vs/editor/contrib/links/browser/links.js +10 -10
  220. package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
  221. package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
  222. package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
  223. package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
  224. package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
  225. package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
  226. package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +11 -11
  227. package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
  228. package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
  229. package/esm/vs/editor/contrib/rename/browser/rename.js +19 -11
  230. package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
  231. package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
  232. package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +3 -2
  233. package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js.map +1 -1
  234. package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
  235. package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
  236. package/esm/vs/editor/contrib/snippet/browser/snippetParser.js +33 -0
  237. package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
  238. package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
  239. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
  240. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +12 -4
  241. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
  242. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +1 -0
  243. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
  244. package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -8
  245. package/esm/vs/editor/contrib/suggest/browser/suggest.js.map +1 -1
  246. package/esm/vs/editor/contrib/suggest/browser/suggestController.js +39 -28
  247. package/esm/vs/editor/contrib/suggest/browser/suggestController.js.map +1 -1
  248. package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +1 -0
  249. package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js.map +1 -1
  250. package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +22 -18
  251. package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js.map +1 -1
  252. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +28 -6
  253. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
  254. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
  255. package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
  256. package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
  257. package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
  258. package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
  259. package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
  260. package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
  261. package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
  262. package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
  263. package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
  264. package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +19 -2
  265. package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js.map +1 -1
  266. package/esm/vs/editor/editor.api.d.ts +37 -2
  267. package/esm/vs/editor/standalone/browser/standaloneLanguages.js +2 -2
  268. package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
  269. package/esm/vs/editor/standalone/browser/standaloneServices.js +11 -1
  270. package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
  271. package/esm/vs/editor/standalone/common/monarch/monarchLexer.js +1 -1
  272. package/esm/vs/editor/standalone/common/monarch/monarchLexer.js.map +1 -1
  273. package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
  274. package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
  275. package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
  276. package/esm/vs/platform/actionWidget/browser/actionWidget.css +11 -8
  277. package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
  278. package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
  279. package/esm/vs/platform/actions/browser/toolbar.js +2 -2
  280. package/esm/vs/platform/actions/common/actions.js +11 -4
  281. package/esm/vs/platform/actions/common/actions.js.map +1 -1
  282. package/esm/vs/platform/actions/common/menuService.js +2 -2
  283. package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
  284. package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
  285. package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
  286. package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
  287. package/esm/vs/platform/contextkey/common/scanner.js +5 -5
  288. package/esm/vs/platform/{product/common/productService.js → defaultAccount/common/defaultAccount.js} +2 -2
  289. package/esm/vs/platform/defaultAccount/common/defaultAccount.js.map +1 -0
  290. package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
  291. package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
  292. package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
  293. package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
  294. package/esm/vs/platform/instantiation/common/instantiationService.js +1 -8
  295. package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
  296. package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
  297. package/esm/vs/platform/list/browser/listService.js +27 -27
  298. package/esm/vs/platform/log/common/log.js +1 -1
  299. package/esm/vs/platform/log/common/log.js.map +1 -1
  300. package/esm/vs/platform/markers/common/markerService.js +6 -6
  301. package/esm/vs/platform/markers/common/markerService.js.map +1 -1
  302. package/esm/vs/platform/markers/common/markers.js +6 -6
  303. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
  304. package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
  305. package/esm/vs/platform/quickinput/browser/media/quickInput.css +7 -3
  306. package/esm/vs/platform/quickinput/browser/quickInput.js +19 -11
  307. package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
  308. package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
  309. package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
  310. package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
  311. package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
  312. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
  313. package/esm/vs/platform/theme/common/colorUtils.js +2 -2
  314. package/esm/vs/platform/theme/common/colors/baseColors.js +18 -17
  315. package/esm/vs/platform/theme/common/colors/baseColors.js.map +1 -1
  316. package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
  317. package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
  318. package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
  319. package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
  320. package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
  321. package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
  322. package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
  323. package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
  324. package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
  325. package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
  326. package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
  327. package/esm/vs/platform/undoRedo/common/undoRedoService.js +21 -21
  328. package/esm/vs/platform/undoRedo/common/undoRedoService.js.map +1 -1
  329. package/esm/vs/platform/window/common/window.js +1 -1
  330. package/esm/vs/platform/window/common/window.js.map +1 -1
  331. package/esm/vs/platform/workspace/common/workspace.js +1 -1
  332. package/monaco.d.ts +37 -2
  333. package/package.json +2 -2
  334. package/version.txt +1 -1
  335. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +0 -16
  336. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +0 -1
  337. package/esm/vs/platform/product/common/productService.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/textModel.ts","vs/editor/common/model/textModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,OAAO,EAAS,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAe,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACnH,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAG3D,OAAO,EAAE,GAAG,EAAE,MAAM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AO3F,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;IAEM,iBAAiB;QACvB,IAAI,CAAC,YAAY,EAAE,CAAC;IACrB,CAAC;IAEM,eAAe,CAAC,qBAAyC,IAAI;QACnE,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;gBAClC,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;gBACnF,MAAM,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;gBAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;gBAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;QACF,CAAC;IACF,CAAC;IAEM,IAAI,CAAC,CAAkC;QAC7C,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBACzB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;YACzB,CAAC;YACD,OAAO;QACR,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACD","file":"textModel.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ArrayQueue, pushMany } from '../../../base/common/arrays.js';\nimport { Color } from '../../../base/common/color.js';\nimport { BugIndicatingError, illegalArgument, onUnexpectedError } from '../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IMarkdownString } from '../../../base/common/htmlContent.js';\nimport { Disposable, IDisposable, MutableDisposable, combinedDisposable } from '../../../base/common/lifecycle.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { ThemeColor } from '../../../base/common/themables.js';\nimport { Constants } from '../../../base/common/uint.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ISingleEditOperation } from '../core/editOperation.js';\nimport { countEOL } from '../core/misc/eolCounter.js';\nimport { normalizeIndentation } from '../core/misc/indentation.js';\nimport { IPosition, Position } from '../core/position.js';\nimport { IRange, Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nimport { TextChange } from '../core/textChange.js';\nimport { EDITOR_MODEL_DEFAULTS } from '../core/misc/textModelDefaults.js';\nimport { IWordAtPosition } from '../core/wordHelper.js';\nimport { FormattingOptions } from '../languages.js';\nimport { ILanguageSelection, ILanguageService } from '../languages/language.js';\nimport { ILanguageConfigurationService } from '../languages/languageConfigurationRegistry.js';\nimport * as model from '../model.js';\nimport { BracketPairsTextModelPart } from './bracketPairsTextModelPart/bracketPairsImpl.js';\nimport { ColorizedBracketPairsDecorationProvider } from './bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js';\nimport { EditStack } from './editStack.js';\nimport { GuidesTextModelPart } from './guidesTextModelPart.js';\nimport { guessIndentation } from './indentationGuesser.js';\nimport { IntervalNode, IntervalTree, recomputeMaxEnd } from './intervalTree.js';\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer/pieceTreeTextBuffer.js';\nimport { PieceTreeTextBufferBuilder } from './pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js';\nimport { SearchParams, TextModelSearch } from './textModelSearch.js';\nimport { TokenizationTextModelPart } from './tokens/tokenizationTextModelPart.js';\nimport { AttachedViews } from './tokens/abstractSyntaxTokenBackend.js';\nimport { IBracketPairsTextModelPart } from '../textModelBracketPairs.js';\nimport { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelOptionsChangedEvent, InternalModelContentChangeEvent, ModelInjectedTextChangedEvent, ModelRawChange, ModelRawContentChangedEvent, ModelRawEOLChanged, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted, ModelLineHeightChangedEvent, ModelLineHeightChanged, ModelFontChangedEvent, ModelFontChanged, LineInjectedText } from '../textModelEvents.js';\nimport { IGuidesTextModelPart } from '../textModelGuides.js';\nimport { ITokenizationTextModelPart } from '../tokenizationTextModelPart.js';\nimport { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';\nimport { IColorTheme } from '../../../platform/theme/common/themeService.js';\nimport { IUndoRedoService, ResourceEditStackSnapshot, UndoRedoGroup } from '../../../platform/undoRedo/common/undoRedo.js';\nimport { TokenArray } from '../tokens/lineTokens.js';\nimport { SetWithKey } from '../../../base/common/collections.js';\nimport { EditSources, TextModelEditSource } from '../textModelEditSource.js';\nimport { isDark } from '../../../platform/theme/common/theme.js';\n\nexport function createTextBufferFactory(text: string): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\tbuilder.acceptChunk(text);\n\treturn builder.finish();\n}\n\nexport function createTextBufferFactoryFromSnapshot(snapshot: model.ITextSnapshot): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\n\tlet chunk: string | null;\n\twhile (typeof (chunk = snapshot.read()) === 'string') {\n\t\tbuilder.acceptChunk(chunk);\n\t}\n\n\treturn builder.finish();\n}\n\nexport function createTextBuffer(value: string | model.ITextBufferFactory | model.ITextSnapshot, defaultEOL: model.DefaultEndOfLine): { textBuffer: model.ITextBuffer; disposable: IDisposable } {\n\tlet factory: model.ITextBufferFactory;\n\tif (typeof value === 'string') {\n\t\tfactory = createTextBufferFactory(value);\n\t} else if (model.isITextSnapshot(value)) {\n\t\tfactory = createTextBufferFactoryFromSnapshot(value);\n\t} else {\n\t\tfactory = value;\n\t}\n\treturn factory.create(defaultEOL);\n}\n\nlet MODEL_ID = 0;\n\nconst LIMIT_FIND_COUNT = 999;\nconst LONG_LINE_BOUNDARY = 10000;\nconst LINE_HEIGHT_CEILING = 300;\n\nclass TextModelSnapshot implements model.ITextSnapshot {\n\n\tprivate readonly _source: model.ITextSnapshot;\n\tprivate _eos: boolean;\n\n\tconstructor(source: model.ITextSnapshot) {\n\t\tthis._source = source;\n\t\tthis._eos = false;\n\t}\n\n\tpublic read(): string | null {\n\t\tif (this._eos) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst result: string[] = [];\n\t\tlet resultCnt = 0;\n\t\tlet resultLength = 0;\n\n\t\tdo {\n\t\t\tconst tmp = this._source.read();\n\n\t\t\tif (tmp === null) {\n\t\t\t\t// end-of-stream\n\t\t\t\tthis._eos = true;\n\t\t\t\tif (resultCnt === 0) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\treturn result.join('');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (tmp.length > 0) {\n\t\t\t\tresult[resultCnt++] = tmp;\n\t\t\t\tresultLength += tmp.length;\n\t\t\t}\n\n\t\t\tif (resultLength >= 64 * 1024) {\n\t\t\t\treturn result.join('');\n\t\t\t}\n\t\t} while (true);\n\t}\n}\n\nconst invalidFunc = () => { throw new Error(`Invalid change accessor`); };\n\nconst enum StringOffsetValidationType {\n\t/**\n\t * Even allowed in surrogate pairs\n\t */\n\tRelaxed = 0,\n\t/**\n\t * Not allowed in surrogate pairs\n\t */\n\tSurrogatePairs = 1,\n}\n\nexport class TextModel extends Disposable implements model.ITextModel, IDecorationsTreesHost {\n\n\tstatic _MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB, // used in tests\n\tprivate static readonly LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;\n\tprivate static readonly LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines\n\tprivate static readonly LARGE_FILE_HEAP_OPERATION_THRESHOLD = 256 * 1024 * 1024; // 256M characters, usually ~> 512MB memory usage\n\n\tpublic static DEFAULT_CREATION_OPTIONS: model.ITextModelCreationOptions = {\n\t\tisForSimpleWidget: false,\n\t\ttabSize: EDITOR_MODEL_DEFAULTS.tabSize,\n\t\tindentSize: EDITOR_MODEL_DEFAULTS.indentSize,\n\t\tinsertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,\n\t\tdetectIndentation: false,\n\t\tdefaultEOL: model.DefaultEndOfLine.LF,\n\t\ttrimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,\n\t\tlargeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,\n\t\tbracketPairColorizationOptions: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions,\n\t};\n\n\tpublic static resolveOptions(textBuffer: model.ITextBuffer, options: model.ITextModelCreationOptions): model.TextModelResolvedOptions {\n\t\tif (options.detectIndentation) {\n\t\t\tconst guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces);\n\t\t\treturn new model.TextModelResolvedOptions({\n\t\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\t\tindentSize: 'tabSize', // TODO@Alex: guess indentSize independent of tabSize\n\t\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\t\ttrimAutoWhitespace: options.trimAutoWhitespace,\n\t\t\t\tdefaultEOL: options.defaultEOL,\n\t\t\t\tbracketPairColorizationOptions: options.bracketPairColorizationOptions,\n\t\t\t});\n\t\t}\n\n\t\treturn new model.TextModelResolvedOptions(options);\n\t}\n\n\t//#region Events\n\tprivate readonly _onWillDispose: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onWillDispose: Event<void> = this._onWillDispose.event;\n\n\tprivate readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter((affectedInjectedTextLines, affectedLineHeights, affectedFontLines) => this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines, affectedLineHeights, affectedFontLines)));\n\tpublic readonly onDidChangeDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeDecorations.event;\n\n\tpublic get onDidChangeLanguage() { return this._tokenizationTextModelPart.onDidChangeLanguage; }\n\tpublic get onDidChangeLanguageConfiguration() { return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration; }\n\tpublic get onDidChangeTokens() { return this._tokenizationTextModelPart.onDidChangeTokens; }\n\n\tprivate readonly _onDidChangeOptions: Emitter<IModelOptionsChangedEvent> = this._register(new Emitter<IModelOptionsChangedEvent>());\n\tpublic get onDidChangeOptions(): Event<IModelOptionsChangedEvent> { return this._onDidChangeOptions.event; }\n\n\tprivate readonly _onDidChangeAttached: Emitter<void> = this._register(new Emitter<void>());\n\tpublic get onDidChangeAttached(): Event<void> { return this._onDidChangeAttached.event; }\n\n\tprivate readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>());\n\n\tprivate readonly _onDidChangeLineHeight: Emitter<ModelLineHeightChangedEvent> = this._register(new Emitter<ModelLineHeightChangedEvent>());\n\tpublic get onDidChangeLineHeight(): Event<ModelLineHeightChangedEvent> { return this._onDidChangeLineHeight.event; }\n\n\tprivate readonly _onDidChangeFont: Emitter<ModelFontChangedEvent> = this._register(new Emitter<ModelFontChangedEvent>());\n\tpublic get onDidChangeFont(): Event<ModelFontChangedEvent> { return this._onDidChangeFont.event; }\n\n\tprivate readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter());\n\tpublic onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable {\n\t\treturn this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));\n\t}\n\tpublic onDidChangeContentOrInjectedText(listener: (e: InternalModelContentChangeEvent | ModelInjectedTextChangedEvent) => void): IDisposable {\n\t\treturn combinedDisposable(\n\t\t\tthis._eventEmitter.fastEvent(e => listener(e)),\n\t\t\tthis._onDidChangeInjectedText.event(e => listener(e))\n\t\t);\n\t}\n\t//#endregion\n\n\tpublic readonly id: string;\n\tpublic readonly isForSimpleWidget: boolean;\n\tprivate readonly _associatedResource: URI;\n\tprivate _attachedEditorCount: number;\n\tprivate _buffer: model.ITextBuffer;\n\tprivate _bufferDisposable: IDisposable;\n\tprivate _options: model.TextModelResolvedOptions;\n\tprivate readonly _languageSelectionListener = this._register(new MutableDisposable<IDisposable>());\n\n\tprivate _isDisposed: boolean;\n\tprivate __isDisposing: boolean;\n\tpublic _isDisposing(): boolean { return this.__isDisposing; }\n\tprivate _versionId: number;\n\t/**\n\t * Unlike, versionId, this can go down (via undo) or go to previous values (via redo)\n\t */\n\tprivate _alternativeVersionId: number;\n\tprivate _initialUndoRedoSnapshot: ResourceEditStackSnapshot | null;\n\tprivate readonly _isTooLargeForSyncing: boolean;\n\tprivate readonly _isTooLargeForTokenization: boolean;\n\tprivate readonly _isTooLargeForHeapOperation: boolean;\n\n\t//#region Editing\n\tprivate readonly _commandManager: EditStack;\n\tprivate _isUndoing: boolean;\n\tprivate _isRedoing: boolean;\n\tprivate _trimAutoWhitespaceLines: number[] | null;\n\t//#endregion\n\n\t//#region Decorations\n\t/**\n\t * Used to workaround broken clients that might attempt using a decoration id generated by a different model.\n\t * It is not globally unique in order to limit it to one character.\n\t */\n\tprivate readonly _instanceId: string;\n\tprivate _deltaDecorationCallCnt: number = 0;\n\tprivate _lastDecorationId: number;\n\tprivate _decorations: { [decorationId: string]: IntervalNode };\n\tprivate _decorationsTree: DecorationsTrees;\n\tprivate readonly _decorationProvider: ColorizedBracketPairsDecorationProvider;\n\t//#endregion\n\n\tprivate readonly _tokenizationTextModelPart: TokenizationTextModelPart;\n\tpublic get tokenization(): ITokenizationTextModelPart { return this._tokenizationTextModelPart; }\n\n\tprivate readonly _bracketPairs: BracketPairsTextModelPart;\n\tpublic get bracketPairs(): IBracketPairsTextModelPart { return this._bracketPairs; }\n\n\tprivate readonly _guidesTextModelPart: GuidesTextModelPart;\n\tpublic get guides(): IGuidesTextModelPart { return this._guidesTextModelPart; }\n\n\tprivate readonly _attachedViews = new AttachedViews();\n\n\tconstructor(\n\t\tsource: string | model.ITextBufferFactory,\n\t\tlanguageIdOrSelection: string | ILanguageSelection,\n\t\tcreationOptions: model.ITextModelCreationOptions,\n\t\tassociatedResource: URI | null = null,\n\t\t@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@IInstantiationService private readonly instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\t// Generate a new unique model id\n\t\tMODEL_ID++;\n\t\tthis.id = '$model' + MODEL_ID;\n\t\tthis.isForSimpleWidget = creationOptions.isForSimpleWidget;\n\t\tif (typeof associatedResource === 'undefined' || associatedResource === null) {\n\t\t\tthis._associatedResource = URI.parse('inmemory://model/' + MODEL_ID);\n\t\t} else {\n\t\t\tthis._associatedResource = associatedResource;\n\t\t}\n\t\tthis._attachedEditorCount = 0;\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(source, creationOptions.defaultEOL);\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable = disposable;\n\n\t\tconst bufferLineCount = this._buffer.getLineCount();\n\t\tconst bufferTextLength = this._buffer.getValueLengthInRange(new Range(1, 1, bufferLineCount, this._buffer.getLineLength(bufferLineCount) + 1), model.EndOfLinePreference.TextDefined);\n\n\t\t// !!! Make a decision in the ctor and permanently respect this decision !!!\n\t\t// If a model is too large at construction time, it will never get tokenized,\n\t\t// under no circumstances.\n\t\tif (creationOptions.largeFileOptimizations) {\n\t\t\tthis._isTooLargeForTokenization = (\n\t\t\t\t(bufferTextLength > TextModel.LARGE_FILE_SIZE_THRESHOLD)\n\t\t\t\t|| (bufferLineCount > TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD)\n\t\t\t);\n\n\t\t\tthis._isTooLargeForHeapOperation = bufferTextLength > TextModel.LARGE_FILE_HEAP_OPERATION_THRESHOLD;\n\t\t} else {\n\t\t\tthis._isTooLargeForTokenization = false;\n\t\t\tthis._isTooLargeForHeapOperation = false;\n\t\t}\n\n\t\tthis._options = TextModel.resolveOptions(this._buffer, creationOptions);\n\n\t\tconst languageId = (typeof languageIdOrSelection === 'string' ? languageIdOrSelection : languageIdOrSelection.languageId);\n\t\tif (typeof languageIdOrSelection !== 'string') {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId));\n\t\t}\n\n\t\tthis._bracketPairs = this._register(new BracketPairsTextModelPart(this, this._languageConfigurationService));\n\t\tthis._guidesTextModelPart = this._register(new GuidesTextModelPart(this, this._languageConfigurationService));\n\t\tthis._decorationProvider = this._register(new ColorizedBracketPairsDecorationProvider(this));\n\t\tthis._tokenizationTextModelPart = this.instantiationService.createInstance(TokenizationTextModelPart,\n\t\t\tthis,\n\t\t\tthis._bracketPairs,\n\t\t\tlanguageId,\n\t\t\tthis._attachedViews\n\t\t);\n\n\t\tthis._isTooLargeForSyncing = (bufferTextLength > TextModel._MODEL_SYNC_LIMIT);\n\n\t\tthis._versionId = 1;\n\t\tthis._alternativeVersionId = 1;\n\t\tthis._initialUndoRedoSnapshot = null;\n\n\t\tthis._isDisposed = false;\n\t\tthis.__isDisposing = false;\n\n\t\tthis._instanceId = strings.singleLetterHash(MODEL_ID);\n\t\tthis._lastDecorationId = 0;\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\tthis._commandManager = new EditStack(this, this._undoRedoService);\n\t\tthis._isUndoing = false;\n\t\tthis._isRedoing = false;\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\n\t\tthis._register(this._decorationProvider.onDidChange(() => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\n\t\tthis._register(this._languageConfigurationService.onDidChange(e => {\n\t\t\tthis._bracketPairs.handleLanguageConfigurationServiceChange(e);\n\t\t\tthis._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(e);\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.__isDisposing = true;\n\t\tthis._onWillDispose.fire();\n\t\tthis._tokenizationTextModelPart.dispose();\n\t\tthis._isDisposed = true;\n\t\tsuper.dispose();\n\t\tthis._bufferDisposable.dispose();\n\t\tthis.__isDisposing = false;\n\t\t// Manually release reference to previous text buffer to avoid large leaks\n\t\t// in case someone leaks a TextModel reference\n\t\tconst emptyDisposedTextBuffer = new PieceTreeTextBuffer([], '', '\\n', false, false, true, true);\n\t\temptyDisposedTextBuffer.dispose();\n\t\tthis._buffer = emptyDisposedTextBuffer;\n\t\tthis._bufferDisposable = Disposable.None;\n\t}\n\n\tprivate _assertNotDisposed(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError('Model is disposed!');\n\t\t}\n\t}\n\n\tpublic getTextBuffer(): model.ITextBuffer {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer;\n\t}\n\n\tprivate _emitContentChangedEvent(rawChange: ModelRawContentChangedEvent, change: IModelContentChangedEvent): void {\n\t\tif (this.__isDisposing) {\n\t\t\t// Do not confuse listeners by emitting any event after disposing\n\t\t\treturn;\n\t\t}\n\t\tthis._tokenizationTextModelPart.handleDidChangeContent(change);\n\t\tthis._bracketPairs.handleDidChangeContent(change);\n\t\tthis._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));\n\t}\n\n\tpublic setValue(value: string | model.ITextSnapshot, reason = EditSources.setValue()): void {\n\t\tthis._assertNotDisposed();\n\n\t\tif (value === null || value === undefined) {\n\t\t\tthrow illegalArgument();\n\t\t}\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);\n\t\tthis._setValueFromTextBuffer(textBuffer, disposable, reason);\n\t}\n\n\tprivate _createContentChanged2(range: Range, rangeOffset: number, rangeLength: number, rangeEndPosition: Position, text: string, isUndoing: boolean, isRedoing: boolean, isFlush: boolean, isEolChange: boolean, reason: TextModelEditSource): IModelContentChangedEvent {\n\t\treturn {\n\t\t\tchanges: [{\n\t\t\t\trange: range,\n\t\t\t\trangeOffset: rangeOffset,\n\t\t\t\trangeLength: rangeLength,\n\t\t\t\ttext: text,\n\t\t\t}],\n\t\t\teol: this._buffer.getEOL(),\n\t\t\tisEolChange: isEolChange,\n\t\t\tversionId: this.getVersionId(),\n\t\t\tisUndoing: isUndoing,\n\t\t\tisRedoing: isRedoing,\n\t\t\tisFlush: isFlush,\n\t\t\tdetailedReasons: [reason],\n\t\t\tdetailedReasonsChangeLengths: [1],\n\t\t};\n\t}\n\n\tprivate _setValueFromTextBuffer(textBuffer: model.ITextBuffer, textBufferDisposable: IDisposable, reason: TextModelEditSource): void {\n\t\tthis._assertNotDisposed();\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable.dispose();\n\t\tthis._bufferDisposable = textBufferDisposable;\n\t\tthis._increaseVersionId();\n\n\t\t// Destroy all my decorations\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\t// Destroy my edit history and settings\n\t\tthis._commandManager.clear();\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawFlush()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, true, false, reason)\n\t\t);\n\t}\n\n\tpublic setEOL(eol: model.EndOfLineSequence): void {\n\t\tthis._assertNotDisposed();\n\t\tconst newEOL = (eol === model.EndOfLineSequence.CRLF ? '\\r\\n' : '\\n');\n\t\tif (this._buffer.getEOL() === newEOL) {\n\t\t\t// Nothing to do\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._onBeforeEOLChange();\n\t\tthis._buffer.setEOL(newEOL);\n\t\tthis._increaseVersionId();\n\t\tthis._onAfterEOLChange();\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawEOLChanged()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, false, true, EditSources.eolChange())\n\t\t);\n\t}\n\n\tprivate _onBeforeEOLChange(): void {\n\t\t// Ensure all decorations get their `range` set.\n\t\tthis._decorationsTree.ensureAllNodesHaveRanges(this);\n\t}\n\n\tprivate _onAfterEOLChange(): void {\n\t\t// Transform back `range` to offsets\n\t\tconst versionId = this.getVersionId();\n\t\tconst allDecorations = this._decorationsTree.collectNodesPostOrder();\n\t\tfor (let i = 0, len = allDecorations.length; i < len; i++) {\n\t\t\tconst node = allDecorations[i];\n\t\t\tconst range = node.range!; // the range is defined due to `_onBeforeEOLChange`\n\n\t\t\tconst delta = node.cachedAbsoluteStart - node.start;\n\n\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\tnode.cachedAbsoluteStart = startOffset;\n\t\t\tnode.cachedAbsoluteEnd = endOffset;\n\t\t\tnode.cachedVersionId = versionId;\n\n\t\t\tnode.start = startOffset - delta;\n\t\t\tnode.end = endOffset - delta;\n\n\t\t\trecomputeMaxEnd(node);\n\t\t}\n\t}\n\n\tpublic onBeforeAttached(): model.IAttachedView {\n\t\tthis._attachedEditorCount++;\n\t\tif (this._attachedEditorCount === 1) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\treturn this._attachedViews.attachView();\n\t}\n\n\tpublic onBeforeDetached(view: model.IAttachedView): void {\n\t\tthis._attachedEditorCount--;\n\t\tif (this._attachedEditorCount === 0) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\tthis._attachedViews.detachView(view);\n\t}\n\n\tpublic isAttachedToEditor(): boolean {\n\t\treturn this._attachedEditorCount > 0;\n\t}\n\n\tpublic getAttachedEditorCount(): number {\n\t\treturn this._attachedEditorCount;\n\t}\n\n\tpublic isTooLargeForSyncing(): boolean {\n\t\treturn this._isTooLargeForSyncing;\n\t}\n\n\tpublic isTooLargeForTokenization(): boolean {\n\t\treturn this._isTooLargeForTokenization;\n\t}\n\n\tpublic isTooLargeForHeapOperation(): boolean {\n\t\treturn this._isTooLargeForHeapOperation;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\tpublic isDominatedByLongLines(): boolean {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForTokenization()) {\n\t\t\t// Cannot word wrap huge files anyways, so it doesn't really matter\n\t\t\treturn false;\n\t\t}\n\t\tlet smallLineCharCount = 0;\n\t\tlet longLineCharCount = 0;\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tfor (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {\n\t\t\tconst lineLength = this._buffer.getLineLength(lineNumber);\n\t\t\tif (lineLength >= LONG_LINE_BOUNDARY) {\n\t\t\t\tlongLineCharCount += lineLength;\n\t\t\t} else {\n\t\t\t\tsmallLineCharCount += lineLength;\n\t\t\t}\n\t\t}\n\n\t\treturn (longLineCharCount > smallLineCharCount);\n\t}\n\n\tpublic get uri(): URI {\n\t\treturn this._associatedResource;\n\t}\n\n\t//#region Options\n\n\tpublic getOptions(): model.TextModelResolvedOptions {\n\t\tthis._assertNotDisposed();\n\t\treturn this._options;\n\t}\n\n\tpublic getFormattingOptions(): FormattingOptions {\n\t\treturn {\n\t\t\ttabSize: this._options.indentSize,\n\t\t\tinsertSpaces: this._options.insertSpaces\n\t\t};\n\t}\n\n\tpublic updateOptions(_newOpts: model.ITextModelUpdateOptions): void {\n\t\tthis._assertNotDisposed();\n\t\tconst tabSize = (typeof _newOpts.tabSize !== 'undefined') ? _newOpts.tabSize : this._options.tabSize;\n\t\tconst indentSize = (typeof _newOpts.indentSize !== 'undefined') ? _newOpts.indentSize : this._options.originalIndentSize;\n\t\tconst insertSpaces = (typeof _newOpts.insertSpaces !== 'undefined') ? _newOpts.insertSpaces : this._options.insertSpaces;\n\t\tconst trimAutoWhitespace = (typeof _newOpts.trimAutoWhitespace !== 'undefined') ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;\n\t\tconst bracketPairColorizationOptions = (typeof _newOpts.bracketColorizationOptions !== 'undefined') ? _newOpts.bracketColorizationOptions : this._options.bracketPairColorizationOptions;\n\n\t\tconst newOpts = new model.TextModelResolvedOptions({\n\t\t\ttabSize: tabSize,\n\t\t\tindentSize: indentSize,\n\t\t\tinsertSpaces: insertSpaces,\n\t\t\tdefaultEOL: this._options.defaultEOL,\n\t\t\ttrimAutoWhitespace: trimAutoWhitespace,\n\t\t\tbracketPairColorizationOptions,\n\t\t});\n\n\t\tif (this._options.equals(newOpts)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst e = this._options.createChangeEvent(newOpts);\n\t\tthis._options = newOpts;\n\n\t\tthis._bracketPairs.handleDidChangeOptions(e);\n\t\tthis._decorationProvider.handleDidChangeOptions(e);\n\t\tthis._onDidChangeOptions.fire(e);\n\t}\n\n\tpublic detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void {\n\t\tthis._assertNotDisposed();\n\t\tconst guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);\n\t\tthis.updateOptions({\n\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\tindentSize: guessedIndentation.tabSize, // TODO@Alex: guess indentSize independent of tabSize\n\t\t});\n\t}\n\n\tpublic normalizeIndentation(str: string): string {\n\t\tthis._assertNotDisposed();\n\t\treturn normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);\n\t}\n\n\t//#endregion\n\n\t//#region Reading\n\n\tpublic getVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._versionId;\n\t}\n\n\tpublic mightContainRTL(): boolean {\n\t\treturn this._buffer.mightContainRTL();\n\t}\n\n\tpublic mightContainUnusualLineTerminators(): boolean {\n\t\treturn this._buffer.mightContainUnusualLineTerminators();\n\t}\n\n\tpublic removeUnusualLineTerminators(selections: Selection[] | null = null): void {\n\t\tconst matches = this.findMatches(strings.UNUSUAL_LINE_TERMINATORS.source, false, true, false, null, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tthis._buffer.resetMightContainUnusualLineTerminators();\n\t\tthis.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: null })), () => null);\n\t}\n\n\tpublic mightContainNonBasicASCII(): boolean {\n\t\treturn this._buffer.mightContainNonBasicASCII();\n\t}\n\n\tpublic getAlternativeVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._alternativeVersionId;\n\t}\n\n\tpublic getInitialUndoRedoSnapshot(): ResourceEditStackSnapshot | null {\n\t\tthis._assertNotDisposed();\n\t\treturn this._initialUndoRedoSnapshot;\n\t}\n\n\tpublic getOffsetAt(rawPosition: IPosition): number {\n\t\tthis._assertNotDisposed();\n\t\tconst position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, StringOffsetValidationType.Relaxed);\n\t\treturn this._buffer.getOffsetAt(position.lineNumber, position.column);\n\t}\n\n\tpublic getPositionAt(rawOffset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst offset = (Math.min(this._buffer.getLength(), Math.max(0, rawOffset)));\n\t\treturn this._buffer.getPositionAt(offset);\n\t}\n\n\tprivate _increaseVersionId(): void {\n\t\tthis._versionId = this._versionId + 1;\n\t\tthis._alternativeVersionId = this._versionId;\n\t}\n\n\tpublic _overwriteVersionId(versionId: number): void {\n\t\tthis._versionId = versionId;\n\t}\n\n\tpublic _overwriteAlternativeVersionId(newAlternativeVersionId: number): void {\n\t\tthis._alternativeVersionId = newAlternativeVersionId;\n\t}\n\n\tpublic _overwriteInitialUndoRedoSnapshot(newInitialUndoRedoSnapshot: ResourceEditStackSnapshot | null): void {\n\t\tthis._initialUndoRedoSnapshot = newInitialUndoRedoSnapshot;\n\t}\n\n\tpublic getValue(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): string {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM() + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic createSnapshot(preserveBOM: boolean = false): model.ITextSnapshot {\n\t\treturn new TextModelSnapshot(this._buffer.createSnapshot(preserveBOM));\n\t}\n\n\tpublic getValueLength(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): number {\n\t\tthis._assertNotDisposed();\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueLengthInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM().length + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic getValueInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getValueLengthInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getCharacterCountInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getLineCount(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getLineCount();\n\t}\n\n\tpublic getLineContent(lineNumber: number): string {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineContent(lineNumber);\n\t}\n\n\tpublic getLineLength(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineLength(lineNumber);\n\t}\n\n\tpublic getLinesContent(): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\treturn this._buffer.getLinesContent();\n\t}\n\n\tpublic getEOL(): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getEOL();\n\t}\n\n\tpublic getEndOfLineSequence(): model.EndOfLineSequence {\n\t\tthis._assertNotDisposed();\n\t\treturn (\n\t\t\tthis._buffer.getEOL() === '\\n'\n\t\t\t\t? model.EndOfLineSequence.LF\n\t\t\t\t: model.EndOfLineSequence.CRLF\n\t\t);\n\t}\n\n\tpublic getLineMinColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\treturn 1;\n\t}\n\n\tpublic getLineMaxColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLength(lineNumber) + 1;\n\t}\n\n\tpublic getLineFirstNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);\n\t}\n\n\tpublic getLineLastNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLastNonWhitespaceColumn(lineNumber);\n\t}\n\n\t/**\n\t * Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.\n\t * Will try to not allocate if possible.\n\t */\n\tpublic _validateRangeRelaxedNoAllocations(range: IRange): Range {\n\t\tconst linesCount = this._buffer.getLineCount();\n\n\t\tconst initialStartLineNumber = range.startLineNumber;\n\t\tconst initialStartColumn = range.startColumn;\n\t\tlet startLineNumber = Math.floor((typeof initialStartLineNumber === 'number' && !isNaN(initialStartLineNumber)) ? initialStartLineNumber : 1);\n\t\tlet startColumn = Math.floor((typeof initialStartColumn === 'number' && !isNaN(initialStartColumn)) ? initialStartColumn : 1);\n\n\t\tif (startLineNumber < 1) {\n\t\t\tstartLineNumber = 1;\n\t\t\tstartColumn = 1;\n\t\t} else if (startLineNumber > linesCount) {\n\t\t\tstartLineNumber = linesCount;\n\t\t\tstartColumn = this.getLineMaxColumn(startLineNumber);\n\t\t} else {\n\t\t\tif (startColumn <= 1) {\n\t\t\t\tstartColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(startLineNumber);\n\t\t\t\tif (startColumn >= maxColumn) {\n\t\t\t\t\tstartColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst initialEndLineNumber = range.endLineNumber;\n\t\tconst initialEndColumn = range.endColumn;\n\t\tlet endLineNumber = Math.floor((typeof initialEndLineNumber === 'number' && !isNaN(initialEndLineNumber)) ? initialEndLineNumber : 1);\n\t\tlet endColumn = Math.floor((typeof initialEndColumn === 'number' && !isNaN(initialEndColumn)) ? initialEndColumn : 1);\n\n\t\tif (endLineNumber < 1) {\n\t\t\tendLineNumber = 1;\n\t\t\tendColumn = 1;\n\t\t} else if (endLineNumber > linesCount) {\n\t\t\tendLineNumber = linesCount;\n\t\t\tendColumn = this.getLineMaxColumn(endLineNumber);\n\t\t} else {\n\t\t\tif (endColumn <= 1) {\n\t\t\t\tendColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(endLineNumber);\n\t\t\t\tif (endColumn >= maxColumn) {\n\t\t\t\t\tendColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tinitialStartLineNumber === startLineNumber\n\t\t\t&& initialStartColumn === startColumn\n\t\t\t&& initialEndLineNumber === endLineNumber\n\t\t\t&& initialEndColumn === endColumn\n\t\t\t&& range instanceof Range\n\t\t\t&& !(range instanceof Selection)\n\t\t) {\n\t\t\treturn range;\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tprivate _isValidPosition(lineNumber: number, column: number, validationType: StringOffsetValidationType): boolean {\n\t\tif (typeof lineNumber !== 'number' || typeof column !== 'number') {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isNaN(lineNumber) || isNaN(column)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (lineNumber < 1 || column < 1) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ((lineNumber | 0) !== lineNumber || (column | 0) !== column) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (column === 1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column > maxColumn) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate _validatePosition(_lineNumber: number, _column: number, validationType: StringOffsetValidationType): Position {\n\t\tconst lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1);\n\t\tconst column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1);\n\t\tconst lineCount = this._buffer.getLineCount();\n\n\t\tif (lineNumber < 1) {\n\t\t\treturn new Position(1, 1);\n\t\t}\n\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn new Position(lineCount, this.getLineMaxColumn(lineCount));\n\t\t}\n\n\t\tif (column <= 1) {\n\t\t\treturn new Position(lineNumber, 1);\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column >= maxColumn) {\n\t\t\treturn new Position(lineNumber, maxColumn);\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// If the position would end up in the middle of a high-low surrogate pair,\n\t\t\t// we move it to before the pair\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn new Position(lineNumber, column - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tpublic validatePosition(position: IPosition): Position {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif (position instanceof Position) {\n\t\t\tif (this._isValidPosition(position.lineNumber, position.column, validationType)) {\n\t\t\t\treturn position;\n\t\t\t}\n\t\t}\n\n\t\treturn this._validatePosition(position.lineNumber, position.column, validationType);\n\t}\n\n\tpublic isValidRange(range: Range): boolean {\n\t\treturn this._isValidRange(range, StringOffsetValidationType.SurrogatePairs);\n\t}\n\n\tprivate _isValidRange(range: Range, validationType: StringOffsetValidationType): boolean {\n\t\tconst startLineNumber = range.startLineNumber;\n\t\tconst startColumn = range.startColumn;\n\t\tconst endLineNumber = range.endLineNumber;\n\t\tconst endColumn = range.endColumn;\n\n\t\tif (!this._isValidPosition(startLineNumber, startColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this._isValidPosition(endLineNumber, endColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic validateRange(_range: IRange): Range {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif ((_range instanceof Range) && !(_range instanceof Selection)) {\n\t\t\tif (this._isValidRange(_range, validationType)) {\n\t\t\t\treturn _range;\n\t\t\t}\n\t\t}\n\n\t\tconst start = this._validatePosition(_range.startLineNumber, _range.startColumn, StringOffsetValidationType.Relaxed);\n\t\tconst end = this._validatePosition(_range.endLineNumber, _range.endColumn, StringOffsetValidationType.Relaxed);\n\n\t\tconst startLineNumber = start.lineNumber;\n\t\tconst startColumn = start.column;\n\t\tconst endLineNumber = end.lineNumber;\n\t\tconst endColumn = end.column;\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\tif (startLineNumber === endLineNumber && startColumn === endColumn) {\n\t\t\t\t// do not expand a collapsed range, simply move it to a valid location\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair && endInsideSurrogatePair) {\n\t\t\t\t// expand range at both ends\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair) {\n\t\t\t\t// only expand range at the start\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\t// only expand range at the end\n\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1);\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tpublic modifyPosition(rawPosition: IPosition, offset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst candidate = this.getOffsetAt(rawPosition) + offset;\n\t\treturn this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));\n\t}\n\n\tpublic getFullModelRange(): Range {\n\t\tthis._assertNotDisposed();\n\t\tconst lineCount = this.getLineCount();\n\t\treturn new Range(1, 1, lineCount, this.getLineMaxColumn(lineCount));\n\t}\n\n\tprivate findMatchesLineByLine(searchRange: Range, searchData: model.SearchData, captureMatches: boolean, limitResultCount: number): model.FindMatch[] {\n\t\treturn this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t}\n\n\tpublic findMatches(searchString: string, rawSearchScope: boolean | IRange | IRange[] | null, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount: number = LIMIT_FIND_COUNT): model.FindMatch[] {\n\t\tthis._assertNotDisposed();\n\n\t\tlet searchRanges: Range[] | null = null;\n\n\t\tif (rawSearchScope !== null && typeof rawSearchScope !== 'boolean') {\n\t\t\tif (!Array.isArray(rawSearchScope)) {\n\t\t\t\trawSearchScope = [rawSearchScope];\n\t\t\t}\n\n\t\t\tif (rawSearchScope.every((searchScope: IRange) => Range.isIRange(searchScope))) {\n\t\t\t\tsearchRanges = rawSearchScope.map((searchScope: IRange) => this.validateRange(searchScope));\n\t\t\t}\n\t\t}\n\n\t\tif (searchRanges === null) {\n\t\t\tsearchRanges = [this.getFullModelRange()];\n\t\t}\n\n\t\tsearchRanges = searchRanges.sort((d1, d2) => d1.startLineNumber - d2.startLineNumber || d1.startColumn - d2.startColumn);\n\n\t\tconst uniqueSearchRanges: Range[] = [];\n\t\tuniqueSearchRanges.push(searchRanges.reduce((prev, curr) => {\n\t\t\tif (Range.areIntersecting(prev, curr)) {\n\t\t\t\treturn prev.plusRange(curr);\n\t\t\t}\n\n\t\t\tuniqueSearchRanges.push(prev);\n\t\t\treturn curr;\n\t\t}));\n\n\t\tlet matchMapper: (value: Range, index: number, array: Range[]) => model.FindMatch[];\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\t// not regex, not multi line\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\n\t\t\tif (!searchData) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tmatchMapper = (searchRange: Range) => this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t\t} else {\n\t\t\tmatchMapper = (searchRange: Range) => TextModelSearch.findMatches(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchRange, captureMatches, limitResultCount);\n\t\t}\n\n\t\treturn uniqueSearchRanges.map(matchMapper).reduce((arr, matches: model.FindMatch[]) => arr.concat(matches), []);\n\t}\n\n\tpublic findNextMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\t\t\tif (!searchData) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst lineCount = this.getLineCount();\n\t\t\tlet searchRange = new Range(searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));\n\t\t\tlet ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\t\t\tTextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\tsearchRange = new Range(1, 1, searchStart.lineNumber, this.getLineMaxColumn(searchStart.lineNumber));\n\t\t\tret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\tpublic findPreviousMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\t\treturn TextModelSearch.findPreviousMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\t//#endregion\n\n\t//#region Editing\n\n\tpublic pushStackElement(): void {\n\t\tthis._commandManager.pushStackElement();\n\t}\n\n\tpublic popStackElement(): void {\n\t\tthis._commandManager.popStackElement();\n\t}\n\n\tpublic pushEOL(eol: model.EndOfLineSequence): void {\n\t\tconst currentEOL = (this.getEOL() === '\\n' ? model.EndOfLineSequence.LF : model.EndOfLineSequence.CRLF);\n\t\tif (currentEOL === eol) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t\t}\n\t\t\tthis._commandManager.pushEOL(eol);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _validateEditOperation(rawOperation: model.IIdentifiedSingleEditOperation): model.ValidAnnotatedEditOperation {\n\t\tif (rawOperation instanceof model.ValidAnnotatedEditOperation) {\n\t\t\treturn rawOperation;\n\t\t}\n\t\treturn new model.ValidAnnotatedEditOperation(\n\t\t\trawOperation.identifier || null,\n\t\t\tthis.validateRange(rawOperation.range),\n\t\t\trawOperation.text,\n\t\t\trawOperation.forceMoveMarkers || false,\n\t\t\trawOperation.isAutoWhitespaceEdit || false,\n\t\t\trawOperation._isTracked || false\n\t\t);\n\t}\n\n\tprivate _validateEditOperations(rawOperations: readonly model.IIdentifiedSingleEditOperation[]): model.ValidAnnotatedEditOperation[] {\n\t\tconst result: model.ValidAnnotatedEditOperation[] = [];\n\t\tfor (let i = 0, len = rawOperations.length; i < len; i++) {\n\t\t\tresult[i] = this._validateEditOperation(rawOperations[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.IIdentifiedSingleEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\treturn this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer, group, reason);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.ValidAnnotatedEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\tif (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {\n\t\t\t// Go through each saved line number and insert a trim whitespace edit\n\t\t\t// if it is safe to do so (no conflicts with other edits).\n\n\t\t\tconst incomingEdits = editOperations.map((op) => {\n\t\t\t\treturn {\n\t\t\t\t\trange: this.validateRange(op.range),\n\t\t\t\t\ttext: op.text\n\t\t\t\t};\n\t\t\t});\n\n\t\t\t// Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor\n\t\t\t// We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace\n\t\t\tlet editsAreNearCursors = true;\n\t\t\tif (beforeCursorState) {\n\t\t\t\tfor (let i = 0, len = beforeCursorState.length; i < len; i++) {\n\t\t\t\t\tconst sel = beforeCursorState[i];\n\t\t\t\t\tlet foundEditNearSel = false;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst selIsAbove = editRange.startLineNumber > sel.endLineNumber;\n\t\t\t\t\t\tconst selIsBelow = sel.startLineNumber > editRange.endLineNumber;\n\t\t\t\t\t\tif (!selIsAbove && !selIsBelow) {\n\t\t\t\t\t\t\tfoundEditNearSel = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!foundEditNearSel) {\n\t\t\t\t\t\teditsAreNearCursors = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (editsAreNearCursors) {\n\t\t\t\tfor (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {\n\t\t\t\t\tconst trimLineNumber = this._trimAutoWhitespaceLines[i];\n\t\t\t\t\tconst maxLineColumn = this.getLineMaxColumn(trimLineNumber);\n\n\t\t\t\t\tlet allowTrimLine = true;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst editText = incomingEdits[j].text;\n\n\t\t\t\t\t\tif (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {\n\t\t\t\t\t\t\t// `trimLine` is completely outside this edit\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// At this point:\n\t\t\t\t\t\t// editRange.startLineNumber <= trimLine <= editRange.endLineNumber\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) after `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === 1\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) before `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Looks like we can't trim this line as it would interfere with an incoming edit\n\t\t\t\t\t\tallowTrimLine = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (allowTrimLine) {\n\t\t\t\t\t\tconst trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn);\n\t\t\t\t\t\teditOperations.push(new model.ValidAnnotatedEditOperation(null, trimRange, null, false, false, false));\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._trimAutoWhitespaceLines = null;\n\t\t}\n\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t}\n\t\treturn this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group, reason);\n\t}\n\n\t_applyUndo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.newPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.newEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.oldText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\t_applyRedo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.oldPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.oldEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.newText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, false, true, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\tprivate _applyUndoRedoEdits(edits: ISingleEditOperation[], eol: model.EndOfLineSequence, isUndoing: boolean, isRedoing: boolean, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tthis._isUndoing = isUndoing;\n\t\t\tthis._isRedoing = isRedoing;\n\t\t\tthis.applyEdits(edits, false);\n\t\t\tthis.setEOL(eol);\n\t\t\tthis._overwriteAlternativeVersionId(resultingAlternativeVersionId);\n\t\t} finally {\n\t\t\tthis._isUndoing = false;\n\t\t\tthis._isRedoing = false;\n\t\t\tthis._eventEmitter.endDeferredEmit(resultingSelection);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[]): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true): model.IValidEditOperation[];\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false, reason: TextModelEditSource): void;\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true, reason: TextModelEditSource): model.IValidEditOperation[];\n\tpublic applyEdits(rawOperations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits?: boolean, reason?: TextModelEditSource): void | model.IValidEditOperation[] {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tconst operations = this._validateEditOperations(rawOperations);\n\n\t\t\treturn this._doApplyEdits(operations, computeUndoEdits ?? false, reason ?? EditSources.applyEdits());\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _doApplyEdits(rawOperations: model.ValidAnnotatedEditOperation[], computeUndoEdits: boolean, reason: TextModelEditSource): void | model.IValidEditOperation[] {\n\n\t\tconst oldLineCount = this._buffer.getLineCount();\n\t\tconst result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace, computeUndoEdits);\n\t\tconst newLineCount = this._buffer.getLineCount();\n\n\t\tconst contentChanges = result.changes;\n\t\tthis._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;\n\n\t\tif (contentChanges.length !== 0) {\n\t\t\t// We do a first pass to update decorations\n\t\t\t// because we want to read decorations in the second pass\n\t\t\t// where we will emit content change events\n\t\t\t// and we want to read the final decorations\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tthis._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);\n\t\t\t}\n\n\t\t\tconst rawContentChanges: ModelRawChange[] = [];\n\n\t\t\tthis._increaseVersionId();\n\n\t\t\tlet lineCount = oldLineCount;\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tconst [eolCount] = countEOL(change.text);\n\t\t\t\tthis._onDidChangeDecorations.fire();\n\n\t\t\t\tconst startLineNumber = change.range.startLineNumber;\n\t\t\t\tconst endLineNumber = change.range.endLineNumber;\n\n\t\t\t\tconst deletingLinesCnt = endLineNumber - startLineNumber;\n\t\t\t\tconst insertingLinesCnt = eolCount;\n\t\t\t\tconst editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);\n\n\t\t\t\tconst changeLineCountDelta = (insertingLinesCnt - deletingLinesCnt);\n\n\t\t\t\tconst currentEditStartLineNumber = newLineCount - lineCount - changeLineCountDelta + startLineNumber;\n\t\t\t\tconst firstEditLineNumber = currentEditStartLineNumber;\n\t\t\t\tconst lastInsertedLineNumber = currentEditStartLineNumber + insertingLinesCnt;\n\n\t\t\t\tconst decorationsWithInjectedTextInEditedRange = this._decorationsTree.getInjectedTextInInterval(\n\t\t\t\t\tthis,\n\t\t\t\t\tthis.getOffsetAt(new Position(firstEditLineNumber, 1)),\n\t\t\t\t\tthis.getOffsetAt(new Position(lastInsertedLineNumber, this.getLineMaxColumn(lastInsertedLineNumber))),\n\t\t\t\t\t0\n\t\t\t\t);\n\n\n\t\t\t\tconst injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);\n\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\n\t\t\t\tfor (let j = editingLinesCnt; j >= 0; j--) {\n\t\t\t\t\tconst editLineNumber = startLineNumber + j;\n\t\t\t\t\tconst currentEditLineNumber = currentEditStartLineNumber + j;\n\n\t\t\t\t\tinjectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber > currentEditLineNumber);\n\t\t\t\t\tconst decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber === currentEditLineNumber);\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLineChanged(\n\t\t\t\t\t\t\teditLineNumber,\n\t\t\t\t\t\t\tthis.getLineContent(currentEditLineNumber),\n\t\t\t\t\t\t\tdecorationsInCurrentLine\n\t\t\t\t\t\t));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < deletingLinesCnt) {\n\t\t\t\t\t// Must delete some lines\n\t\t\t\t\tconst spliceStartLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\trawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < insertingLinesCnt) {\n\t\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\t\t\t\t\t// Must insert some lines\n\t\t\t\t\tconst spliceLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\tconst cnt = insertingLinesCnt - editingLinesCnt;\n\t\t\t\t\tconst fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;\n\t\t\t\t\tconst injectedTexts: (LineInjectedText[] | null)[] = [];\n\t\t\t\t\tconst newLines: string[] = [];\n\t\t\t\t\tfor (let i = 0; i < cnt; i++) {\n\t\t\t\t\t\tconst lineNumber = fromLineNumber + i;\n\t\t\t\t\t\tnewLines[i] = this.getLineContent(lineNumber);\n\n\t\t\t\t\t\tinjectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber < lineNumber);\n\t\t\t\t\t\tinjectedTexts[i] = injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber === lineNumber);\n\t\t\t\t\t}\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLinesInserted(\n\t\t\t\t\t\t\tspliceLineNumber + 1,\n\t\t\t\t\t\t\tstartLineNumber + insertingLinesCnt,\n\t\t\t\t\t\t\tnewLines,\n\t\t\t\t\t\t\tinjectedTexts\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlineCount += changeLineCountDelta;\n\t\t\t}\n\n\t\t\tthis._emitContentChangedEvent(\n\t\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t\trawContentChanges,\n\t\t\t\t\tthis.getVersionId(),\n\t\t\t\t\tthis._isUndoing,\n\t\t\t\t\tthis._isRedoing\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tchanges: contentChanges,\n\t\t\t\t\teol: this._buffer.getEOL(),\n\t\t\t\t\tisEolChange: false,\n\t\t\t\t\tversionId: this.getVersionId(),\n\t\t\t\t\tisUndoing: this._isUndoing,\n\t\t\t\t\tisRedoing: this._isRedoing,\n\t\t\t\t\tisFlush: false,\n\t\t\t\t\tdetailedReasons: [reason],\n\t\t\t\t\tdetailedReasonsChangeLengths: [contentChanges.length],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn (result.reverseEdits === null ? undefined : result.reverseEdits);\n\t}\n\n\tpublic undo(): void | Promise<void> {\n\t\treturn this._undoRedoService.undo(this.uri);\n\t}\n\n\tpublic canUndo(): boolean {\n\t\treturn this._undoRedoService.canUndo(this.uri);\n\t}\n\n\tpublic redo(): void | Promise<void> {\n\t\treturn this._undoRedoService.redo(this.uri);\n\t}\n\n\tpublic canRedo(): boolean {\n\t\treturn this._undoRedoService.canRedo(this.uri);\n\t}\n\n\t//#endregion\n\n\t//#region Decorations\n\n\tprivate handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines: Set<number> | null, affectedLineHeights: Set<LineHeightChangingDecoration> | null, affectedFontLines: Set<LineFontChangingDecoration> | null): void {\n\t\t// This is called before the decoration changed event is fired.\n\n\t\tif (affectedInjectedTextLines && affectedInjectedTextLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedInjectedTextLines);\n\t\t\tconst lineChangeEvents = affectedLines.map(lineNumber => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));\n\t\t\tthis._onDidChangeInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));\n\t\t}\n\t\tif (affectedLineHeights && affectedLineHeights.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedLineHeights);\n\t\t\tconst lineHeightChangeEvent = affectedLines.map(specialLineHeightChange => new ModelLineHeightChanged(specialLineHeightChange.ownerId, specialLineHeightChange.decorationId, specialLineHeightChange.lineNumber, specialLineHeightChange.lineHeight));\n\t\t\tthis._onDidChangeLineHeight.fire(new ModelLineHeightChangedEvent(lineHeightChangeEvent));\n\t\t}\n\t\tif (affectedFontLines && affectedFontLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedFontLines);\n\t\t\tconst fontChangeEvent = affectedLines.map(fontChange => new ModelFontChanged(fontChange.ownerId, fontChange.lineNumber));\n\t\t\tthis._onDidChangeFont.fire(new ModelFontChangedEvent(fontChangeEvent));\n\t\t}\n\t}\n\n\tpublic changeDecorations<T>(callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T, ownerId: number = 0): T | null {\n\t\tthis._assertNotDisposed();\n\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._changeDecorations(ownerId, callback);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _changeDecorations<T>(ownerId: number, callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T): T | null {\n\t\tconst changeAccessor: model.IModelDecorationsChangeAccessor = {\n\t\t\taddDecoration: (range: IRange, options: model.IModelDecorationOptions): string => {\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0];\n\t\t\t},\n\t\t\tchangeDecoration: (id: string, newRange: IRange): void => {\n\t\t\t\tthis._changeDecorationImpl(ownerId, id, newRange);\n\t\t\t},\n\t\t\tchangeDecorationOptions: (id: string, options: model.IModelDecorationOptions) => {\n\t\t\t\tthis._changeDecorationOptionsImpl(ownerId, id, _normalizeOptions(options));\n\t\t\t},\n\t\t\tremoveDecoration: (id: string): void => {\n\t\t\t\tthis._deltaDecorationsImpl(ownerId, [id], []);\n\t\t\t},\n\t\t\tdeltaDecorations: (oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[]): string[] => {\n\t\t\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t\t\t// nothing to do\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t\t}\n\t\t};\n\t\tlet result: T | null = null;\n\t\ttry {\n\t\t\tresult = callback(changeAccessor);\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t\t// Invalidate change accessor\n\t\tchangeAccessor.addDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecorationOptions = invalidFunc;\n\t\tchangeAccessor.removeDecoration = invalidFunc;\n\t\tchangeAccessor.deltaDecorations = invalidFunc;\n\t\treturn result;\n\t}\n\n\tpublic deltaDecorations(oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[], ownerId: number = 0): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (!oldDecorations) {\n\t\t\toldDecorations = [];\n\t\t}\n\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t// nothing to do\n\t\t\treturn [];\n\t\t}\n\n\t\ttry {\n\t\t\tthis._deltaDecorationCallCnt++;\n\t\t\tif (this._deltaDecorationCallCnt > 1) {\n\t\t\t\tconsole.warn(`Invoking deltaDecorations recursively could lead to leaking decorations.`);\n\t\t\t\tonUnexpectedError(new Error(`Invoking deltaDecorations recursively could lead to leaking decorations.`));\n\t\t\t}\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t\tthis._deltaDecorationCallCnt--;\n\t\t}\n\t}\n\n\t_getTrackedRange(id: string): Range | null {\n\t\treturn this.getDecorationRange(id);\n\t}\n\n\t_setTrackedRange(id: string | null, newRange: null, newStickiness: model.TrackedRangeStickiness): null;\n\t_setTrackedRange(id: string | null, newRange: Range, newStickiness: model.TrackedRangeStickiness): string;\n\t_setTrackedRange(id: string | null, newRange: Range | null, newStickiness: model.TrackedRangeStickiness): string | null {\n\t\tconst node = (id ? this._decorations[id] : null);\n\n\t\tif (!node) {\n\t\t\tif (!newRange) {\n\t\t\t\t// node doesn't exist, the request is to delete => nothing to do\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// node doesn't exist, the request is to set => add the tracked range\n\t\t\treturn this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }], true)[0];\n\t\t}\n\n\t\tif (!newRange) {\n\t\t\t// node exists, the request is to delete => delete node\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t\treturn null;\n\t\t}\n\n\t\t// node exists, the request is to set => change the tracked range and its options\n\t\tconst range = this._validateRangeRelaxedNoAllocations(newRange);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tnode.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);\n\t\tthis._decorationsTree.insert(node);\n\t\treturn node.id;\n\t}\n\n\tpublic removeAllDecorationsWithOwnerId(ownerId: number): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tconst nodes = this._decorationsTree.collectNodesFromOwner(ownerId);\n\t\tfor (let i = 0, len = nodes.length; i < len; i++) {\n\t\t\tconst node = nodes[i];\n\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t}\n\t}\n\n\tpublic getDecorationOptions(decorationId: string): model.IModelDecorationOptions | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn node.options;\n\t}\n\n\tpublic getDecorationRange(decorationId: string): Range | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this._decorationsTree.getNodeRange(this, node);\n\t}\n\n\tpublic getLineDecorations(lineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\treturn [];\n\t\t}\n\t\treturn this.getLinesDecorations(lineNumber, lineNumber, ownerId, filterOutValidation, filterFontDecorations);\n\t}\n\n\tpublic getLinesDecorations(_startLineNumber: number, _endLineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst lineCount = this.getLineCount();\n\t\tconst startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));\n\t\tconst endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\t\tconst range = new Range(startLineNumber, 1, endLineNumber, endColumn);\n\n\t\tconst decorations = this._getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation));\n\t\treturn decorations;\n\t}\n\n\tpublic getDecorationsInRange(range: IRange, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMinimapDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst validatedRange = this.validateRange(range);\n\n\t\tconst decorations = this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));\n\t\treturn decorations;\n\t}\n\n\tpublic getOverviewRulerDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, true, false);\n\t}\n\n\tpublic getInjectedTextDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllInjectedText(this, ownerId);\n\t}\n\n\tpublic getCustomLineHeightsDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllCustomLineHeights(this, ownerId);\n\t}\n\n\tprivate _getInjectedTextInLine(lineNumber: number): LineInjectedText[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(lineNumber, 1);\n\t\tconst endOffset = startOffset + this._buffer.getLineLength(lineNumber);\n\n\t\tconst result = this._decorationsTree.getInjectedTextInInterval(this, startOffset, endOffset, 0);\n\t\treturn LineInjectedText.fromDecorations(result).filter(t => t.lineNumber === lineNumber);\n\t}\n\n\tpublic getFontDecorationsInRange(range: IRange, ownerId: number = 0): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\treturn this._decorationsTree.getFontDecorationsInInterval(this, startOffset, endOffset, ownerId);\n\t}\n\n\tpublic getAllDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tlet result = this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, false, false);\n\t\tresult = result.concat(this._decorationProvider.getAllDecorations(ownerId, filterOutValidation));\n\t\treturn result;\n\t}\n\n\tpublic getAllMarginDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, false, false, false, true);\n\t}\n\n\tprivate _getDecorationsInRange(filterRange: Range, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);\n\t\treturn this._decorationsTree.getAllInInterval(this, startOffset, endOffset, filterOwnerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t}\n\n\tpublic getRangeAt(start: number, end: number): Range {\n\t\treturn this._buffer.getRangeAt(start, end - start);\n\t}\n\n\tprivate _changeDecorationImpl(ownerId: number, decorationId: string, _range: IRange): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (node.options.after) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, oldRange!.startLineNumber, null);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, oldRange!.startLineNumber);\n\t\t}\n\n\t\tconst range = this._validateRangeRelaxedNoAllocations(_range);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tthis._decorationsTree.insert(node);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\n\t\tif (node.options.after) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, range.startLineNumber, node.options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t}\n\t}\n\n\tprivate _changeDecorationOptionsImpl(ownerId: number, decorationId: string, options: ModelDecorationOptions): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n\t\tconst nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);\n\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\n\t\tif (node.options.after || options.after) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t}\n\t\tif (node.options.before || options.before) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null || options.lineHeight !== null) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont || options.affectsFont) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t}\n\n\t\tconst movedInOverviewRuler = nodeWasInOverviewRuler !== nodeIsInOverviewRuler;\n\t\tconst changedWhetherInjectedText = isOptionsInjectedText(options) !== isNodeInjectedText(node);\n\t\tif (movedInOverviewRuler || changedWhetherInjectedText) {\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tnode.setOptions(options);\n\t\t\tthis._decorationsTree.insert(node);\n\t\t} else {\n\t\t\tnode.setOptions(options);\n\t\t}\n\t}\n\n\tprivate _deltaDecorationsImpl(ownerId: number, oldDecorationsIds: string[], newDecorations: model.IModelDeltaDecoration[], suppressEvents: boolean = false): string[] {\n\t\tconst versionId = this.getVersionId();\n\n\t\tconst oldDecorationsLen = oldDecorationsIds.length;\n\t\tlet oldDecorationIndex = 0;\n\n\t\tconst newDecorationsLen = newDecorations.length;\n\t\tlet newDecorationIndex = 0;\n\n\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\ttry {\n\t\t\tconst result = new Array<string>(newDecorationsLen);\n\t\t\twhile (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {\n\n\t\t\t\tlet node: IntervalNode | null = null;\n\n\t\t\t\tif (oldDecorationIndex < oldDecorationsLen) {\n\t\t\t\t\t// (1) get ourselves an old node\n\t\t\t\t\tlet decorationId: string;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tdecorationId = oldDecorationsIds[oldDecorationIndex++];\n\t\t\t\t\t\tnode = this._decorations[decorationId];\n\t\t\t\t\t} while (!node && oldDecorationIndex < oldDecorationsLen);\n\n\t\t\t\t\t// (2) remove the node from the tree (if it exists)\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, null);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._decorationsTree.delete(node);\n\n\t\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newDecorationIndex < newDecorationsLen) {\n\t\t\t\t\t// (3) create a new node if necessary\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tconst internalDecorationId = (++this._lastDecorationId);\n\t\t\t\t\t\tconst decorationId = `${this._instanceId};${internalDecorationId}`;\n\t\t\t\t\t\tnode = new IntervalNode(decorationId, 0, 0);\n\t\t\t\t\t\tthis._decorations[decorationId] = node;\n\t\t\t\t\t}\n\n\t\t\t\t\t// (4) initialize node\n\t\t\t\t\tconst newDecoration = newDecorations[newDecorationIndex];\n\t\t\t\t\tconst range = this._validateRangeRelaxedNoAllocations(newDecoration.range);\n\t\t\t\t\tconst options = _normalizeOptions(newDecoration.options);\n\t\t\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\t\t\tnode.ownerId = ownerId;\n\t\t\t\t\tnode.reset(versionId, startOffset, endOffset, range);\n\t\t\t\t\tnode.setOptions(options);\n\n\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, node.id, range.startLineNumber, node.options.lineHeight);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._decorationsTree.insert(node);\n\n\t\t\t\t\tresult[newDecorationIndex] = node.id;\n\n\t\t\t\t\tnewDecorationIndex++;\n\t\t\t\t} else {\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tdelete this._decorations[node.id];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region Tokenization\n\n\t// TODO move them to the tokenization part.\n\tpublic getLanguageId(): string {\n\t\treturn this.tokenization.getLanguageId();\n\t}\n\n\tpublic setLanguage(languageIdOrSelection: string | ILanguageSelection, source?: string): void {\n\t\tif (typeof languageIdOrSelection === 'string') {\n\t\t\tthis._languageSelectionListener.clear();\n\t\t\tthis._setLanguage(languageIdOrSelection, source);\n\t\t} else {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId, source));\n\t\t\tthis._setLanguage(languageIdOrSelection.languageId, source);\n\t\t}\n\t}\n\n\tprivate _setLanguage(languageId: string, source?: string): void {\n\t\tthis.tokenization.setLanguageId(languageId, source);\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\t}\n\n\tpublic getLanguageIdAtPosition(lineNumber: number, column: number): string {\n\t\treturn this.tokenization.getLanguageIdAtPosition(lineNumber, column);\n\t}\n\n\tpublic getWordAtPosition(position: IPosition): IWordAtPosition | null {\n\t\treturn this._tokenizationTextModelPart.getWordAtPosition(position);\n\t}\n\n\tpublic getWordUntilPosition(position: IPosition): IWordAtPosition {\n\t\treturn this._tokenizationTextModelPart.getWordUntilPosition(position);\n\t}\n\n\t//#endregion\n\tnormalizePosition(position: Position, affinity: model.PositionAffinity): Position {\n\t\treturn position;\n\t}\n\n\t/**\n\t * Gets the column at which indentation stops at a given line.\n\t * @internal\n\t*/\n\tpublic getLineIndentColumn(lineNumber: number): number {\n\t\t// Columns start with 1.\n\t\treturn indentOfLine(this.getLineContent(lineNumber)) + 1;\n\t}\n\n\tpublic override toString(): string {\n\t\treturn `TextModel(${this.uri.toString()})`;\n\t}\n}\n\nexport function indentOfLine(line: string): number {\n\tlet indent = 0;\n\tfor (const c of line) {\n\t\tif (c === ' ' || c === '\\t') {\n\t\t\tindent++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn indent;\n}\n\n//#region Decorations\n\nfunction isNodeInOverviewRuler(node: IntervalNode): boolean {\n\treturn (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n}\n\nfunction isOptionsInjectedText(options: ModelDecorationOptions): boolean {\n\treturn !!options.after || !!options.before;\n}\n\nfunction isNodeInjectedText(node: IntervalNode): boolean {\n\treturn !!node.options.after || !!node.options.before;\n}\n\nexport interface IDecorationsTreesHost {\n\tgetVersionId(): number;\n\tgetRangeAt(start: number, end: number): Range;\n}\n\nclass DecorationsTrees {\n\n\t/**\n\t * This tree holds decorations that do not show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree0: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree1: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that contain injected text.\n\t */\n\tprivate readonly _injectedTextDecorationsTree: IntervalTree;\n\n\tconstructor() {\n\t\tthis._decorationsTree0 = new IntervalTree();\n\t\tthis._decorationsTree1 = new IntervalTree();\n\t\tthis._injectedTextDecorationsTree = new IntervalTree();\n\t}\n\n\tpublic ensureAllNodesHaveRanges(host: IDecorationsTreesHost): void {\n\t\tthis.getAll(host, 0, false, false, false, false);\n\t}\n\n\tprivate _ensureNodesHaveRanges(host: IDecorationsTreesHost, nodes: IntervalNode[]): model.IModelDecoration[] {\n\t\tfor (const node of nodes) {\n\t\t\tif (node.range === null) {\n\t\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t\t}\n\t\t}\n\t\treturn <model.IModelDecoration[]>nodes;\n\t}\n\n\tpublic getAllInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _intervalSearch(start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r2 = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic getInjectedTextInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getFontDecorationsInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst decorations = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, decorations).filter((i) => i.options.affectsFont);\n\t}\n\n\tpublic getAllInjectedText(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.search(filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getAllCustomLineHeights(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, false, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => typeof i.options.lineHeight === 'number');\n\t}\n\n\tpublic getAll(host: IDecorationsTreesHost, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, filterOutValidation, filterFontDecorations, overviewRulerOnly, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _search(filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tif (overviewRulerOnly) {\n\t\t\treturn this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t} else {\n\t\t\tconst r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r2 = this._injectedTextDecorationsTree.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\treturn r0.concat(r1).concat(r2);\n\t\t}\n\t}\n\n\tpublic collectNodesFromOwner(ownerId: number): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesFromOwner(ownerId);\n\t\tconst r1 = this._decorationsTree1.collectNodesFromOwner(ownerId);\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesFromOwner(ownerId);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic collectNodesPostOrder(): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesPostOrder();\n\t\tconst r1 = this._decorationsTree1.collectNodesPostOrder();\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic insert(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.insert(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.insert(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.insert(node);\n\t\t}\n\t}\n\n\tpublic delete(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.delete(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.delete(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.delete(node);\n\t\t}\n\t}\n\n\tpublic getNodeRange(host: IDecorationsTreesHost, node: IntervalNode): Range {\n\t\tconst versionId = host.getVersionId();\n\t\tif (node.cachedVersionId !== versionId) {\n\t\t\tthis._resolveNode(node, versionId);\n\t\t}\n\t\tif (node.range === null) {\n\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t}\n\t\treturn node.range;\n\t}\n\n\tprivate _resolveNode(node: IntervalNode, cachedVersionId: number): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.resolveNode(node, cachedVersionId);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.resolveNode(node, cachedVersionId);\n\t\t} else {\n\t\t\tthis._decorationsTree0.resolveNode(node, cachedVersionId);\n\t\t}\n\t}\n\n\tpublic acceptReplace(offset: number, length: number, textLength: number, forceMoveMarkers: boolean): void {\n\t\tthis._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._injectedTextDecorationsTree.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t}\n}\n\nfunction cleanClassName(className: string): string {\n\treturn className.replace(/[^a-z0-9\\-_]/gi, ' ');\n}\n\nclass DecorationOptions implements model.IDecorationOptions {\n\treadonly color: string | ThemeColor;\n\treadonly darkColor: string | ThemeColor;\n\n\tconstructor(options: model.IDecorationOptions) {\n\t\tthis.color = options.color || '';\n\t\tthis.darkColor = options.darkColor || '';\n\n\t}\n}\n\nexport class ModelDecorationOverviewRulerOptions extends DecorationOptions {\n\treadonly position: model.OverviewRulerLane;\n\tprivate _resolvedColor: string | null;\n\n\tconstructor(options: model.IModelDecorationOverviewRulerOptions) {\n\t\tsuper(options);\n\t\tthis._resolvedColor = null;\n\t\tthis.position = (typeof options.position === 'number' ? options.position : model.OverviewRulerLane.Center);\n\t}\n\n\tpublic getColor(theme: IColorTheme): string {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = null;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): string {\n\t\tif (typeof color === 'string') {\n\t\t\treturn color;\n\t\t}\n\t\tconst c = color ? theme.getColor(color.id) : null;\n\t\tif (!c) {\n\t\t\treturn '';\n\t\t}\n\t\treturn c.toString();\n\t}\n}\n\nexport class ModelDecorationGlyphMarginOptions {\n\treadonly position: model.GlyphMarginLane;\n\treadonly persistLane: boolean | undefined;\n\n\tconstructor(options: model.IModelDecorationGlyphMarginOptions | null | undefined) {\n\t\tthis.position = options?.position ?? model.GlyphMarginLane.Center;\n\t\tthis.persistLane = options?.persistLane;\n\t}\n}\n\nexport class ModelDecorationMinimapOptions extends DecorationOptions {\n\treadonly position: model.MinimapPosition;\n\treadonly sectionHeaderStyle: model.MinimapSectionHeaderStyle | null;\n\treadonly sectionHeaderText: string | null;\n\tprivate _resolvedColor: Color | undefined;\n\n\tconstructor(options: model.IModelDecorationMinimapOptions) {\n\t\tsuper(options);\n\t\tthis.position = options.position;\n\t\tthis.sectionHeaderStyle = options.sectionHeaderStyle ?? null;\n\t\tthis.sectionHeaderText = options.sectionHeaderText ?? null;\n\t}\n\n\tpublic getColor(theme: IColorTheme): Color | undefined {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = undefined;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): Color | undefined {\n\t\tif (typeof color === 'string') {\n\t\t\treturn Color.fromHex(color);\n\t\t}\n\t\treturn theme.getColor(color.id);\n\t}\n}\n\nexport class ModelDecorationInjectedTextOptions implements model.InjectedTextOptions {\n\tpublic static from(options: model.InjectedTextOptions): ModelDecorationInjectedTextOptions {\n\t\tif (options instanceof ModelDecorationInjectedTextOptions) {\n\t\t\treturn options;\n\t\t}\n\t\treturn new ModelDecorationInjectedTextOptions(options);\n\t}\n\n\tpublic readonly content: string;\n\tpublic readonly tokens: TokenArray | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly attachedData: unknown | null;\n\treadonly cursorStops: model.InjectedTextCursorStops | null;\n\n\tprivate constructor(options: model.InjectedTextOptions) {\n\t\tthis.content = options.content || '';\n\t\tthis.tokens = options.tokens ?? null;\n\t\tthis.inlineClassName = options.inlineClassName || null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.attachedData = options.attachedData || null;\n\t\tthis.cursorStops = options.cursorStops || null;\n\t}\n}\n\nexport class ModelDecorationOptions implements model.IModelDecorationOptions {\n\n\tpublic static EMPTY: ModelDecorationOptions;\n\n\tpublic static register(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\n\tpublic static createDynamic(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\treadonly description: string;\n\treadonly blockClassName: string | null;\n\treadonly blockIsAfterEnd: boolean | null;\n\treadonly blockDoesNotCollapse?: boolean | null;\n\treadonly blockPadding: [top: number, right: number, bottom: number, left: number] | null;\n\treadonly stickiness: model.TrackedRangeStickiness;\n\treadonly zIndex: number;\n\treadonly className: string | null;\n\treadonly shouldFillLineOnLineBreak: boolean | null;\n\treadonly hoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly glyphMarginHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly isWholeLine: boolean;\n\treadonly lineHeight: number | null;\n\treadonly fontSize: string | null;\n\treadonly showIfCollapsed: boolean;\n\treadonly collapseOnReplaceEdit: boolean;\n\treadonly overviewRuler: ModelDecorationOverviewRulerOptions | null;\n\treadonly minimap: ModelDecorationMinimapOptions | null;\n\treadonly glyphMargin?: model.IModelDecorationGlyphMarginOptions | null | undefined;\n\treadonly glyphMarginClassName: string | null;\n\treadonly linesDecorationsClassName: string | null;\n\treadonly lineNumberClassName: string | null;\n\treadonly lineNumberHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly linesDecorationsTooltip: string | null;\n\treadonly firstLineDecorationClassName: string | null;\n\treadonly marginClassName: string | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly beforeContentClassName: string | null;\n\treadonly afterContentClassName: string | null;\n\treadonly after: ModelDecorationInjectedTextOptions | null;\n\treadonly before: ModelDecorationInjectedTextOptions | null;\n\treadonly hideInCommentTokens: boolean | null;\n\treadonly hideInStringTokens: boolean | null;\n\treadonly affectsFont: boolean | null;\n\treadonly textDirection?: model.TextDirection | null | undefined;\n\n\tprivate constructor(options: model.IModelDecorationOptions) {\n\t\tthis.description = options.description;\n\t\tthis.blockClassName = options.blockClassName ? cleanClassName(options.blockClassName) : null;\n\t\tthis.blockDoesNotCollapse = options.blockDoesNotCollapse ?? null;\n\t\tthis.blockIsAfterEnd = options.blockIsAfterEnd ?? null;\n\t\tthis.blockPadding = options.blockPadding ?? null;\n\t\tthis.stickiness = options.stickiness || model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;\n\t\tthis.zIndex = options.zIndex || 0;\n\t\tthis.className = options.className ? cleanClassName(options.className) : null;\n\t\tthis.shouldFillLineOnLineBreak = options.shouldFillLineOnLineBreak ?? null;\n\t\tthis.hoverMessage = options.hoverMessage || null;\n\t\tthis.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;\n\t\tthis.lineNumberHoverMessage = options.lineNumberHoverMessage || null;\n\t\tthis.isWholeLine = options.isWholeLine || false;\n\t\tthis.lineHeight = options.lineHeight ? Math.min(options.lineHeight, LINE_HEIGHT_CEILING) : null;\n\t\tthis.fontSize = options.fontSize || null;\n\t\tthis.affectsFont = !!options.fontSize || !!options.fontFamily || !!options.fontWeight || !!options.fontStyle;\n\t\tthis.showIfCollapsed = options.showIfCollapsed || false;\n\t\tthis.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;\n\t\tthis.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;\n\t\tthis.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;\n\t\tthis.glyphMargin = options.glyphMarginClassName ? new ModelDecorationGlyphMarginOptions(options.glyphMargin) : null;\n\t\tthis.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;\n\t\tthis.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;\n\t\tthis.lineNumberClassName = options.lineNumberClassName ? cleanClassName(options.lineNumberClassName) : null;\n\t\tthis.linesDecorationsTooltip = options.linesDecorationsTooltip ? strings.htmlAttributeEncodeValue(options.linesDecorationsTooltip) : null;\n\t\tthis.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;\n\t\tthis.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;\n\t\tthis.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;\n\t\tthis.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;\n\t\tthis.after = options.after ? ModelDecorationInjectedTextOptions.from(options.after) : null;\n\t\tthis.before = options.before ? ModelDecorationInjectedTextOptions.from(options.before) : null;\n\t\tthis.hideInCommentTokens = options.hideInCommentTokens ?? false;\n\t\tthis.hideInStringTokens = options.hideInStringTokens ?? false;\n\t\tthis.textDirection = options.textDirection ?? null;\n\t}\n}\nModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: 'empty' });\n\n/**\n * The order carefully matches the values of the enum.\n */\nconst TRACKED_RANGE_OPTIONS = [\n\tModelDecorationOptions.register({ description: 'tracked-range-always-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-never-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-before', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-after', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter }),\n];\n\nfunction _normalizeOptions(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\tif (options instanceof ModelDecorationOptions) {\n\t\treturn options;\n\t}\n\treturn ModelDecorationOptions.createDynamic(options);\n}\n\nclass LineHeightChangingDecoration {\n\n\tpublic static toKey(obj: LineHeightChangingDecoration): string {\n\t\treturn `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;\n\t}\n\n\tconstructor(\n\t\tpublic readonly ownerId: number,\n\t\tpublic readonly decorationId: string,\n\t\tpublic readonly lineNumber: number,\n\t\tpublic readonly lineHeight: number | null\n\t) { }\n}\n\nclass LineFontChangingDecoration {\n\n\tpublic static toKey(obj: LineFontChangingDecoration): string {\n\t\treturn `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;\n\t}\n\n\tconstructor(\n\t\tpublic readonly ownerId: number,\n\t\tpublic readonly decorationId: string,\n\t\tpublic readonly lineNumber: number\n\t) { }\n}\n\nclass DidChangeDecorationsEmitter extends Disposable {\n\n\tprivate readonly _actual: Emitter<IModelDecorationsChangedEvent> = this._register(new Emitter<IModelDecorationsChangedEvent>());\n\tpublic readonly event: Event<IModelDecorationsChangedEvent> = this._actual.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _shouldFireDeferred: boolean;\n\tprivate _affectsMinimap: boolean;\n\tprivate _affectsOverviewRuler: boolean;\n\tprivate _affectedInjectedTextLines: Set<number> | null = null;\n\tprivate _affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null = null;\n\tprivate _affectedFontLines: SetWithKey<LineFontChangingDecoration> | null = null;\n\tprivate _affectsGlyphMargin: boolean;\n\tprivate _affectsLineNumber: boolean;\n\n\tconstructor(private readonly handleBeforeFire: (affectedInjectedTextLines: Set<number> | null, affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null, affectedFontLines: SetWithKey<LineFontChangingDecoration> | null) => void) {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._affectsLineNumber = false;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._shouldFireDeferred) {\n\t\t\t\tthis.doFire();\n\t\t\t}\n\n\t\t\tthis._affectedInjectedTextLines?.clear();\n\t\t\tthis._affectedInjectedTextLines = null;\n\t\t\tthis._affectedLineHeights?.clear();\n\t\t\tthis._affectedLineHeights = null;\n\t\t\tthis._affectedFontLines?.clear();\n\t\t\tthis._affectedFontLines = null;\n\t\t}\n\t}\n\n\tpublic recordLineAffectedByInjectedText(lineNumber: number): void {\n\t\tif (!this._affectedInjectedTextLines) {\n\t\t\tthis._affectedInjectedTextLines = new Set();\n\t\t}\n\t\tthis._affectedInjectedTextLines.add(lineNumber);\n\t}\n\n\tpublic recordLineAffectedByLineHeightChange(ownerId: number, decorationId: string, lineNumber: number, lineHeight: number | null): void {\n\t\tif (!this._affectedLineHeights) {\n\t\t\tthis._affectedLineHeights = new SetWithKey<LineHeightChangingDecoration>([], LineHeightChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedLineHeights.add(new LineHeightChangingDecoration(ownerId, decorationId, lineNumber, lineHeight));\n\t}\n\n\tpublic recordLineAffectedByFontChange(ownerId: number, decorationId: string, lineNumber: number): void {\n\t\tif (!this._affectedFontLines) {\n\t\t\tthis._affectedFontLines = new SetWithKey<LineFontChangingDecoration>([], LineFontChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedFontLines.add(new LineFontChangingDecoration(ownerId, decorationId, lineNumber));\n\t}\n\n\tpublic checkAffectedAndFire(options: ModelDecorationOptions): void {\n\t\tthis._affectsMinimap ||= !!options.minimap?.position;\n\t\tthis._affectsOverviewRuler ||= !!options.overviewRuler?.color;\n\t\tthis._affectsGlyphMargin ||= !!options.glyphMarginClassName;\n\t\tthis._affectsLineNumber ||= !!options.lineNumberClassName;\n\t\tthis.tryFire();\n\t}\n\n\tpublic fire(): void {\n\t\tthis._affectsMinimap = true;\n\t\tthis._affectsOverviewRuler = true;\n\t\tthis._affectsGlyphMargin = true;\n\t\tthis.tryFire();\n\t}\n\n\tprivate tryFire() {\n\t\tif (this._deferredCnt === 0) {\n\t\t\tthis.doFire();\n\t\t} else {\n\t\t\tthis._shouldFireDeferred = true;\n\t\t}\n\t}\n\n\tprivate doFire() {\n\t\tthis.handleBeforeFire(this._affectedInjectedTextLines, this._affectedLineHeights, this._affectedFontLines);\n\n\t\tconst event: IModelDecorationsChangedEvent = {\n\t\t\taffectsMinimap: this._affectsMinimap,\n\t\t\taffectsOverviewRuler: this._affectsOverviewRuler,\n\t\t\taffectsGlyphMargin: this._affectsGlyphMargin,\n\t\t\taffectsLineNumber: this._affectsLineNumber,\n\t\t};\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._actual.fire(event);\n\t}\n}\n\n//#endregion\n\nclass DidChangeContentEmitter extends Disposable {\n\n\t/**\n\t * Both `fastEvent` and `slowEvent` work the same way and contain the same events, but first we invoke `fastEvent` and then `slowEvent`.\n\t */\n\tprivate readonly _fastEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly fastEvent: Event<InternalModelContentChangeEvent> = this._fastEmitter.event;\n\tprivate readonly _slowEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly slowEvent: Event<InternalModelContentChangeEvent> = this._slowEmitter.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _deferredEvent: InternalModelContentChangeEvent | null;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._deferredEvent = null;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(resultingSelection: Selection[] | null = null): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._deferredEvent !== null) {\n\t\t\t\tthis._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection;\n\t\t\t\tconst e = this._deferredEvent;\n\t\t\t\tthis._deferredEvent = null;\n\t\t\t\tthis._fastEmitter.fire(e);\n\t\t\t\tthis._slowEmitter.fire(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic fire(e: InternalModelContentChangeEvent): void {\n\t\tif (this._deferredCnt > 0) {\n\t\t\tif (this._deferredEvent) {\n\t\t\t\tthis._deferredEvent = this._deferredEvent.merge(e);\n\t\t\t} else {\n\t\t\t\tthis._deferredEvent = e;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis._fastEmitter.fire(e);\n\t\tthis._slowEmitter.fire(e);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ArrayQueue, pushMany } from '../../../base/common/arrays.js';\nimport { Color } from '../../../base/common/color.js';\nimport { BugIndicatingError, illegalArgument, onUnexpectedError } from '../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IMarkdownString } from '../../../base/common/htmlContent.js';\nimport { Disposable, IDisposable, MutableDisposable, combinedDisposable } from '../../../base/common/lifecycle.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { ThemeColor } from '../../../base/common/themables.js';\nimport { Constants } from '../../../base/common/uint.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { ISingleEditOperation } from '../core/editOperation.js';\nimport { countEOL } from '../core/misc/eolCounter.js';\nimport { normalizeIndentation } from '../core/misc/indentation.js';\nimport { IPosition, Position } from '../core/position.js';\nimport { IRange, Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nimport { TextChange } from '../core/textChange.js';\nimport { EDITOR_MODEL_DEFAULTS } from '../core/misc/textModelDefaults.js';\nimport { IWordAtPosition } from '../core/wordHelper.js';\nimport { FormattingOptions } from '../languages.js';\nimport { ILanguageSelection, ILanguageService } from '../languages/language.js';\nimport { ILanguageConfigurationService } from '../languages/languageConfigurationRegistry.js';\nimport * as model from '../model.js';\nimport { BracketPairsTextModelPart } from './bracketPairsTextModelPart/bracketPairsImpl.js';\nimport { ColorizedBracketPairsDecorationProvider } from './bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js';\nimport { EditStack } from './editStack.js';\nimport { GuidesTextModelPart } from './guidesTextModelPart.js';\nimport { guessIndentation } from './indentationGuesser.js';\nimport { IntervalNode, IntervalTree, recomputeMaxEnd } from './intervalTree.js';\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer/pieceTreeTextBuffer.js';\nimport { PieceTreeTextBufferBuilder } from './pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js';\nimport { SearchParams, TextModelSearch } from './textModelSearch.js';\nimport { TokenizationTextModelPart } from './tokens/tokenizationTextModelPart.js';\nimport { AttachedViews } from './tokens/abstractSyntaxTokenBackend.js';\nimport { IBracketPairsTextModelPart } from '../textModelBracketPairs.js';\nimport { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelOptionsChangedEvent, InternalModelContentChangeEvent, ModelInjectedTextChangedEvent, ModelRawChange, ModelRawContentChangedEvent, ModelRawEOLChanged, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted, ModelLineHeightChangedEvent, ModelLineHeightChanged, ModelFontChangedEvent, ModelFontChanged, LineInjectedText } from '../textModelEvents.js';\nimport { IGuidesTextModelPart } from '../textModelGuides.js';\nimport { ITokenizationTextModelPart } from '../tokenizationTextModelPart.js';\nimport { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';\nimport { IColorTheme } from '../../../platform/theme/common/themeService.js';\nimport { IUndoRedoService, ResourceEditStackSnapshot, UndoRedoGroup } from '../../../platform/undoRedo/common/undoRedo.js';\nimport { TokenArray } from '../tokens/lineTokens.js';\nimport { SetWithKey } from '../../../base/common/collections.js';\nimport { EditSources, TextModelEditSource } from '../textModelEditSource.js';\nimport { isDark } from '../../../platform/theme/common/theme.js';\n\nexport function createTextBufferFactory(text: string): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\tbuilder.acceptChunk(text);\n\treturn builder.finish();\n}\n\nexport function createTextBufferFactoryFromSnapshot(snapshot: model.ITextSnapshot): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\n\tlet chunk: string | null;\n\twhile (typeof (chunk = snapshot.read()) === 'string') {\n\t\tbuilder.acceptChunk(chunk);\n\t}\n\n\treturn builder.finish();\n}\n\nexport function createTextBuffer(value: string | model.ITextBufferFactory | model.ITextSnapshot, defaultEOL: model.DefaultEndOfLine): { textBuffer: model.ITextBuffer; disposable: IDisposable } {\n\tlet factory: model.ITextBufferFactory;\n\tif (typeof value === 'string') {\n\t\tfactory = createTextBufferFactory(value);\n\t} else if (model.isITextSnapshot(value)) {\n\t\tfactory = createTextBufferFactoryFromSnapshot(value);\n\t} else {\n\t\tfactory = value;\n\t}\n\treturn factory.create(defaultEOL);\n}\n\nlet MODEL_ID = 0;\n\nconst LIMIT_FIND_COUNT = 999;\nconst LONG_LINE_BOUNDARY = 10000;\nconst LINE_HEIGHT_CEILING = 300;\n\nclass TextModelSnapshot implements model.ITextSnapshot {\n\n\tprivate readonly _source: model.ITextSnapshot;\n\tprivate _eos: boolean;\n\n\tconstructor(source: model.ITextSnapshot) {\n\t\tthis._source = source;\n\t\tthis._eos = false;\n\t}\n\n\tpublic read(): string | null {\n\t\tif (this._eos) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst result: string[] = [];\n\t\tlet resultCnt = 0;\n\t\tlet resultLength = 0;\n\n\t\tdo {\n\t\t\tconst tmp = this._source.read();\n\n\t\t\tif (tmp === null) {\n\t\t\t\t// end-of-stream\n\t\t\t\tthis._eos = true;\n\t\t\t\tif (resultCnt === 0) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\treturn result.join('');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (tmp.length > 0) {\n\t\t\t\tresult[resultCnt++] = tmp;\n\t\t\t\tresultLength += tmp.length;\n\t\t\t}\n\n\t\t\tif (resultLength >= 64 * 1024) {\n\t\t\t\treturn result.join('');\n\t\t\t}\n\t\t} while (true);\n\t}\n}\n\nconst invalidFunc = () => { throw new Error(`Invalid change accessor`); };\n\nconst enum StringOffsetValidationType {\n\t/**\n\t * Even allowed in surrogate pairs\n\t */\n\tRelaxed = 0,\n\t/**\n\t * Not allowed in surrogate pairs\n\t */\n\tSurrogatePairs = 1,\n}\n\nexport class TextModel extends Disposable implements model.ITextModel, IDecorationsTreesHost {\n\n\tstatic _MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB, // used in tests\n\tprivate static readonly LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;\n\tprivate static readonly LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines\n\tprivate static readonly LARGE_FILE_HEAP_OPERATION_THRESHOLD = 256 * 1024 * 1024; // 256M characters, usually ~> 512MB memory usage\n\n\tpublic static DEFAULT_CREATION_OPTIONS: model.ITextModelCreationOptions = {\n\t\tisForSimpleWidget: false,\n\t\ttabSize: EDITOR_MODEL_DEFAULTS.tabSize,\n\t\tindentSize: EDITOR_MODEL_DEFAULTS.indentSize,\n\t\tinsertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,\n\t\tdetectIndentation: false,\n\t\tdefaultEOL: model.DefaultEndOfLine.LF,\n\t\ttrimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,\n\t\tlargeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,\n\t\tbracketPairColorizationOptions: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions,\n\t};\n\n\tpublic static resolveOptions(textBuffer: model.ITextBuffer, options: model.ITextModelCreationOptions): model.TextModelResolvedOptions {\n\t\tif (options.detectIndentation) {\n\t\t\tconst guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces);\n\t\t\treturn new model.TextModelResolvedOptions({\n\t\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\t\tindentSize: 'tabSize', // TODO@Alex: guess indentSize independent of tabSize\n\t\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\t\ttrimAutoWhitespace: options.trimAutoWhitespace,\n\t\t\t\tdefaultEOL: options.defaultEOL,\n\t\t\t\tbracketPairColorizationOptions: options.bracketPairColorizationOptions,\n\t\t\t});\n\t\t}\n\n\t\treturn new model.TextModelResolvedOptions(options);\n\t}\n\n\t//#region Events\n\tprivate readonly _onWillDispose: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onWillDispose: Event<void> = this._onWillDispose.event;\n\n\tprivate readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter((affectedInjectedTextLines, affectedLineHeights, affectedFontLines) => this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines, affectedLineHeights, affectedFontLines)));\n\tpublic readonly onDidChangeDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeDecorations.event;\n\n\tpublic get onDidChangeLanguage() { return this._tokenizationTextModelPart.onDidChangeLanguage; }\n\tpublic get onDidChangeLanguageConfiguration() { return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration; }\n\tpublic get onDidChangeTokens() { return this._tokenizationTextModelPart.onDidChangeTokens; }\n\n\tprivate readonly _onDidChangeOptions: Emitter<IModelOptionsChangedEvent> = this._register(new Emitter<IModelOptionsChangedEvent>());\n\tpublic get onDidChangeOptions(): Event<IModelOptionsChangedEvent> { return this._onDidChangeOptions.event; }\n\n\tprivate readonly _onDidChangeAttached: Emitter<void> = this._register(new Emitter<void>());\n\tpublic get onDidChangeAttached(): Event<void> { return this._onDidChangeAttached.event; }\n\n\tprivate readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>());\n\n\tprivate readonly _onDidChangeLineHeight: Emitter<ModelLineHeightChangedEvent> = this._register(new Emitter<ModelLineHeightChangedEvent>());\n\tpublic get onDidChangeLineHeight(): Event<ModelLineHeightChangedEvent> { return this._onDidChangeLineHeight.event; }\n\n\tprivate readonly _onDidChangeFont: Emitter<ModelFontChangedEvent> = this._register(new Emitter<ModelFontChangedEvent>());\n\tpublic get onDidChangeFont(): Event<ModelFontChangedEvent> { return this._onDidChangeFont.event; }\n\n\tprivate readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter());\n\tpublic onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable {\n\t\treturn this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));\n\t}\n\tpublic onDidChangeContentOrInjectedText(listener: (e: InternalModelContentChangeEvent | ModelInjectedTextChangedEvent) => void): IDisposable {\n\t\treturn combinedDisposable(\n\t\t\tthis._eventEmitter.fastEvent(e => listener(e)),\n\t\t\tthis._onDidChangeInjectedText.event(e => listener(e))\n\t\t);\n\t}\n\t//#endregion\n\n\tpublic readonly id: string;\n\tpublic readonly isForSimpleWidget: boolean;\n\tprivate readonly _associatedResource: URI;\n\tprivate _attachedEditorCount: number;\n\tprivate _buffer: model.ITextBuffer;\n\tprivate _bufferDisposable: IDisposable;\n\tprivate _options: model.TextModelResolvedOptions;\n\tprivate readonly _languageSelectionListener = this._register(new MutableDisposable<IDisposable>());\n\n\tprivate _isDisposed: boolean;\n\tprivate __isDisposing: boolean;\n\tpublic _isDisposing(): boolean { return this.__isDisposing; }\n\tprivate _versionId: number;\n\t/**\n\t * Unlike, versionId, this can go down (via undo) or go to previous values (via redo)\n\t */\n\tprivate _alternativeVersionId: number;\n\tprivate _initialUndoRedoSnapshot: ResourceEditStackSnapshot | null;\n\tprivate readonly _isTooLargeForSyncing: boolean;\n\tprivate readonly _isTooLargeForTokenization: boolean;\n\tprivate readonly _isTooLargeForHeapOperation: boolean;\n\n\t//#region Editing\n\tprivate readonly _commandManager: EditStack;\n\tprivate _isUndoing: boolean;\n\tprivate _isRedoing: boolean;\n\tprivate _trimAutoWhitespaceLines: number[] | null;\n\t//#endregion\n\n\t//#region Decorations\n\t/**\n\t * Used to workaround broken clients that might attempt using a decoration id generated by a different model.\n\t * It is not globally unique in order to limit it to one character.\n\t */\n\tprivate readonly _instanceId: string;\n\tprivate _deltaDecorationCallCnt: number = 0;\n\tprivate _lastDecorationId: number;\n\tprivate _decorations: { [decorationId: string]: IntervalNode };\n\tprivate _decorationsTree: DecorationsTrees;\n\tprivate readonly _decorationProvider: ColorizedBracketPairsDecorationProvider;\n\t//#endregion\n\n\tprivate readonly _tokenizationTextModelPart: TokenizationTextModelPart;\n\tpublic get tokenization(): ITokenizationTextModelPart { return this._tokenizationTextModelPart; }\n\n\tprivate readonly _bracketPairs: BracketPairsTextModelPart;\n\tpublic get bracketPairs(): IBracketPairsTextModelPart { return this._bracketPairs; }\n\n\tprivate readonly _guidesTextModelPart: GuidesTextModelPart;\n\tpublic get guides(): IGuidesTextModelPart { return this._guidesTextModelPart; }\n\n\tprivate readonly _attachedViews = new AttachedViews();\n\n\tconstructor(\n\t\tsource: string | model.ITextBufferFactory,\n\t\tlanguageIdOrSelection: string | ILanguageSelection,\n\t\tcreationOptions: model.ITextModelCreationOptions,\n\t\tassociatedResource: URI | null = null,\n\t\t@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@IInstantiationService private readonly instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\t// Generate a new unique model id\n\t\tMODEL_ID++;\n\t\tthis.id = '$model' + MODEL_ID;\n\t\tthis.isForSimpleWidget = creationOptions.isForSimpleWidget;\n\t\tif (typeof associatedResource === 'undefined' || associatedResource === null) {\n\t\t\tthis._associatedResource = URI.parse('inmemory://model/' + MODEL_ID);\n\t\t} else {\n\t\t\tthis._associatedResource = associatedResource;\n\t\t}\n\t\tthis._attachedEditorCount = 0;\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(source, creationOptions.defaultEOL);\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable = disposable;\n\n\t\tconst bufferLineCount = this._buffer.getLineCount();\n\t\tconst bufferTextLength = this._buffer.getValueLengthInRange(new Range(1, 1, bufferLineCount, this._buffer.getLineLength(bufferLineCount) + 1), model.EndOfLinePreference.TextDefined);\n\n\t\t// !!! Make a decision in the ctor and permanently respect this decision !!!\n\t\t// If a model is too large at construction time, it will never get tokenized,\n\t\t// under no circumstances.\n\t\tif (creationOptions.largeFileOptimizations) {\n\t\t\tthis._isTooLargeForTokenization = (\n\t\t\t\t(bufferTextLength > TextModel.LARGE_FILE_SIZE_THRESHOLD)\n\t\t\t\t|| (bufferLineCount > TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD)\n\t\t\t);\n\n\t\t\tthis._isTooLargeForHeapOperation = bufferTextLength > TextModel.LARGE_FILE_HEAP_OPERATION_THRESHOLD;\n\t\t} else {\n\t\t\tthis._isTooLargeForTokenization = false;\n\t\t\tthis._isTooLargeForHeapOperation = false;\n\t\t}\n\n\t\tthis._options = TextModel.resolveOptions(this._buffer, creationOptions);\n\n\t\tconst languageId = (typeof languageIdOrSelection === 'string' ? languageIdOrSelection : languageIdOrSelection.languageId);\n\t\tif (typeof languageIdOrSelection !== 'string') {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId));\n\t\t}\n\n\t\tthis._bracketPairs = this._register(new BracketPairsTextModelPart(this, this._languageConfigurationService));\n\t\tthis._guidesTextModelPart = this._register(new GuidesTextModelPart(this, this._languageConfigurationService));\n\t\tthis._decorationProvider = this._register(new ColorizedBracketPairsDecorationProvider(this));\n\t\tthis._tokenizationTextModelPart = this.instantiationService.createInstance(TokenizationTextModelPart,\n\t\t\tthis,\n\t\t\tthis._bracketPairs,\n\t\t\tlanguageId,\n\t\t\tthis._attachedViews\n\t\t);\n\n\t\tthis._isTooLargeForSyncing = (bufferTextLength > TextModel._MODEL_SYNC_LIMIT);\n\n\t\tthis._versionId = 1;\n\t\tthis._alternativeVersionId = 1;\n\t\tthis._initialUndoRedoSnapshot = null;\n\n\t\tthis._isDisposed = false;\n\t\tthis.__isDisposing = false;\n\n\t\tthis._instanceId = strings.singleLetterHash(MODEL_ID);\n\t\tthis._lastDecorationId = 0;\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\tthis._commandManager = new EditStack(this, this._undoRedoService);\n\t\tthis._isUndoing = false;\n\t\tthis._isRedoing = false;\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\n\t\tthis._register(this._decorationProvider.onDidChange(() => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\n\t\tthis._register(this._languageConfigurationService.onDidChange(e => {\n\t\t\tthis._bracketPairs.handleLanguageConfigurationServiceChange(e);\n\t\t\tthis._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(e);\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.__isDisposing = true;\n\t\tthis._onWillDispose.fire();\n\t\tthis._tokenizationTextModelPart.dispose();\n\t\tthis._isDisposed = true;\n\t\tsuper.dispose();\n\t\tthis._bufferDisposable.dispose();\n\t\tthis.__isDisposing = false;\n\t\t// Manually release reference to previous text buffer to avoid large leaks\n\t\t// in case someone leaks a TextModel reference\n\t\tconst emptyDisposedTextBuffer = new PieceTreeTextBuffer([], '', '\\n', false, false, true, true);\n\t\temptyDisposedTextBuffer.dispose();\n\t\tthis._buffer = emptyDisposedTextBuffer;\n\t\tthis._bufferDisposable = Disposable.None;\n\t}\n\n\tprivate _assertNotDisposed(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError('Model is disposed!');\n\t\t}\n\t}\n\n\tpublic getTextBuffer(): model.ITextBuffer {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer;\n\t}\n\n\tprivate _emitContentChangedEvent(rawChange: ModelRawContentChangedEvent, change: IModelContentChangedEvent): void {\n\t\tif (this.__isDisposing) {\n\t\t\t// Do not confuse listeners by emitting any event after disposing\n\t\t\treturn;\n\t\t}\n\t\tthis._tokenizationTextModelPart.handleDidChangeContent(change);\n\t\tthis._bracketPairs.handleDidChangeContent(change);\n\t\tthis._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));\n\t}\n\n\tpublic setValue(value: string | model.ITextSnapshot, reason = EditSources.setValue()): void {\n\t\tthis._assertNotDisposed();\n\n\t\tif (value === null || value === undefined) {\n\t\t\tthrow illegalArgument();\n\t\t}\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);\n\t\tthis._setValueFromTextBuffer(textBuffer, disposable, reason);\n\t}\n\n\tprivate _createContentChanged2(range: Range, rangeOffset: number, rangeLength: number, rangeEndPosition: Position, text: string, isUndoing: boolean, isRedoing: boolean, isFlush: boolean, isEolChange: boolean, reason: TextModelEditSource): IModelContentChangedEvent {\n\t\treturn {\n\t\t\tchanges: [{\n\t\t\t\trange: range,\n\t\t\t\trangeOffset: rangeOffset,\n\t\t\t\trangeLength: rangeLength,\n\t\t\t\ttext: text,\n\t\t\t}],\n\t\t\teol: this._buffer.getEOL(),\n\t\t\tisEolChange: isEolChange,\n\t\t\tversionId: this.getVersionId(),\n\t\t\tisUndoing: isUndoing,\n\t\t\tisRedoing: isRedoing,\n\t\t\tisFlush: isFlush,\n\t\t\tdetailedReasons: [reason],\n\t\t\tdetailedReasonsChangeLengths: [1],\n\t\t};\n\t}\n\n\tprivate _setValueFromTextBuffer(textBuffer: model.ITextBuffer, textBufferDisposable: IDisposable, reason: TextModelEditSource): void {\n\t\tthis._assertNotDisposed();\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable.dispose();\n\t\tthis._bufferDisposable = textBufferDisposable;\n\t\tthis._increaseVersionId();\n\n\t\t// Destroy all my decorations\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\t// Destroy my edit history and settings\n\t\tthis._commandManager.clear();\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawFlush()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, true, false, reason)\n\t\t);\n\t}\n\n\tpublic setEOL(eol: model.EndOfLineSequence): void {\n\t\tthis._assertNotDisposed();\n\t\tconst newEOL = (eol === model.EndOfLineSequence.CRLF ? '\\r\\n' : '\\n');\n\t\tif (this._buffer.getEOL() === newEOL) {\n\t\t\t// Nothing to do\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._onBeforeEOLChange();\n\t\tthis._buffer.setEOL(newEOL);\n\t\tthis._increaseVersionId();\n\t\tthis._onAfterEOLChange();\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawEOLChanged()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, false, true, EditSources.eolChange())\n\t\t);\n\t}\n\n\tprivate _onBeforeEOLChange(): void {\n\t\t// Ensure all decorations get their `range` set.\n\t\tthis._decorationsTree.ensureAllNodesHaveRanges(this);\n\t}\n\n\tprivate _onAfterEOLChange(): void {\n\t\t// Transform back `range` to offsets\n\t\tconst versionId = this.getVersionId();\n\t\tconst allDecorations = this._decorationsTree.collectNodesPostOrder();\n\t\tfor (let i = 0, len = allDecorations.length; i < len; i++) {\n\t\t\tconst node = allDecorations[i];\n\t\t\tconst range = node.range!; // the range is defined due to `_onBeforeEOLChange`\n\n\t\t\tconst delta = node.cachedAbsoluteStart - node.start;\n\n\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\tnode.cachedAbsoluteStart = startOffset;\n\t\t\tnode.cachedAbsoluteEnd = endOffset;\n\t\t\tnode.cachedVersionId = versionId;\n\n\t\t\tnode.start = startOffset - delta;\n\t\t\tnode.end = endOffset - delta;\n\n\t\t\trecomputeMaxEnd(node);\n\t\t}\n\t}\n\n\tpublic onBeforeAttached(): model.IAttachedView {\n\t\tthis._attachedEditorCount++;\n\t\tif (this._attachedEditorCount === 1) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\treturn this._attachedViews.attachView();\n\t}\n\n\tpublic onBeforeDetached(view: model.IAttachedView): void {\n\t\tthis._attachedEditorCount--;\n\t\tif (this._attachedEditorCount === 0) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\tthis._attachedViews.detachView(view);\n\t}\n\n\tpublic isAttachedToEditor(): boolean {\n\t\treturn this._attachedEditorCount > 0;\n\t}\n\n\tpublic getAttachedEditorCount(): number {\n\t\treturn this._attachedEditorCount;\n\t}\n\n\tpublic isTooLargeForSyncing(): boolean {\n\t\treturn this._isTooLargeForSyncing;\n\t}\n\n\tpublic isTooLargeForTokenization(): boolean {\n\t\treturn this._isTooLargeForTokenization;\n\t}\n\n\tpublic isTooLargeForHeapOperation(): boolean {\n\t\treturn this._isTooLargeForHeapOperation;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\tpublic isDominatedByLongLines(): boolean {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForTokenization()) {\n\t\t\t// Cannot word wrap huge files anyways, so it doesn't really matter\n\t\t\treturn false;\n\t\t}\n\t\tlet smallLineCharCount = 0;\n\t\tlet longLineCharCount = 0;\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tfor (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {\n\t\t\tconst lineLength = this._buffer.getLineLength(lineNumber);\n\t\t\tif (lineLength >= LONG_LINE_BOUNDARY) {\n\t\t\t\tlongLineCharCount += lineLength;\n\t\t\t} else {\n\t\t\t\tsmallLineCharCount += lineLength;\n\t\t\t}\n\t\t}\n\n\t\treturn (longLineCharCount > smallLineCharCount);\n\t}\n\n\tpublic get uri(): URI {\n\t\treturn this._associatedResource;\n\t}\n\n\t//#region Options\n\n\tpublic getOptions(): model.TextModelResolvedOptions {\n\t\tthis._assertNotDisposed();\n\t\treturn this._options;\n\t}\n\n\tpublic getFormattingOptions(): FormattingOptions {\n\t\treturn {\n\t\t\ttabSize: this._options.indentSize,\n\t\t\tinsertSpaces: this._options.insertSpaces\n\t\t};\n\t}\n\n\tpublic updateOptions(_newOpts: model.ITextModelUpdateOptions): void {\n\t\tthis._assertNotDisposed();\n\t\tconst tabSize = (typeof _newOpts.tabSize !== 'undefined') ? _newOpts.tabSize : this._options.tabSize;\n\t\tconst indentSize = (typeof _newOpts.indentSize !== 'undefined') ? _newOpts.indentSize : this._options.originalIndentSize;\n\t\tconst insertSpaces = (typeof _newOpts.insertSpaces !== 'undefined') ? _newOpts.insertSpaces : this._options.insertSpaces;\n\t\tconst trimAutoWhitespace = (typeof _newOpts.trimAutoWhitespace !== 'undefined') ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;\n\t\tconst bracketPairColorizationOptions = (typeof _newOpts.bracketColorizationOptions !== 'undefined') ? _newOpts.bracketColorizationOptions : this._options.bracketPairColorizationOptions;\n\n\t\tconst newOpts = new model.TextModelResolvedOptions({\n\t\t\ttabSize: tabSize,\n\t\t\tindentSize: indentSize,\n\t\t\tinsertSpaces: insertSpaces,\n\t\t\tdefaultEOL: this._options.defaultEOL,\n\t\t\ttrimAutoWhitespace: trimAutoWhitespace,\n\t\t\tbracketPairColorizationOptions,\n\t\t});\n\n\t\tif (this._options.equals(newOpts)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst e = this._options.createChangeEvent(newOpts);\n\t\tthis._options = newOpts;\n\n\t\tthis._bracketPairs.handleDidChangeOptions(e);\n\t\tthis._decorationProvider.handleDidChangeOptions(e);\n\t\tthis._onDidChangeOptions.fire(e);\n\t}\n\n\tpublic detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void {\n\t\tthis._assertNotDisposed();\n\t\tconst guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);\n\t\tthis.updateOptions({\n\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\tindentSize: guessedIndentation.tabSize, // TODO@Alex: guess indentSize independent of tabSize\n\t\t});\n\t}\n\n\tpublic normalizeIndentation(str: string): string {\n\t\tthis._assertNotDisposed();\n\t\treturn normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);\n\t}\n\n\t//#endregion\n\n\t//#region Reading\n\n\tpublic getVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._versionId;\n\t}\n\n\tpublic mightContainRTL(): boolean {\n\t\treturn this._buffer.mightContainRTL();\n\t}\n\n\tpublic mightContainUnusualLineTerminators(): boolean {\n\t\treturn this._buffer.mightContainUnusualLineTerminators();\n\t}\n\n\tpublic removeUnusualLineTerminators(selections: Selection[] | null = null): void {\n\t\tconst matches = this.findMatches(strings.UNUSUAL_LINE_TERMINATORS.source, false, true, false, null, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tthis._buffer.resetMightContainUnusualLineTerminators();\n\t\tthis.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: null })), () => null);\n\t}\n\n\tpublic mightContainNonBasicASCII(): boolean {\n\t\treturn this._buffer.mightContainNonBasicASCII();\n\t}\n\n\tpublic getAlternativeVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._alternativeVersionId;\n\t}\n\n\tpublic getInitialUndoRedoSnapshot(): ResourceEditStackSnapshot | null {\n\t\tthis._assertNotDisposed();\n\t\treturn this._initialUndoRedoSnapshot;\n\t}\n\n\tpublic getOffsetAt(rawPosition: IPosition): number {\n\t\tthis._assertNotDisposed();\n\t\tconst position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, StringOffsetValidationType.Relaxed);\n\t\treturn this._buffer.getOffsetAt(position.lineNumber, position.column);\n\t}\n\n\tpublic getPositionAt(rawOffset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst offset = (Math.min(this._buffer.getLength(), Math.max(0, rawOffset)));\n\t\treturn this._buffer.getPositionAt(offset);\n\t}\n\n\tprivate _increaseVersionId(): void {\n\t\tthis._versionId = this._versionId + 1;\n\t\tthis._alternativeVersionId = this._versionId;\n\t}\n\n\tpublic _overwriteVersionId(versionId: number): void {\n\t\tthis._versionId = versionId;\n\t}\n\n\tpublic _overwriteAlternativeVersionId(newAlternativeVersionId: number): void {\n\t\tthis._alternativeVersionId = newAlternativeVersionId;\n\t}\n\n\tpublic _overwriteInitialUndoRedoSnapshot(newInitialUndoRedoSnapshot: ResourceEditStackSnapshot | null): void {\n\t\tthis._initialUndoRedoSnapshot = newInitialUndoRedoSnapshot;\n\t}\n\n\tpublic getValue(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): string {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM() + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic createSnapshot(preserveBOM: boolean = false): model.ITextSnapshot {\n\t\treturn new TextModelSnapshot(this._buffer.createSnapshot(preserveBOM));\n\t}\n\n\tpublic getValueLength(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): number {\n\t\tthis._assertNotDisposed();\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueLengthInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM().length + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic getValueInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getValueLengthInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getCharacterCountInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getLineCount(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getLineCount();\n\t}\n\n\tpublic getLineContent(lineNumber: number): string {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineContent(lineNumber);\n\t}\n\n\tpublic getLineLength(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineLength(lineNumber);\n\t}\n\n\tpublic getLinesContent(): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\treturn this._buffer.getLinesContent();\n\t}\n\n\tpublic getEOL(): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getEOL();\n\t}\n\n\tpublic getEndOfLineSequence(): model.EndOfLineSequence {\n\t\tthis._assertNotDisposed();\n\t\treturn (\n\t\t\tthis._buffer.getEOL() === '\\n'\n\t\t\t\t? model.EndOfLineSequence.LF\n\t\t\t\t: model.EndOfLineSequence.CRLF\n\t\t);\n\t}\n\n\tpublic getLineMinColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\treturn 1;\n\t}\n\n\tpublic getLineMaxColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLength(lineNumber) + 1;\n\t}\n\n\tpublic getLineFirstNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);\n\t}\n\n\tpublic getLineLastNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLastNonWhitespaceColumn(lineNumber);\n\t}\n\n\t/**\n\t * Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.\n\t * Will try to not allocate if possible.\n\t */\n\tpublic _validateRangeRelaxedNoAllocations(range: IRange): Range {\n\t\tconst linesCount = this._buffer.getLineCount();\n\n\t\tconst initialStartLineNumber = range.startLineNumber;\n\t\tconst initialStartColumn = range.startColumn;\n\t\tlet startLineNumber = Math.floor((typeof initialStartLineNumber === 'number' && !isNaN(initialStartLineNumber)) ? initialStartLineNumber : 1);\n\t\tlet startColumn = Math.floor((typeof initialStartColumn === 'number' && !isNaN(initialStartColumn)) ? initialStartColumn : 1);\n\n\t\tif (startLineNumber < 1) {\n\t\t\tstartLineNumber = 1;\n\t\t\tstartColumn = 1;\n\t\t} else if (startLineNumber > linesCount) {\n\t\t\tstartLineNumber = linesCount;\n\t\t\tstartColumn = this.getLineMaxColumn(startLineNumber);\n\t\t} else {\n\t\t\tif (startColumn <= 1) {\n\t\t\t\tstartColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(startLineNumber);\n\t\t\t\tif (startColumn >= maxColumn) {\n\t\t\t\t\tstartColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst initialEndLineNumber = range.endLineNumber;\n\t\tconst initialEndColumn = range.endColumn;\n\t\tlet endLineNumber = Math.floor((typeof initialEndLineNumber === 'number' && !isNaN(initialEndLineNumber)) ? initialEndLineNumber : 1);\n\t\tlet endColumn = Math.floor((typeof initialEndColumn === 'number' && !isNaN(initialEndColumn)) ? initialEndColumn : 1);\n\n\t\tif (endLineNumber < 1) {\n\t\t\tendLineNumber = 1;\n\t\t\tendColumn = 1;\n\t\t} else if (endLineNumber > linesCount) {\n\t\t\tendLineNumber = linesCount;\n\t\t\tendColumn = this.getLineMaxColumn(endLineNumber);\n\t\t} else {\n\t\t\tif (endColumn <= 1) {\n\t\t\t\tendColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(endLineNumber);\n\t\t\t\tif (endColumn >= maxColumn) {\n\t\t\t\t\tendColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tinitialStartLineNumber === startLineNumber\n\t\t\t&& initialStartColumn === startColumn\n\t\t\t&& initialEndLineNumber === endLineNumber\n\t\t\t&& initialEndColumn === endColumn\n\t\t\t&& range instanceof Range\n\t\t\t&& !(range instanceof Selection)\n\t\t) {\n\t\t\treturn range;\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tprivate _isValidPosition(lineNumber: number, column: number, validationType: StringOffsetValidationType): boolean {\n\t\tif (typeof lineNumber !== 'number' || typeof column !== 'number') {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isNaN(lineNumber) || isNaN(column)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (lineNumber < 1 || column < 1) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ((lineNumber | 0) !== lineNumber || (column | 0) !== column) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (column === 1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column > maxColumn) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate _validatePosition(_lineNumber: number, _column: number, validationType: StringOffsetValidationType): Position {\n\t\tconst lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1);\n\t\tconst column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1);\n\t\tconst lineCount = this._buffer.getLineCount();\n\n\t\tif (lineNumber < 1) {\n\t\t\treturn new Position(1, 1);\n\t\t}\n\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn new Position(lineCount, this.getLineMaxColumn(lineCount));\n\t\t}\n\n\t\tif (column <= 1) {\n\t\t\treturn new Position(lineNumber, 1);\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column >= maxColumn) {\n\t\t\treturn new Position(lineNumber, maxColumn);\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// If the position would end up in the middle of a high-low surrogate pair,\n\t\t\t// we move it to before the pair\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn new Position(lineNumber, column - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tpublic validatePosition(position: IPosition): Position {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif (position instanceof Position) {\n\t\t\tif (this._isValidPosition(position.lineNumber, position.column, validationType)) {\n\t\t\t\treturn position;\n\t\t\t}\n\t\t}\n\n\t\treturn this._validatePosition(position.lineNumber, position.column, validationType);\n\t}\n\n\tpublic isValidRange(range: Range): boolean {\n\t\treturn this._isValidRange(range, StringOffsetValidationType.SurrogatePairs);\n\t}\n\n\tprivate _isValidRange(range: Range, validationType: StringOffsetValidationType): boolean {\n\t\tconst startLineNumber = range.startLineNumber;\n\t\tconst startColumn = range.startColumn;\n\t\tconst endLineNumber = range.endLineNumber;\n\t\tconst endColumn = range.endColumn;\n\n\t\tif (!this._isValidPosition(startLineNumber, startColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this._isValidPosition(endLineNumber, endColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic validateRange(_range: IRange): Range {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif ((_range instanceof Range) && !(_range instanceof Selection)) {\n\t\t\tif (this._isValidRange(_range, validationType)) {\n\t\t\t\treturn _range;\n\t\t\t}\n\t\t}\n\n\t\tconst start = this._validatePosition(_range.startLineNumber, _range.startColumn, StringOffsetValidationType.Relaxed);\n\t\tconst end = this._validatePosition(_range.endLineNumber, _range.endColumn, StringOffsetValidationType.Relaxed);\n\n\t\tconst startLineNumber = start.lineNumber;\n\t\tconst startColumn = start.column;\n\t\tconst endLineNumber = end.lineNumber;\n\t\tconst endColumn = end.column;\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\tif (startLineNumber === endLineNumber && startColumn === endColumn) {\n\t\t\t\t// do not expand a collapsed range, simply move it to a valid location\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair && endInsideSurrogatePair) {\n\t\t\t\t// expand range at both ends\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair) {\n\t\t\t\t// only expand range at the start\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\t// only expand range at the end\n\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1);\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tpublic modifyPosition(rawPosition: IPosition, offset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst candidate = this.getOffsetAt(rawPosition) + offset;\n\t\treturn this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));\n\t}\n\n\tpublic getFullModelRange(): Range {\n\t\tthis._assertNotDisposed();\n\t\tconst lineCount = this.getLineCount();\n\t\treturn new Range(1, 1, lineCount, this.getLineMaxColumn(lineCount));\n\t}\n\n\tprivate findMatchesLineByLine(searchRange: Range, searchData: model.SearchData, captureMatches: boolean, limitResultCount: number): model.FindMatch[] {\n\t\treturn this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t}\n\n\tpublic findMatches(searchString: string, rawSearchScope: boolean | IRange | IRange[] | null, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount: number = LIMIT_FIND_COUNT): model.FindMatch[] {\n\t\tthis._assertNotDisposed();\n\n\t\tlet searchRanges: Range[] | null = null;\n\n\t\tif (rawSearchScope !== null && typeof rawSearchScope !== 'boolean') {\n\t\t\tif (!Array.isArray(rawSearchScope)) {\n\t\t\t\trawSearchScope = [rawSearchScope];\n\t\t\t}\n\n\t\t\tif (rawSearchScope.every((searchScope: IRange) => Range.isIRange(searchScope))) {\n\t\t\t\tsearchRanges = rawSearchScope.map((searchScope: IRange) => this.validateRange(searchScope));\n\t\t\t}\n\t\t}\n\n\t\tif (searchRanges === null) {\n\t\t\tsearchRanges = [this.getFullModelRange()];\n\t\t}\n\n\t\tsearchRanges = searchRanges.sort((d1, d2) => d1.startLineNumber - d2.startLineNumber || d1.startColumn - d2.startColumn);\n\n\t\tconst uniqueSearchRanges: Range[] = [];\n\t\tuniqueSearchRanges.push(searchRanges.reduce((prev, curr) => {\n\t\t\tif (Range.areIntersecting(prev, curr)) {\n\t\t\t\treturn prev.plusRange(curr);\n\t\t\t}\n\n\t\t\tuniqueSearchRanges.push(prev);\n\t\t\treturn curr;\n\t\t}));\n\n\t\tlet matchMapper: (value: Range, index: number, array: Range[]) => model.FindMatch[];\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\t// not regex, not multi line\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\n\t\t\tif (!searchData) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tmatchMapper = (searchRange: Range) => this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t\t} else {\n\t\t\tmatchMapper = (searchRange: Range) => TextModelSearch.findMatches(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchRange, captureMatches, limitResultCount);\n\t\t}\n\n\t\treturn uniqueSearchRanges.map(matchMapper).reduce((arr, matches: model.FindMatch[]) => arr.concat(matches), []);\n\t}\n\n\tpublic findNextMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\t\t\tif (!searchData) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst lineCount = this.getLineCount();\n\t\t\tlet searchRange = new Range(searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));\n\t\t\tlet ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\t\t\tTextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\tsearchRange = new Range(1, 1, searchStart.lineNumber, this.getLineMaxColumn(searchStart.lineNumber));\n\t\t\tret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\tpublic findPreviousMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\t\treturn TextModelSearch.findPreviousMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\t//#endregion\n\n\t//#region Editing\n\n\tpublic pushStackElement(): void {\n\t\tthis._commandManager.pushStackElement();\n\t}\n\n\tpublic popStackElement(): void {\n\t\tthis._commandManager.popStackElement();\n\t}\n\n\tpublic pushEOL(eol: model.EndOfLineSequence): void {\n\t\tconst currentEOL = (this.getEOL() === '\\n' ? model.EndOfLineSequence.LF : model.EndOfLineSequence.CRLF);\n\t\tif (currentEOL === eol) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t\t}\n\t\t\tthis._commandManager.pushEOL(eol);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _validateEditOperation(rawOperation: model.IIdentifiedSingleEditOperation): model.ValidAnnotatedEditOperation {\n\t\tif (rawOperation instanceof model.ValidAnnotatedEditOperation) {\n\t\t\treturn rawOperation;\n\t\t}\n\t\treturn new model.ValidAnnotatedEditOperation(\n\t\t\trawOperation.identifier || null,\n\t\t\tthis.validateRange(rawOperation.range),\n\t\t\trawOperation.text,\n\t\t\trawOperation.forceMoveMarkers || false,\n\t\t\trawOperation.isAutoWhitespaceEdit || false,\n\t\t\trawOperation._isTracked || false\n\t\t);\n\t}\n\n\tprivate _validateEditOperations(rawOperations: readonly model.IIdentifiedSingleEditOperation[]): model.ValidAnnotatedEditOperation[] {\n\t\tconst result: model.ValidAnnotatedEditOperation[] = [];\n\t\tfor (let i = 0, len = rawOperations.length; i < len; i++) {\n\t\t\tresult[i] = this._validateEditOperation(rawOperations[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.IIdentifiedSingleEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\treturn this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer, group, reason);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.ValidAnnotatedEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\tif (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {\n\t\t\t// Go through each saved line number and insert a trim whitespace edit\n\t\t\t// if it is safe to do so (no conflicts with other edits).\n\n\t\t\tconst incomingEdits = editOperations.map((op) => {\n\t\t\t\treturn {\n\t\t\t\t\trange: this.validateRange(op.range),\n\t\t\t\t\ttext: op.text\n\t\t\t\t};\n\t\t\t});\n\n\t\t\t// Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor\n\t\t\t// We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace\n\t\t\tlet editsAreNearCursors = true;\n\t\t\tif (beforeCursorState) {\n\t\t\t\tfor (let i = 0, len = beforeCursorState.length; i < len; i++) {\n\t\t\t\t\tconst sel = beforeCursorState[i];\n\t\t\t\t\tlet foundEditNearSel = false;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst selIsAbove = editRange.startLineNumber > sel.endLineNumber;\n\t\t\t\t\t\tconst selIsBelow = sel.startLineNumber > editRange.endLineNumber;\n\t\t\t\t\t\tif (!selIsAbove && !selIsBelow) {\n\t\t\t\t\t\t\tfoundEditNearSel = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!foundEditNearSel) {\n\t\t\t\t\t\teditsAreNearCursors = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (editsAreNearCursors) {\n\t\t\t\tfor (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {\n\t\t\t\t\tconst trimLineNumber = this._trimAutoWhitespaceLines[i];\n\t\t\t\t\tconst maxLineColumn = this.getLineMaxColumn(trimLineNumber);\n\n\t\t\t\t\tlet allowTrimLine = true;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst editText = incomingEdits[j].text;\n\n\t\t\t\t\t\tif (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {\n\t\t\t\t\t\t\t// `trimLine` is completely outside this edit\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// At this point:\n\t\t\t\t\t\t// editRange.startLineNumber <= trimLine <= editRange.endLineNumber\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) after `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === 1\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) before `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Looks like we can't trim this line as it would interfere with an incoming edit\n\t\t\t\t\t\tallowTrimLine = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (allowTrimLine) {\n\t\t\t\t\t\tconst trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn);\n\t\t\t\t\t\teditOperations.push(new model.ValidAnnotatedEditOperation(null, trimRange, null, false, false, false));\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._trimAutoWhitespaceLines = null;\n\t\t}\n\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t}\n\t\treturn this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group, reason);\n\t}\n\n\t_applyUndo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.newPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.newEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.oldText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\t_applyRedo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.oldPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.oldEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.newText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, false, true, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\tprivate _applyUndoRedoEdits(edits: ISingleEditOperation[], eol: model.EndOfLineSequence, isUndoing: boolean, isRedoing: boolean, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tthis._isUndoing = isUndoing;\n\t\t\tthis._isRedoing = isRedoing;\n\t\t\tthis.applyEdits(edits, false);\n\t\t\tthis.setEOL(eol);\n\t\t\tthis._overwriteAlternativeVersionId(resultingAlternativeVersionId);\n\t\t} finally {\n\t\t\tthis._isUndoing = false;\n\t\t\tthis._isRedoing = false;\n\t\t\tthis._eventEmitter.endDeferredEmit(resultingSelection);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[]): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true): model.IValidEditOperation[];\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false, reason: TextModelEditSource): void;\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true, reason: TextModelEditSource): model.IValidEditOperation[];\n\tpublic applyEdits(rawOperations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits?: boolean, reason?: TextModelEditSource): void | model.IValidEditOperation[] {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tconst operations = this._validateEditOperations(rawOperations);\n\n\t\t\treturn this._doApplyEdits(operations, computeUndoEdits ?? false, reason ?? EditSources.applyEdits());\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _doApplyEdits(rawOperations: model.ValidAnnotatedEditOperation[], computeUndoEdits: boolean, reason: TextModelEditSource): void | model.IValidEditOperation[] {\n\n\t\tconst oldLineCount = this._buffer.getLineCount();\n\t\tconst result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace, computeUndoEdits);\n\t\tconst newLineCount = this._buffer.getLineCount();\n\n\t\tconst contentChanges = result.changes;\n\t\tthis._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;\n\n\t\tif (contentChanges.length !== 0) {\n\t\t\t// We do a first pass to update decorations\n\t\t\t// because we want to read decorations in the second pass\n\t\t\t// where we will emit content change events\n\t\t\t// and we want to read the final decorations\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tthis._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);\n\t\t\t}\n\n\t\t\tconst rawContentChanges: ModelRawChange[] = [];\n\n\t\t\tthis._increaseVersionId();\n\n\t\t\tlet lineCount = oldLineCount;\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tconst [eolCount] = countEOL(change.text);\n\t\t\t\tthis._onDidChangeDecorations.fire();\n\n\t\t\t\tconst startLineNumber = change.range.startLineNumber;\n\t\t\t\tconst endLineNumber = change.range.endLineNumber;\n\n\t\t\t\tconst deletingLinesCnt = endLineNumber - startLineNumber;\n\t\t\t\tconst insertingLinesCnt = eolCount;\n\t\t\t\tconst editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);\n\n\t\t\t\tconst changeLineCountDelta = (insertingLinesCnt - deletingLinesCnt);\n\n\t\t\t\tconst currentEditStartLineNumber = newLineCount - lineCount - changeLineCountDelta + startLineNumber;\n\t\t\t\tconst firstEditLineNumber = currentEditStartLineNumber;\n\t\t\t\tconst lastInsertedLineNumber = currentEditStartLineNumber + insertingLinesCnt;\n\n\t\t\t\tconst decorationsWithInjectedTextInEditedRange = this._decorationsTree.getInjectedTextInInterval(\n\t\t\t\t\tthis,\n\t\t\t\t\tthis.getOffsetAt(new Position(firstEditLineNumber, 1)),\n\t\t\t\t\tthis.getOffsetAt(new Position(lastInsertedLineNumber, this.getLineMaxColumn(lastInsertedLineNumber))),\n\t\t\t\t\t0\n\t\t\t\t);\n\n\n\t\t\t\tconst injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);\n\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\n\t\t\t\tfor (let j = editingLinesCnt; j >= 0; j--) {\n\t\t\t\t\tconst editLineNumber = startLineNumber + j;\n\t\t\t\t\tconst currentEditLineNumber = currentEditStartLineNumber + j;\n\n\t\t\t\t\tinjectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber > currentEditLineNumber);\n\t\t\t\t\tconst decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber === currentEditLineNumber);\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLineChanged(\n\t\t\t\t\t\t\teditLineNumber,\n\t\t\t\t\t\t\tthis.getLineContent(currentEditLineNumber),\n\t\t\t\t\t\t\tdecorationsInCurrentLine\n\t\t\t\t\t\t));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < deletingLinesCnt) {\n\t\t\t\t\t// Must delete some lines\n\t\t\t\t\tconst spliceStartLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\trawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < insertingLinesCnt) {\n\t\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\t\t\t\t\t// Must insert some lines\n\t\t\t\t\tconst spliceLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\tconst cnt = insertingLinesCnt - editingLinesCnt;\n\t\t\t\t\tconst fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;\n\t\t\t\t\tconst injectedTexts: (LineInjectedText[] | null)[] = [];\n\t\t\t\t\tconst newLines: string[] = [];\n\t\t\t\t\tfor (let i = 0; i < cnt; i++) {\n\t\t\t\t\t\tconst lineNumber = fromLineNumber + i;\n\t\t\t\t\t\tnewLines[i] = this.getLineContent(lineNumber);\n\n\t\t\t\t\t\tinjectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber < lineNumber);\n\t\t\t\t\t\tinjectedTexts[i] = injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber === lineNumber);\n\t\t\t\t\t}\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLinesInserted(\n\t\t\t\t\t\t\tspliceLineNumber + 1,\n\t\t\t\t\t\t\tstartLineNumber + insertingLinesCnt,\n\t\t\t\t\t\t\tnewLines,\n\t\t\t\t\t\t\tinjectedTexts\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlineCount += changeLineCountDelta;\n\t\t\t}\n\n\t\t\tthis._emitContentChangedEvent(\n\t\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t\trawContentChanges,\n\t\t\t\t\tthis.getVersionId(),\n\t\t\t\t\tthis._isUndoing,\n\t\t\t\t\tthis._isRedoing\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tchanges: contentChanges,\n\t\t\t\t\teol: this._buffer.getEOL(),\n\t\t\t\t\tisEolChange: false,\n\t\t\t\t\tversionId: this.getVersionId(),\n\t\t\t\t\tisUndoing: this._isUndoing,\n\t\t\t\t\tisRedoing: this._isRedoing,\n\t\t\t\t\tisFlush: false,\n\t\t\t\t\tdetailedReasons: [reason],\n\t\t\t\t\tdetailedReasonsChangeLengths: [contentChanges.length],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn (result.reverseEdits === null ? undefined : result.reverseEdits);\n\t}\n\n\tpublic undo(): void | Promise<void> {\n\t\treturn this._undoRedoService.undo(this.uri);\n\t}\n\n\tpublic canUndo(): boolean {\n\t\treturn this._undoRedoService.canUndo(this.uri);\n\t}\n\n\tpublic redo(): void | Promise<void> {\n\t\treturn this._undoRedoService.redo(this.uri);\n\t}\n\n\tpublic canRedo(): boolean {\n\t\treturn this._undoRedoService.canRedo(this.uri);\n\t}\n\n\t//#endregion\n\n\t//#region Decorations\n\n\tprivate handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines: Set<number> | null, affectedLineHeights: Set<LineHeightChangingDecoration> | null, affectedFontLines: Set<LineFontChangingDecoration> | null): void {\n\t\t// This is called before the decoration changed event is fired.\n\n\t\tif (affectedInjectedTextLines && affectedInjectedTextLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedInjectedTextLines);\n\t\t\tconst lineChangeEvents = affectedLines.map(lineNumber => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));\n\t\t\tthis._onDidChangeInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));\n\t\t}\n\t\tif (affectedLineHeights && affectedLineHeights.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedLineHeights);\n\t\t\tconst lineHeightChangeEvent = affectedLines.map(specialLineHeightChange => new ModelLineHeightChanged(specialLineHeightChange.ownerId, specialLineHeightChange.decorationId, specialLineHeightChange.lineNumber, specialLineHeightChange.lineHeight));\n\t\t\tthis._onDidChangeLineHeight.fire(new ModelLineHeightChangedEvent(lineHeightChangeEvent));\n\t\t}\n\t\tif (affectedFontLines && affectedFontLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedFontLines);\n\t\t\tconst fontChangeEvent = affectedLines.map(fontChange => new ModelFontChanged(fontChange.ownerId, fontChange.lineNumber));\n\t\t\tthis._onDidChangeFont.fire(new ModelFontChangedEvent(fontChangeEvent));\n\t\t}\n\t}\n\n\tpublic changeDecorations<T>(callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T, ownerId: number = 0): T | null {\n\t\tthis._assertNotDisposed();\n\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._changeDecorations(ownerId, callback);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _changeDecorations<T>(ownerId: number, callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T): T | null {\n\t\tconst changeAccessor: model.IModelDecorationsChangeAccessor = {\n\t\t\taddDecoration: (range: IRange, options: model.IModelDecorationOptions): string => {\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0];\n\t\t\t},\n\t\t\tchangeDecoration: (id: string, newRange: IRange): void => {\n\t\t\t\tthis._changeDecorationImpl(ownerId, id, newRange);\n\t\t\t},\n\t\t\tchangeDecorationOptions: (id: string, options: model.IModelDecorationOptions) => {\n\t\t\t\tthis._changeDecorationOptionsImpl(ownerId, id, _normalizeOptions(options));\n\t\t\t},\n\t\t\tremoveDecoration: (id: string): void => {\n\t\t\t\tthis._deltaDecorationsImpl(ownerId, [id], []);\n\t\t\t},\n\t\t\tdeltaDecorations: (oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[]): string[] => {\n\t\t\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t\t\t// nothing to do\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t\t}\n\t\t};\n\t\tlet result: T | null = null;\n\t\ttry {\n\t\t\tresult = callback(changeAccessor);\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t\t// Invalidate change accessor\n\t\tchangeAccessor.addDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecorationOptions = invalidFunc;\n\t\tchangeAccessor.removeDecoration = invalidFunc;\n\t\tchangeAccessor.deltaDecorations = invalidFunc;\n\t\treturn result;\n\t}\n\n\tpublic deltaDecorations(oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[], ownerId: number = 0): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (!oldDecorations) {\n\t\t\toldDecorations = [];\n\t\t}\n\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t// nothing to do\n\t\t\treturn [];\n\t\t}\n\n\t\ttry {\n\t\t\tthis._deltaDecorationCallCnt++;\n\t\t\tif (this._deltaDecorationCallCnt > 1) {\n\t\t\t\tconsole.warn(`Invoking deltaDecorations recursively could lead to leaking decorations.`);\n\t\t\t\tonUnexpectedError(new Error(`Invoking deltaDecorations recursively could lead to leaking decorations.`));\n\t\t\t}\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t\tthis._deltaDecorationCallCnt--;\n\t\t}\n\t}\n\n\t_getTrackedRange(id: string): Range | null {\n\t\treturn this.getDecorationRange(id);\n\t}\n\n\t_setTrackedRange(id: string | null, newRange: null, newStickiness: model.TrackedRangeStickiness): null;\n\t_setTrackedRange(id: string | null, newRange: Range, newStickiness: model.TrackedRangeStickiness): string;\n\t_setTrackedRange(id: string | null, newRange: Range | null, newStickiness: model.TrackedRangeStickiness): string | null {\n\t\tconst node = (id ? this._decorations[id] : null);\n\n\t\tif (!node) {\n\t\t\tif (!newRange) {\n\t\t\t\t// node doesn't exist, the request is to delete => nothing to do\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// node doesn't exist, the request is to set => add the tracked range\n\t\t\treturn this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }], true)[0];\n\t\t}\n\n\t\tif (!newRange) {\n\t\t\t// node exists, the request is to delete => delete node\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t\treturn null;\n\t\t}\n\n\t\t// node exists, the request is to set => change the tracked range and its options\n\t\tconst range = this._validateRangeRelaxedNoAllocations(newRange);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tnode.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);\n\t\tthis._decorationsTree.insert(node);\n\t\treturn node.id;\n\t}\n\n\tpublic removeAllDecorationsWithOwnerId(ownerId: number): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tconst nodes = this._decorationsTree.collectNodesFromOwner(ownerId);\n\t\tfor (let i = 0, len = nodes.length; i < len; i++) {\n\t\t\tconst node = nodes[i];\n\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t}\n\t}\n\n\tpublic getDecorationOptions(decorationId: string): model.IModelDecorationOptions | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn node.options;\n\t}\n\n\tpublic getDecorationRange(decorationId: string): Range | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this._decorationsTree.getNodeRange(this, node);\n\t}\n\n\tpublic getLineDecorations(lineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\treturn [];\n\t\t}\n\t\treturn this.getLinesDecorations(lineNumber, lineNumber, ownerId, filterOutValidation, filterFontDecorations);\n\t}\n\n\tpublic getLinesDecorations(_startLineNumber: number, _endLineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst lineCount = this.getLineCount();\n\t\tconst startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));\n\t\tconst endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\t\tconst range = new Range(startLineNumber, 1, endLineNumber, endColumn);\n\n\t\tconst decorations = this._getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation));\n\t\treturn decorations;\n\t}\n\n\tpublic getDecorationsInRange(range: IRange, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMinimapDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst validatedRange = this.validateRange(range);\n\n\t\tconst decorations = this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));\n\t\treturn decorations;\n\t}\n\n\tpublic getOverviewRulerDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, true, false);\n\t}\n\n\tpublic getInjectedTextDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllInjectedText(this, ownerId);\n\t}\n\n\tpublic getCustomLineHeightsDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllCustomLineHeights(this, ownerId);\n\t}\n\n\tprivate _getInjectedTextInLine(lineNumber: number): LineInjectedText[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(lineNumber, 1);\n\t\tconst endOffset = startOffset + this._buffer.getLineLength(lineNumber);\n\n\t\tconst result = this._decorationsTree.getInjectedTextInInterval(this, startOffset, endOffset, 0);\n\t\treturn LineInjectedText.fromDecorations(result).filter(t => t.lineNumber === lineNumber);\n\t}\n\n\tpublic getFontDecorationsInRange(range: IRange, ownerId: number = 0): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\treturn this._decorationsTree.getFontDecorationsInInterval(this, startOffset, endOffset, ownerId);\n\t}\n\n\tpublic getAllDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tlet result = this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, false, false);\n\t\tresult = result.concat(this._decorationProvider.getAllDecorations(ownerId, filterOutValidation));\n\t\treturn result;\n\t}\n\n\tpublic getAllMarginDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, false, false, false, true);\n\t}\n\n\tprivate _getDecorationsInRange(filterRange: Range, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);\n\t\treturn this._decorationsTree.getAllInInterval(this, startOffset, endOffset, filterOwnerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t}\n\n\tpublic getRangeAt(start: number, end: number): Range {\n\t\treturn this._buffer.getRangeAt(start, end - start);\n\t}\n\n\tprivate _changeDecorationImpl(ownerId: number, decorationId: string, _range: IRange): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (node.options.after) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, oldRange!.startLineNumber, null);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, oldRange!.startLineNumber);\n\t\t}\n\n\t\tconst range = this._validateRangeRelaxedNoAllocations(_range);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tthis._decorationsTree.insert(node);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\n\t\tif (node.options.after) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, range.startLineNumber, node.options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t}\n\t}\n\n\tprivate _changeDecorationOptionsImpl(ownerId: number, decorationId: string, options: ModelDecorationOptions): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n\t\tconst nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);\n\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\n\t\tif (node.options.after || options.after) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t}\n\t\tif (node.options.before || options.before) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null || options.lineHeight !== null) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont || options.affectsFont) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t}\n\n\t\tconst movedInOverviewRuler = nodeWasInOverviewRuler !== nodeIsInOverviewRuler;\n\t\tconst changedWhetherInjectedText = isOptionsInjectedText(options) !== isNodeInjectedText(node);\n\t\tif (movedInOverviewRuler || changedWhetherInjectedText) {\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tnode.setOptions(options);\n\t\t\tthis._decorationsTree.insert(node);\n\t\t} else {\n\t\t\tnode.setOptions(options);\n\t\t}\n\t}\n\n\tprivate _deltaDecorationsImpl(ownerId: number, oldDecorationsIds: string[], newDecorations: model.IModelDeltaDecoration[], suppressEvents: boolean = false): string[] {\n\t\tconst versionId = this.getVersionId();\n\n\t\tconst oldDecorationsLen = oldDecorationsIds.length;\n\t\tlet oldDecorationIndex = 0;\n\n\t\tconst newDecorationsLen = newDecorations.length;\n\t\tlet newDecorationIndex = 0;\n\n\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\ttry {\n\t\t\tconst result = new Array<string>(newDecorationsLen);\n\t\t\twhile (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {\n\n\t\t\t\tlet node: IntervalNode | null = null;\n\n\t\t\t\tif (oldDecorationIndex < oldDecorationsLen) {\n\t\t\t\t\t// (1) get ourselves an old node\n\t\t\t\t\tlet decorationId: string;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tdecorationId = oldDecorationsIds[oldDecorationIndex++];\n\t\t\t\t\t\tnode = this._decorations[decorationId];\n\t\t\t\t\t} while (!node && oldDecorationIndex < oldDecorationsLen);\n\n\t\t\t\t\t// (2) remove the node from the tree (if it exists)\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, null);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._decorationsTree.delete(node);\n\n\t\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newDecorationIndex < newDecorationsLen) {\n\t\t\t\t\t// (3) create a new node if necessary\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tconst internalDecorationId = (++this._lastDecorationId);\n\t\t\t\t\t\tconst decorationId = `${this._instanceId};${internalDecorationId}`;\n\t\t\t\t\t\tnode = new IntervalNode(decorationId, 0, 0);\n\t\t\t\t\t\tthis._decorations[decorationId] = node;\n\t\t\t\t\t}\n\n\t\t\t\t\t// (4) initialize node\n\t\t\t\t\tconst newDecoration = newDecorations[newDecorationIndex];\n\t\t\t\t\tconst range = this._validateRangeRelaxedNoAllocations(newDecoration.range);\n\t\t\t\t\tconst options = _normalizeOptions(newDecoration.options);\n\t\t\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\t\t\tnode.ownerId = ownerId;\n\t\t\t\t\tnode.reset(versionId, startOffset, endOffset, range);\n\t\t\t\t\tnode.setOptions(options);\n\n\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, node.id, range.startLineNumber, node.options.lineHeight);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._decorationsTree.insert(node);\n\n\t\t\t\t\tresult[newDecorationIndex] = node.id;\n\n\t\t\t\t\tnewDecorationIndex++;\n\t\t\t\t} else {\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tdelete this._decorations[node.id];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region Tokenization\n\n\t// TODO move them to the tokenization part.\n\tpublic getLanguageId(): string {\n\t\treturn this.tokenization.getLanguageId();\n\t}\n\n\tpublic setLanguage(languageIdOrSelection: string | ILanguageSelection, source?: string): void {\n\t\tif (typeof languageIdOrSelection === 'string') {\n\t\t\tthis._languageSelectionListener.clear();\n\t\t\tthis._setLanguage(languageIdOrSelection, source);\n\t\t} else {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId, source));\n\t\t\tthis._setLanguage(languageIdOrSelection.languageId, source);\n\t\t}\n\t}\n\n\tprivate _setLanguage(languageId: string, source?: string): void {\n\t\tthis.tokenization.setLanguageId(languageId, source);\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\t}\n\n\tpublic getLanguageIdAtPosition(lineNumber: number, column: number): string {\n\t\treturn this.tokenization.getLanguageIdAtPosition(lineNumber, column);\n\t}\n\n\tpublic getWordAtPosition(position: IPosition): IWordAtPosition | null {\n\t\treturn this._tokenizationTextModelPart.getWordAtPosition(position);\n\t}\n\n\tpublic getWordUntilPosition(position: IPosition): IWordAtPosition {\n\t\treturn this._tokenizationTextModelPart.getWordUntilPosition(position);\n\t}\n\n\t//#endregion\n\tnormalizePosition(position: Position, affinity: model.PositionAffinity): Position {\n\t\treturn position;\n\t}\n\n\t/**\n\t * Gets the column at which indentation stops at a given line.\n\t * @internal\n\t*/\n\tpublic getLineIndentColumn(lineNumber: number): number {\n\t\t// Columns start with 1.\n\t\treturn indentOfLine(this.getLineContent(lineNumber)) + 1;\n\t}\n\n\tpublic override toString(): string {\n\t\treturn `TextModel(${this.uri.toString()})`;\n\t}\n}\n\nexport function indentOfLine(line: string): number {\n\tlet indent = 0;\n\tfor (const c of line) {\n\t\tif (c === ' ' || c === '\\t') {\n\t\t\tindent++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn indent;\n}\n\n//#region Decorations\n\nfunction isNodeInOverviewRuler(node: IntervalNode): boolean {\n\treturn (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n}\n\nfunction isOptionsInjectedText(options: ModelDecorationOptions): boolean {\n\treturn !!options.after || !!options.before;\n}\n\nfunction isNodeInjectedText(node: IntervalNode): boolean {\n\treturn !!node.options.after || !!node.options.before;\n}\n\nexport interface IDecorationsTreesHost {\n\tgetVersionId(): number;\n\tgetRangeAt(start: number, end: number): Range;\n}\n\nclass DecorationsTrees {\n\n\t/**\n\t * This tree holds decorations that do not show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree0: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree1: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that contain injected text.\n\t */\n\tprivate readonly _injectedTextDecorationsTree: IntervalTree;\n\n\tconstructor() {\n\t\tthis._decorationsTree0 = new IntervalTree();\n\t\tthis._decorationsTree1 = new IntervalTree();\n\t\tthis._injectedTextDecorationsTree = new IntervalTree();\n\t}\n\n\tpublic ensureAllNodesHaveRanges(host: IDecorationsTreesHost): void {\n\t\tthis.getAll(host, 0, false, false, false, false);\n\t}\n\n\tprivate _ensureNodesHaveRanges(host: IDecorationsTreesHost, nodes: IntervalNode[]): model.IModelDecoration[] {\n\t\tfor (const node of nodes) {\n\t\t\tif (node.range === null) {\n\t\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t\t}\n\t\t}\n\t\treturn <model.IModelDecoration[]>nodes;\n\t}\n\n\tpublic getAllInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _intervalSearch(start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r2 = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic getInjectedTextInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getFontDecorationsInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst decorations = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, decorations).filter((i) => i.options.affectsFont);\n\t}\n\n\tpublic getAllInjectedText(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.search(filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getAllCustomLineHeights(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, false, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => typeof i.options.lineHeight === 'number');\n\t}\n\n\tpublic getAll(host: IDecorationsTreesHost, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, filterOutValidation, filterFontDecorations, overviewRulerOnly, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _search(filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tif (overviewRulerOnly) {\n\t\t\treturn this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t} else {\n\t\t\tconst r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r2 = this._injectedTextDecorationsTree.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\treturn r0.concat(r1).concat(r2);\n\t\t}\n\t}\n\n\tpublic collectNodesFromOwner(ownerId: number): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesFromOwner(ownerId);\n\t\tconst r1 = this._decorationsTree1.collectNodesFromOwner(ownerId);\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesFromOwner(ownerId);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic collectNodesPostOrder(): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesPostOrder();\n\t\tconst r1 = this._decorationsTree1.collectNodesPostOrder();\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic insert(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.insert(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.insert(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.insert(node);\n\t\t}\n\t}\n\n\tpublic delete(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.delete(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.delete(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.delete(node);\n\t\t}\n\t}\n\n\tpublic getNodeRange(host: IDecorationsTreesHost, node: IntervalNode): Range {\n\t\tconst versionId = host.getVersionId();\n\t\tif (node.cachedVersionId !== versionId) {\n\t\t\tthis._resolveNode(node, versionId);\n\t\t}\n\t\tif (node.range === null) {\n\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t}\n\t\treturn node.range;\n\t}\n\n\tprivate _resolveNode(node: IntervalNode, cachedVersionId: number): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.resolveNode(node, cachedVersionId);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.resolveNode(node, cachedVersionId);\n\t\t} else {\n\t\t\tthis._decorationsTree0.resolveNode(node, cachedVersionId);\n\t\t}\n\t}\n\n\tpublic acceptReplace(offset: number, length: number, textLength: number, forceMoveMarkers: boolean): void {\n\t\tthis._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._injectedTextDecorationsTree.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t}\n}\n\nfunction cleanClassName(className: string): string {\n\treturn className.replace(/[^a-z0-9\\-_]/gi, ' ');\n}\n\nclass DecorationOptions implements model.IDecorationOptions {\n\treadonly color: string | ThemeColor;\n\treadonly darkColor: string | ThemeColor;\n\n\tconstructor(options: model.IDecorationOptions) {\n\t\tthis.color = options.color || '';\n\t\tthis.darkColor = options.darkColor || '';\n\n\t}\n}\n\nexport class ModelDecorationOverviewRulerOptions extends DecorationOptions {\n\treadonly position: model.OverviewRulerLane;\n\tprivate _resolvedColor: string | null;\n\n\tconstructor(options: model.IModelDecorationOverviewRulerOptions) {\n\t\tsuper(options);\n\t\tthis._resolvedColor = null;\n\t\tthis.position = (typeof options.position === 'number' ? options.position : model.OverviewRulerLane.Center);\n\t}\n\n\tpublic getColor(theme: IColorTheme): string {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = null;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): string {\n\t\tif (typeof color === 'string') {\n\t\t\treturn color;\n\t\t}\n\t\tconst c = color ? theme.getColor(color.id) : null;\n\t\tif (!c) {\n\t\t\treturn '';\n\t\t}\n\t\treturn c.toString();\n\t}\n}\n\nexport class ModelDecorationGlyphMarginOptions {\n\treadonly position: model.GlyphMarginLane;\n\treadonly persistLane: boolean | undefined;\n\n\tconstructor(options: model.IModelDecorationGlyphMarginOptions | null | undefined) {\n\t\tthis.position = options?.position ?? model.GlyphMarginLane.Center;\n\t\tthis.persistLane = options?.persistLane;\n\t}\n}\n\nexport class ModelDecorationMinimapOptions extends DecorationOptions {\n\treadonly position: model.MinimapPosition;\n\treadonly sectionHeaderStyle: model.MinimapSectionHeaderStyle | null;\n\treadonly sectionHeaderText: string | null;\n\tprivate _resolvedColor: Color | undefined;\n\n\tconstructor(options: model.IModelDecorationMinimapOptions) {\n\t\tsuper(options);\n\t\tthis.position = options.position;\n\t\tthis.sectionHeaderStyle = options.sectionHeaderStyle ?? null;\n\t\tthis.sectionHeaderText = options.sectionHeaderText ?? null;\n\t}\n\n\tpublic getColor(theme: IColorTheme): Color | undefined {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = undefined;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): Color | undefined {\n\t\tif (typeof color === 'string') {\n\t\t\treturn Color.fromHex(color);\n\t\t}\n\t\treturn theme.getColor(color.id);\n\t}\n}\n\nexport class ModelDecorationInjectedTextOptions implements model.InjectedTextOptions {\n\tpublic static from(options: model.InjectedTextOptions): ModelDecorationInjectedTextOptions {\n\t\tif (options instanceof ModelDecorationInjectedTextOptions) {\n\t\t\treturn options;\n\t\t}\n\t\treturn new ModelDecorationInjectedTextOptions(options);\n\t}\n\n\tpublic readonly content: string;\n\tpublic readonly tokens: TokenArray | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly attachedData: unknown | null;\n\treadonly cursorStops: model.InjectedTextCursorStops | null;\n\n\tprivate constructor(options: model.InjectedTextOptions) {\n\t\tthis.content = options.content || '';\n\t\tthis.tokens = options.tokens ?? null;\n\t\tthis.inlineClassName = options.inlineClassName || null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.attachedData = options.attachedData || null;\n\t\tthis.cursorStops = options.cursorStops || null;\n\t}\n}\n\nexport class ModelDecorationOptions implements model.IModelDecorationOptions {\n\n\tpublic static EMPTY: ModelDecorationOptions;\n\n\tpublic static register(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\n\tpublic static createDynamic(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\treadonly description: string;\n\treadonly blockClassName: string | null;\n\treadonly blockIsAfterEnd: boolean | null;\n\treadonly blockDoesNotCollapse?: boolean | null;\n\treadonly blockPadding: [top: number, right: number, bottom: number, left: number] | null;\n\treadonly stickiness: model.TrackedRangeStickiness;\n\treadonly zIndex: number;\n\treadonly className: string | null;\n\treadonly shouldFillLineOnLineBreak: boolean | null;\n\treadonly hoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly glyphMarginHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly isWholeLine: boolean;\n\treadonly lineHeight: number | null;\n\treadonly fontSize: string | null;\n\treadonly showIfCollapsed: boolean;\n\treadonly collapseOnReplaceEdit: boolean;\n\treadonly overviewRuler: ModelDecorationOverviewRulerOptions | null;\n\treadonly minimap: ModelDecorationMinimapOptions | null;\n\treadonly glyphMargin?: model.IModelDecorationGlyphMarginOptions | null | undefined;\n\treadonly glyphMarginClassName: string | null;\n\treadonly linesDecorationsClassName: string | null;\n\treadonly lineNumberClassName: string | null;\n\treadonly lineNumberHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly linesDecorationsTooltip: string | null;\n\treadonly firstLineDecorationClassName: string | null;\n\treadonly marginClassName: string | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly beforeContentClassName: string | null;\n\treadonly afterContentClassName: string | null;\n\treadonly after: ModelDecorationInjectedTextOptions | null;\n\treadonly before: ModelDecorationInjectedTextOptions | null;\n\treadonly hideInCommentTokens: boolean | null;\n\treadonly hideInStringTokens: boolean | null;\n\treadonly affectsFont: boolean | null;\n\treadonly textDirection?: model.TextDirection | null | undefined;\n\n\tprivate constructor(options: model.IModelDecorationOptions) {\n\t\tthis.description = options.description;\n\t\tthis.blockClassName = options.blockClassName ? cleanClassName(options.blockClassName) : null;\n\t\tthis.blockDoesNotCollapse = options.blockDoesNotCollapse ?? null;\n\t\tthis.blockIsAfterEnd = options.blockIsAfterEnd ?? null;\n\t\tthis.blockPadding = options.blockPadding ?? null;\n\t\tthis.stickiness = options.stickiness || model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;\n\t\tthis.zIndex = options.zIndex || 0;\n\t\tthis.className = options.className ? cleanClassName(options.className) : null;\n\t\tthis.shouldFillLineOnLineBreak = options.shouldFillLineOnLineBreak ?? null;\n\t\tthis.hoverMessage = options.hoverMessage || null;\n\t\tthis.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;\n\t\tthis.lineNumberHoverMessage = options.lineNumberHoverMessage || null;\n\t\tthis.isWholeLine = options.isWholeLine || false;\n\t\tthis.lineHeight = options.lineHeight ? Math.min(options.lineHeight, LINE_HEIGHT_CEILING) : null;\n\t\tthis.fontSize = options.fontSize || null;\n\t\tthis.affectsFont = !!options.fontSize || !!options.fontFamily || !!options.fontWeight || !!options.fontStyle;\n\t\tthis.showIfCollapsed = options.showIfCollapsed || false;\n\t\tthis.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;\n\t\tthis.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;\n\t\tthis.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;\n\t\tthis.glyphMargin = options.glyphMarginClassName ? new ModelDecorationGlyphMarginOptions(options.glyphMargin) : null;\n\t\tthis.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;\n\t\tthis.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;\n\t\tthis.lineNumberClassName = options.lineNumberClassName ? cleanClassName(options.lineNumberClassName) : null;\n\t\tthis.linesDecorationsTooltip = options.linesDecorationsTooltip ? strings.htmlAttributeEncodeValue(options.linesDecorationsTooltip) : null;\n\t\tthis.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;\n\t\tthis.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;\n\t\tthis.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;\n\t\tthis.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;\n\t\tthis.after = options.after ? ModelDecorationInjectedTextOptions.from(options.after) : null;\n\t\tthis.before = options.before ? ModelDecorationInjectedTextOptions.from(options.before) : null;\n\t\tthis.hideInCommentTokens = options.hideInCommentTokens ?? false;\n\t\tthis.hideInStringTokens = options.hideInStringTokens ?? false;\n\t\tthis.textDirection = options.textDirection ?? null;\n\t}\n}\nModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: 'empty' });\n\n/**\n * The order carefully matches the values of the enum.\n */\nconst TRACKED_RANGE_OPTIONS = [\n\tModelDecorationOptions.register({ description: 'tracked-range-always-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-never-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-before', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-after', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter }),\n];\n\nfunction _normalizeOptions(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\tif (options instanceof ModelDecorationOptions) {\n\t\treturn options;\n\t}\n\treturn ModelDecorationOptions.createDynamic(options);\n}\n\nclass LineHeightChangingDecoration {\n\n\tpublic static toKey(obj: LineHeightChangingDecoration): string {\n\t\treturn `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;\n\t}\n\n\tconstructor(\n\t\tpublic readonly ownerId: number,\n\t\tpublic readonly decorationId: string,\n\t\tpublic readonly lineNumber: number,\n\t\tpublic readonly lineHeight: number | null\n\t) { }\n}\n\nclass LineFontChangingDecoration {\n\n\tpublic static toKey(obj: LineFontChangingDecoration): string {\n\t\treturn `${obj.ownerId};${obj.decorationId};${obj.lineNumber}`;\n\t}\n\n\tconstructor(\n\t\tpublic readonly ownerId: number,\n\t\tpublic readonly decorationId: string,\n\t\tpublic readonly lineNumber: number\n\t) { }\n}\n\nclass DidChangeDecorationsEmitter extends Disposable {\n\n\tprivate readonly _actual: Emitter<IModelDecorationsChangedEvent> = this._register(new Emitter<IModelDecorationsChangedEvent>());\n\tpublic readonly event: Event<IModelDecorationsChangedEvent> = this._actual.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _shouldFireDeferred: boolean;\n\tprivate _affectsMinimap: boolean;\n\tprivate _affectsOverviewRuler: boolean;\n\tprivate _affectedInjectedTextLines: Set<number> | null = null;\n\tprivate _affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null = null;\n\tprivate _affectedFontLines: SetWithKey<LineFontChangingDecoration> | null = null;\n\tprivate _affectsGlyphMargin: boolean;\n\tprivate _affectsLineNumber: boolean;\n\n\tconstructor(private readonly handleBeforeFire: (affectedInjectedTextLines: Set<number> | null, affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null, affectedFontLines: SetWithKey<LineFontChangingDecoration> | null) => void) {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._affectsLineNumber = false;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._shouldFireDeferred) {\n\t\t\t\tthis.doFire();\n\t\t\t}\n\n\t\t\tthis._affectedInjectedTextLines?.clear();\n\t\t\tthis._affectedInjectedTextLines = null;\n\t\t\tthis._affectedLineHeights?.clear();\n\t\t\tthis._affectedLineHeights = null;\n\t\t\tthis._affectedFontLines?.clear();\n\t\t\tthis._affectedFontLines = null;\n\t\t}\n\t}\n\n\tpublic recordLineAffectedByInjectedText(lineNumber: number): void {\n\t\tif (!this._affectedInjectedTextLines) {\n\t\t\tthis._affectedInjectedTextLines = new Set();\n\t\t}\n\t\tthis._affectedInjectedTextLines.add(lineNumber);\n\t}\n\n\tpublic recordLineAffectedByLineHeightChange(ownerId: number, decorationId: string, lineNumber: number, lineHeight: number | null): void {\n\t\tif (!this._affectedLineHeights) {\n\t\t\tthis._affectedLineHeights = new SetWithKey<LineHeightChangingDecoration>([], LineHeightChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedLineHeights.add(new LineHeightChangingDecoration(ownerId, decorationId, lineNumber, lineHeight));\n\t}\n\n\tpublic recordLineAffectedByFontChange(ownerId: number, decorationId: string, lineNumber: number): void {\n\t\tif (!this._affectedFontLines) {\n\t\t\tthis._affectedFontLines = new SetWithKey<LineFontChangingDecoration>([], LineFontChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedFontLines.add(new LineFontChangingDecoration(ownerId, decorationId, lineNumber));\n\t}\n\n\tpublic checkAffectedAndFire(options: ModelDecorationOptions): void {\n\t\tthis._affectsMinimap ||= !!options.minimap?.position;\n\t\tthis._affectsOverviewRuler ||= !!options.overviewRuler?.color;\n\t\tthis._affectsGlyphMargin ||= !!options.glyphMarginClassName;\n\t\tthis._affectsLineNumber ||= !!options.lineNumberClassName;\n\t\tthis.tryFire();\n\t}\n\n\tpublic fire(): void {\n\t\tthis._affectsMinimap = true;\n\t\tthis._affectsOverviewRuler = true;\n\t\tthis._affectsGlyphMargin = true;\n\t\tthis.tryFire();\n\t}\n\n\tprivate tryFire() {\n\t\tif (this._deferredCnt === 0) {\n\t\t\tthis.doFire();\n\t\t} else {\n\t\t\tthis._shouldFireDeferred = true;\n\t\t}\n\t}\n\n\tprivate doFire() {\n\t\tthis.handleBeforeFire(this._affectedInjectedTextLines, this._affectedLineHeights, this._affectedFontLines);\n\n\t\tconst event: IModelDecorationsChangedEvent = {\n\t\t\taffectsMinimap: this._affectsMinimap,\n\t\t\taffectsOverviewRuler: this._affectsOverviewRuler,\n\t\t\taffectsGlyphMargin: this._affectsGlyphMargin,\n\t\t\taffectsLineNumber: this._affectsLineNumber,\n\t\t};\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._actual.fire(event);\n\t}\n}\n\n//#endregion\n\nclass DidChangeContentEmitter extends Disposable {\n\n\t/**\n\t * Both `fastEvent` and `slowEvent` work the same way and contain the same events, but first we invoke `fastEvent` and then `slowEvent`.\n\t */\n\tprivate readonly _fastEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly fastEvent: Event<InternalModelContentChangeEvent> = this._fastEmitter.event;\n\tprivate readonly _slowEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly slowEvent: Event<InternalModelContentChangeEvent> = this._slowEmitter.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _deferredEvent: InternalModelContentChangeEvent | null;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._deferredEvent = null;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(resultingSelection: Selection[] | null = null): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._deferredEvent !== null) {\n\t\t\t\tthis._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection;\n\t\t\t\tconst e = this._deferredEvent;\n\t\t\t\tthis._deferredEvent = null;\n\t\t\t\tthis._fastEmitter.fire(e);\n\t\t\t\tthis._slowEmitter.fire(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic fire(e: InternalModelContentChangeEvent): void {\n\t\tif (this._deferredCnt > 0) {\n\t\t\tif (this._deferredEvent) {\n\t\t\t\tthis._deferredEvent = this._deferredEvent.merge(e);\n\t\t\t} else {\n\t\t\t\tthis._deferredEvent = e;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis._fastEmitter.fire(e);\n\t\tthis._slowEmitter.fire(e);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/textModel.ts","vs/editor/common/model/textModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,OAAO,EAAS,MAAM,+BAA+B,CA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AY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;QACF,CAAC;IACF,CAAC;IAEM,IAAI,CAAC,CAAkC;QAC7C,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBACzB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;YACzB,CAAC;YACD,OAAO;QACR,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACD","file":"textModel.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ArrayQueue, pushMany } from '../../../base/common/arrays.js';\nimport { CharCode } from '../../../base/common/charCode.js';\nimport { SetWithKey } from '../../../base/common/collections.js';\nimport { Color } from '../../../base/common/color.js';\nimport { BugIndicatingError, illegalArgument, onUnexpectedError } from '../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IMarkdownString } from '../../../base/common/htmlContent.js';\nimport { Disposable, IDisposable, MutableDisposable, combinedDisposable } from '../../../base/common/lifecycle.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { ThemeColor } from '../../../base/common/themables.js';\nimport { Constants } from '../../../base/common/uint.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';\nimport { isDark } from '../../../platform/theme/common/theme.js';\nimport { IColorTheme } from '../../../platform/theme/common/themeService.js';\nimport { IUndoRedoService, ResourceEditStackSnapshot, UndoRedoGroup } from '../../../platform/undoRedo/common/undoRedo.js';\nimport { ISingleEditOperation } from '../core/editOperation.js';\nimport { TextEdit } from '../core/edits/textEdit.js';\nimport { countEOL } from '../core/misc/eolCounter.js';\nimport { normalizeIndentation } from '../core/misc/indentation.js';\nimport { EDITOR_MODEL_DEFAULTS } from '../core/misc/textModelDefaults.js';\nimport { IPosition, Position } from '../core/position.js';\nimport { IRange, Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nimport { TextChange } from '../core/textChange.js';\nimport { IWordAtPosition } from '../core/wordHelper.js';\nimport { FormattingOptions } from '../languages.js';\nimport { ILanguageSelection, ILanguageService } from '../languages/language.js';\nimport { ILanguageConfigurationService } from '../languages/languageConfigurationRegistry.js';\nimport * as model from '../model.js';\nimport { IBracketPairsTextModelPart } from '../textModelBracketPairs.js';\nimport { EditSources, TextModelEditSource } from '../textModelEditSource.js';\nimport { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelOptionsChangedEvent, InternalModelContentChangeEvent, LineInjectedText, ModelFontChanged, ModelFontChangedEvent, ModelInjectedTextChangedEvent, ModelLineHeightChanged, ModelLineHeightChangedEvent, ModelRawChange, ModelRawContentChangedEvent, ModelRawEOLChanged, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from '../textModelEvents.js';\nimport { IGuidesTextModelPart } from '../textModelGuides.js';\nimport { ITokenizationTextModelPart } from '../tokenizationTextModelPart.js';\nimport { TokenArray } from '../tokens/lineTokens.js';\nimport { BracketPairsTextModelPart } from './bracketPairsTextModelPart/bracketPairsImpl.js';\nimport { ColorizedBracketPairsDecorationProvider } from './bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js';\nimport { EditStack } from './editStack.js';\nimport { GuidesTextModelPart } from './guidesTextModelPart.js';\nimport { guessIndentation } from './indentationGuesser.js';\nimport { IntervalNode, IntervalTree, recomputeMaxEnd } from './intervalTree.js';\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer/pieceTreeTextBuffer.js';\nimport { PieceTreeTextBufferBuilder } from './pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js';\nimport { SearchParams, TextModelSearch } from './textModelSearch.js';\nimport { AttachedViews } from './tokens/abstractSyntaxTokenBackend.js';\nimport { TokenizationFontDecorationProvider } from './tokens/tokenizationFontDecorationsProvider.js';\nimport { LineFontChangingDecoration, LineHeightChangingDecoration } from './decorationProvider.js';\nimport { TokenizationTextModelPart } from './tokens/tokenizationTextModelPart.js';\n\nexport function createTextBufferFactory(text: string): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\tbuilder.acceptChunk(text);\n\treturn builder.finish();\n}\n\nexport function createTextBufferFactoryFromSnapshot(snapshot: model.ITextSnapshot): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\n\tlet chunk: string | null;\n\twhile (typeof (chunk = snapshot.read()) === 'string') {\n\t\tbuilder.acceptChunk(chunk);\n\t}\n\n\treturn builder.finish();\n}\n\nexport function createTextBuffer(value: string | model.ITextBufferFactory | model.ITextSnapshot, defaultEOL: model.DefaultEndOfLine): { textBuffer: model.ITextBuffer; disposable: IDisposable } {\n\tlet factory: model.ITextBufferFactory;\n\tif (typeof value === 'string') {\n\t\tfactory = createTextBufferFactory(value);\n\t} else if (model.isITextSnapshot(value)) {\n\t\tfactory = createTextBufferFactoryFromSnapshot(value);\n\t} else {\n\t\tfactory = value;\n\t}\n\treturn factory.create(defaultEOL);\n}\n\nlet MODEL_ID = 0;\n\nconst LIMIT_FIND_COUNT = 999;\nconst LONG_LINE_BOUNDARY = 10000;\nconst LINE_HEIGHT_CEILING = 300;\n\nclass TextModelSnapshot implements model.ITextSnapshot {\n\n\tprivate readonly _source: model.ITextSnapshot;\n\tprivate _eos: boolean;\n\n\tconstructor(source: model.ITextSnapshot) {\n\t\tthis._source = source;\n\t\tthis._eos = false;\n\t}\n\n\tpublic read(): string | null {\n\t\tif (this._eos) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst result: string[] = [];\n\t\tlet resultCnt = 0;\n\t\tlet resultLength = 0;\n\n\t\tdo {\n\t\t\tconst tmp = this._source.read();\n\n\t\t\tif (tmp === null) {\n\t\t\t\t// end-of-stream\n\t\t\t\tthis._eos = true;\n\t\t\t\tif (resultCnt === 0) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\treturn result.join('');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (tmp.length > 0) {\n\t\t\t\tresult[resultCnt++] = tmp;\n\t\t\t\tresultLength += tmp.length;\n\t\t\t}\n\n\t\t\tif (resultLength >= 64 * 1024) {\n\t\t\t\treturn result.join('');\n\t\t\t}\n\t\t} while (true);\n\t}\n}\n\nconst invalidFunc = () => { throw new Error(`Invalid change accessor`); };\n\nconst enum StringOffsetValidationType {\n\t/**\n\t * Even allowed in surrogate pairs\n\t */\n\tRelaxed = 0,\n\t/**\n\t * Not allowed in surrogate pairs\n\t */\n\tSurrogatePairs = 1,\n}\n\nexport class TextModel extends Disposable implements model.ITextModel, IDecorationsTreesHost {\n\n\tstatic _MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB, // used in tests\n\tprivate static readonly LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;\n\tprivate static readonly LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines\n\tprivate static readonly LARGE_FILE_HEAP_OPERATION_THRESHOLD = 256 * 1024 * 1024; // 256M characters, usually ~> 512MB memory usage\n\n\tpublic static DEFAULT_CREATION_OPTIONS: model.ITextModelCreationOptions = {\n\t\tisForSimpleWidget: false,\n\t\ttabSize: EDITOR_MODEL_DEFAULTS.tabSize,\n\t\tindentSize: EDITOR_MODEL_DEFAULTS.indentSize,\n\t\tinsertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,\n\t\tdetectIndentation: false,\n\t\tdefaultEOL: model.DefaultEndOfLine.LF,\n\t\ttrimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,\n\t\tlargeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,\n\t\tbracketPairColorizationOptions: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions,\n\t};\n\n\tpublic static resolveOptions(textBuffer: model.ITextBuffer, options: model.ITextModelCreationOptions): model.TextModelResolvedOptions {\n\t\tif (options.detectIndentation) {\n\t\t\tconst guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces);\n\t\t\treturn new model.TextModelResolvedOptions({\n\t\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\t\tindentSize: 'tabSize', // TODO@Alex: guess indentSize independent of tabSize\n\t\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\t\ttrimAutoWhitespace: options.trimAutoWhitespace,\n\t\t\t\tdefaultEOL: options.defaultEOL,\n\t\t\t\tbracketPairColorizationOptions: options.bracketPairColorizationOptions,\n\t\t\t});\n\t\t}\n\n\t\treturn new model.TextModelResolvedOptions(options);\n\t}\n\n\t//#region Events\n\tprivate readonly _onWillDispose: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onWillDispose: Event<void> = this._onWillDispose.event;\n\n\tprivate readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter((affectedInjectedTextLines, affectedLineHeights, affectedFontLines) => this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines, affectedLineHeights, affectedFontLines)));\n\tpublic readonly onDidChangeDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeDecorations.event;\n\n\tpublic get onDidChangeLanguage() { return this._tokenizationTextModelPart.onDidChangeLanguage; }\n\tpublic get onDidChangeLanguageConfiguration() { return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration; }\n\tpublic get onDidChangeTokens() { return this._tokenizationTextModelPart.onDidChangeTokens; }\n\n\tprivate readonly _onDidChangeOptions: Emitter<IModelOptionsChangedEvent> = this._register(new Emitter<IModelOptionsChangedEvent>());\n\tpublic get onDidChangeOptions(): Event<IModelOptionsChangedEvent> { return this._onDidChangeOptions.event; }\n\n\tprivate readonly _onDidChangeAttached: Emitter<void> = this._register(new Emitter<void>());\n\tpublic get onDidChangeAttached(): Event<void> { return this._onDidChangeAttached.event; }\n\n\tprivate readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>());\n\n\tprivate readonly _onDidChangeLineHeight: Emitter<ModelLineHeightChangedEvent> = this._register(new Emitter<ModelLineHeightChangedEvent>());\n\tpublic get onDidChangeLineHeight(): Event<ModelLineHeightChangedEvent> { return this._onDidChangeLineHeight.event; }\n\n\tprivate readonly _onDidChangeFont: Emitter<ModelFontChangedEvent> = this._register(new Emitter<ModelFontChangedEvent>());\n\tpublic get onDidChangeFont(): Event<ModelFontChangedEvent> { return this._onDidChangeFont.event; }\n\n\tprivate readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter());\n\tpublic onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable {\n\t\treturn this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));\n\t}\n\tpublic onDidChangeContentOrInjectedText(listener: (e: InternalModelContentChangeEvent | ModelInjectedTextChangedEvent) => void): IDisposable {\n\t\treturn combinedDisposable(\n\t\t\tthis._eventEmitter.fastEvent(e => listener(e)),\n\t\t\tthis._onDidChangeInjectedText.event(e => listener(e))\n\t\t);\n\t}\n\t//#endregion\n\n\tpublic readonly id: string;\n\tpublic readonly isForSimpleWidget: boolean;\n\tprivate readonly _associatedResource: URI;\n\tprivate _attachedEditorCount: number;\n\tprivate _buffer: model.ITextBuffer;\n\tprivate _bufferDisposable: IDisposable;\n\tprivate _options: model.TextModelResolvedOptions;\n\tprivate readonly _languageSelectionListener = this._register(new MutableDisposable<IDisposable>());\n\n\tprivate _isDisposed: boolean;\n\tprivate __isDisposing: boolean;\n\tpublic _isDisposing(): boolean { return this.__isDisposing; }\n\tprivate _versionId: number;\n\t/**\n\t * Unlike, versionId, this can go down (via undo) or go to previous values (via redo)\n\t */\n\tprivate _alternativeVersionId: number;\n\tprivate _initialUndoRedoSnapshot: ResourceEditStackSnapshot | null;\n\tprivate readonly _isTooLargeForSyncing: boolean;\n\tprivate readonly _isTooLargeForTokenization: boolean;\n\tprivate readonly _isTooLargeForHeapOperation: boolean;\n\n\t//#region Editing\n\tprivate readonly _commandManager: EditStack;\n\tprivate _isUndoing: boolean;\n\tprivate _isRedoing: boolean;\n\tprivate _trimAutoWhitespaceLines: number[] | null;\n\t//#endregion\n\n\t//#region Decorations\n\t/**\n\t * Used to workaround broken clients that might attempt using a decoration id generated by a different model.\n\t * It is not globally unique in order to limit it to one character.\n\t */\n\tprivate readonly _instanceId: string;\n\tprivate _deltaDecorationCallCnt: number = 0;\n\tprivate _lastDecorationId: number;\n\tprivate _decorations: { [decorationId: string]: IntervalNode };\n\tprivate _decorationsTree: DecorationsTrees;\n\tprivate readonly _decorationProvider: ColorizedBracketPairsDecorationProvider;\n\tprivate readonly _fontTokenDecorationsProvider: TokenizationFontDecorationProvider;\n\t//#endregion\n\n\tprivate readonly _tokenizationTextModelPart: TokenizationTextModelPart;\n\tpublic get tokenization(): ITokenizationTextModelPart { return this._tokenizationTextModelPart; }\n\n\tprivate readonly _bracketPairs: BracketPairsTextModelPart;\n\tpublic get bracketPairs(): IBracketPairsTextModelPart { return this._bracketPairs; }\n\n\tprivate readonly _guidesTextModelPart: GuidesTextModelPart;\n\tpublic get guides(): IGuidesTextModelPart { return this._guidesTextModelPart; }\n\n\tprivate readonly _attachedViews = new AttachedViews();\n\n\tconstructor(\n\t\tsource: string | model.ITextBufferFactory,\n\t\tlanguageIdOrSelection: string | ILanguageSelection,\n\t\tcreationOptions: model.ITextModelCreationOptions,\n\t\tassociatedResource: URI | null = null,\n\t\t@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@IInstantiationService private readonly instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\t// Generate a new unique model id\n\t\tMODEL_ID++;\n\t\tthis.id = '$model' + MODEL_ID;\n\t\tthis.isForSimpleWidget = creationOptions.isForSimpleWidget;\n\t\tif (typeof associatedResource === 'undefined' || associatedResource === null) {\n\t\t\tthis._associatedResource = URI.parse('inmemory://model/' + MODEL_ID);\n\t\t} else {\n\t\t\tthis._associatedResource = associatedResource;\n\t\t}\n\t\tthis._attachedEditorCount = 0;\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(source, creationOptions.defaultEOL);\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable = disposable;\n\n\t\tconst bufferLineCount = this._buffer.getLineCount();\n\t\tconst bufferTextLength = this._buffer.getValueLengthInRange(new Range(1, 1, bufferLineCount, this._buffer.getLineLength(bufferLineCount) + 1), model.EndOfLinePreference.TextDefined);\n\n\t\t// !!! Make a decision in the ctor and permanently respect this decision !!!\n\t\t// If a model is too large at construction time, it will never get tokenized,\n\t\t// under no circumstances.\n\t\tif (creationOptions.largeFileOptimizations) {\n\t\t\tthis._isTooLargeForTokenization = (\n\t\t\t\t(bufferTextLength > TextModel.LARGE_FILE_SIZE_THRESHOLD)\n\t\t\t\t|| (bufferLineCount > TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD)\n\t\t\t);\n\n\t\t\tthis._isTooLargeForHeapOperation = bufferTextLength > TextModel.LARGE_FILE_HEAP_OPERATION_THRESHOLD;\n\t\t} else {\n\t\t\tthis._isTooLargeForTokenization = false;\n\t\t\tthis._isTooLargeForHeapOperation = false;\n\t\t}\n\n\t\tthis._options = TextModel.resolveOptions(this._buffer, creationOptions);\n\n\t\tconst languageId = (typeof languageIdOrSelection === 'string' ? languageIdOrSelection : languageIdOrSelection.languageId);\n\t\tif (typeof languageIdOrSelection !== 'string') {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId));\n\t\t}\n\n\t\tthis._bracketPairs = this._register(new BracketPairsTextModelPart(this, this._languageConfigurationService));\n\t\tthis._guidesTextModelPart = this._register(new GuidesTextModelPart(this, this._languageConfigurationService));\n\t\tthis._decorationProvider = this._register(new ColorizedBracketPairsDecorationProvider(this));\n\t\tthis._tokenizationTextModelPart = this.instantiationService.createInstance(TokenizationTextModelPart,\n\t\t\tthis,\n\t\t\tthis._bracketPairs,\n\t\t\tlanguageId,\n\t\t\tthis._attachedViews\n\t\t);\n\t\tthis._fontTokenDecorationsProvider = this._register(new TokenizationFontDecorationProvider(this, this._tokenizationTextModelPart));\n\n\t\tthis._isTooLargeForSyncing = (bufferTextLength > TextModel._MODEL_SYNC_LIMIT);\n\n\t\tthis._versionId = 1;\n\t\tthis._alternativeVersionId = 1;\n\t\tthis._initialUndoRedoSnapshot = null;\n\n\t\tthis._isDisposed = false;\n\t\tthis.__isDisposing = false;\n\n\t\tthis._instanceId = strings.singleLetterHash(MODEL_ID);\n\t\tthis._lastDecorationId = 0;\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\tthis._commandManager = new EditStack(this, this._undoRedoService);\n\t\tthis._isUndoing = false;\n\t\tthis._isRedoing = false;\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\n\t\tthis._register(this._decorationProvider.onDidChange(() => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\t\tthis._register(this._fontTokenDecorationsProvider.onDidChangeLineHeight((affectedLineHeights) => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._fireOnDidChangeLineHeight(affectedLineHeights);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\t\tthis._register(this._fontTokenDecorationsProvider.onDidChangeFont((affectedFontLines) => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._fireOnDidChangeFont(affectedFontLines);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\n\t\tthis._register(this._languageConfigurationService.onDidChange(e => {\n\t\t\tthis._bracketPairs.handleLanguageConfigurationServiceChange(e);\n\t\t\tthis._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(e);\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.__isDisposing = true;\n\t\tthis._onWillDispose.fire();\n\t\tthis._tokenizationTextModelPart.dispose();\n\t\tthis._isDisposed = true;\n\t\tsuper.dispose();\n\t\tthis._bufferDisposable.dispose();\n\t\tthis.__isDisposing = false;\n\t\t// Manually release reference to previous text buffer to avoid large leaks\n\t\t// in case someone leaks a TextModel reference\n\t\tconst emptyDisposedTextBuffer = new PieceTreeTextBuffer([], '', '\\n', false, false, true, true);\n\t\temptyDisposedTextBuffer.dispose();\n\t\tthis._buffer = emptyDisposedTextBuffer;\n\t\tthis._bufferDisposable = Disposable.None;\n\t}\n\n\tprivate _assertNotDisposed(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError('Model is disposed!');\n\t\t}\n\t}\n\n\tpublic getTextBuffer(): model.ITextBuffer {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer;\n\t}\n\n\tprivate _emitContentChangedEvent(rawChange: ModelRawContentChangedEvent, change: IModelContentChangedEvent): void {\n\t\tif (this.__isDisposing) {\n\t\t\t// Do not confuse listeners by emitting any event after disposing\n\t\t\treturn;\n\t\t}\n\t\tthis._tokenizationTextModelPart.handleDidChangeContent(change);\n\t\tthis._bracketPairs.handleDidChangeContent(change);\n\t\tthis._fontTokenDecorationsProvider.handleDidChangeContent(change);\n\t\tthis._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));\n\t}\n\n\tpublic setValue(value: string | model.ITextSnapshot, reason = EditSources.setValue()): void {\n\t\tthis._assertNotDisposed();\n\n\t\tif (value === null || value === undefined) {\n\t\t\tthrow illegalArgument();\n\t\t}\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);\n\t\tthis._setValueFromTextBuffer(textBuffer, disposable, reason);\n\t}\n\n\tprivate _createContentChanged2(range: Range, rangeOffset: number, rangeLength: number, rangeEndPosition: Position, text: string, isUndoing: boolean, isRedoing: boolean, isFlush: boolean, isEolChange: boolean, reason: TextModelEditSource): IModelContentChangedEvent {\n\t\treturn {\n\t\t\tchanges: [{\n\t\t\t\trange: range,\n\t\t\t\trangeOffset: rangeOffset,\n\t\t\t\trangeLength: rangeLength,\n\t\t\t\ttext: text,\n\t\t\t}],\n\t\t\teol: this._buffer.getEOL(),\n\t\t\tisEolChange: isEolChange,\n\t\t\tversionId: this.getVersionId(),\n\t\t\tisUndoing: isUndoing,\n\t\t\tisRedoing: isRedoing,\n\t\t\tisFlush: isFlush,\n\t\t\tdetailedReasons: [reason],\n\t\t\tdetailedReasonsChangeLengths: [1],\n\t\t};\n\t}\n\n\tprivate _setValueFromTextBuffer(textBuffer: model.ITextBuffer, textBufferDisposable: IDisposable, reason: TextModelEditSource): void {\n\t\tthis._assertNotDisposed();\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable.dispose();\n\t\tthis._bufferDisposable = textBufferDisposable;\n\t\tthis._increaseVersionId();\n\n\t\t// Destroy all my decorations\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\t// Destroy my edit history and settings\n\t\tthis._commandManager.clear();\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawFlush()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, true, false, reason)\n\t\t);\n\t}\n\n\tpublic setEOL(eol: model.EndOfLineSequence): void {\n\t\tthis._assertNotDisposed();\n\t\tconst newEOL = (eol === model.EndOfLineSequence.CRLF ? '\\r\\n' : '\\n');\n\t\tif (this._buffer.getEOL() === newEOL) {\n\t\t\t// Nothing to do\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._onBeforeEOLChange();\n\t\tthis._buffer.setEOL(newEOL);\n\t\tthis._increaseVersionId();\n\t\tthis._onAfterEOLChange();\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawEOLChanged()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, false, true, EditSources.eolChange())\n\t\t);\n\t}\n\n\tprivate _onBeforeEOLChange(): void {\n\t\t// Ensure all decorations get their `range` set.\n\t\tthis._decorationsTree.ensureAllNodesHaveRanges(this);\n\t}\n\n\tprivate _onAfterEOLChange(): void {\n\t\t// Transform back `range` to offsets\n\t\tconst versionId = this.getVersionId();\n\t\tconst allDecorations = this._decorationsTree.collectNodesPostOrder();\n\t\tfor (let i = 0, len = allDecorations.length; i < len; i++) {\n\t\t\tconst node = allDecorations[i];\n\t\t\tconst range = node.range!; // the range is defined due to `_onBeforeEOLChange`\n\n\t\t\tconst delta = node.cachedAbsoluteStart - node.start;\n\n\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\tnode.cachedAbsoluteStart = startOffset;\n\t\t\tnode.cachedAbsoluteEnd = endOffset;\n\t\t\tnode.cachedVersionId = versionId;\n\n\t\t\tnode.start = startOffset - delta;\n\t\t\tnode.end = endOffset - delta;\n\n\t\t\trecomputeMaxEnd(node);\n\t\t}\n\t}\n\n\tpublic onBeforeAttached(): model.IAttachedView {\n\t\tthis._attachedEditorCount++;\n\t\tif (this._attachedEditorCount === 1) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\treturn this._attachedViews.attachView();\n\t}\n\n\tpublic onBeforeDetached(view: model.IAttachedView): void {\n\t\tthis._attachedEditorCount--;\n\t\tif (this._attachedEditorCount === 0) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\tthis._attachedViews.detachView(view);\n\t}\n\n\tpublic isAttachedToEditor(): boolean {\n\t\treturn this._attachedEditorCount > 0;\n\t}\n\n\tpublic getAttachedEditorCount(): number {\n\t\treturn this._attachedEditorCount;\n\t}\n\n\tpublic isTooLargeForSyncing(): boolean {\n\t\treturn this._isTooLargeForSyncing;\n\t}\n\n\tpublic isTooLargeForTokenization(): boolean {\n\t\treturn this._isTooLargeForTokenization;\n\t}\n\n\tpublic isTooLargeForHeapOperation(): boolean {\n\t\treturn this._isTooLargeForHeapOperation;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\tpublic isDominatedByLongLines(): boolean {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForTokenization()) {\n\t\t\t// Cannot word wrap huge files anyways, so it doesn't really matter\n\t\t\treturn false;\n\t\t}\n\t\tlet smallLineCharCount = 0;\n\t\tlet longLineCharCount = 0;\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tfor (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {\n\t\t\tconst lineLength = this._buffer.getLineLength(lineNumber);\n\t\t\tif (lineLength >= LONG_LINE_BOUNDARY) {\n\t\t\t\tlongLineCharCount += lineLength;\n\t\t\t} else {\n\t\t\t\tsmallLineCharCount += lineLength;\n\t\t\t}\n\t\t}\n\n\t\treturn (longLineCharCount > smallLineCharCount);\n\t}\n\n\tpublic get uri(): URI {\n\t\treturn this._associatedResource;\n\t}\n\n\t//#region Options\n\n\tpublic getOptions(): model.TextModelResolvedOptions {\n\t\tthis._assertNotDisposed();\n\t\treturn this._options;\n\t}\n\n\tpublic getFormattingOptions(): FormattingOptions {\n\t\treturn {\n\t\t\ttabSize: this._options.indentSize,\n\t\t\tinsertSpaces: this._options.insertSpaces\n\t\t};\n\t}\n\n\tpublic updateOptions(_newOpts: model.ITextModelUpdateOptions): void {\n\t\tthis._assertNotDisposed();\n\t\tconst tabSize = (typeof _newOpts.tabSize !== 'undefined') ? _newOpts.tabSize : this._options.tabSize;\n\t\tconst indentSize = (typeof _newOpts.indentSize !== 'undefined') ? _newOpts.indentSize : this._options.originalIndentSize;\n\t\tconst insertSpaces = (typeof _newOpts.insertSpaces !== 'undefined') ? _newOpts.insertSpaces : this._options.insertSpaces;\n\t\tconst trimAutoWhitespace = (typeof _newOpts.trimAutoWhitespace !== 'undefined') ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;\n\t\tconst bracketPairColorizationOptions = (typeof _newOpts.bracketColorizationOptions !== 'undefined') ? _newOpts.bracketColorizationOptions : this._options.bracketPairColorizationOptions;\n\n\t\tconst newOpts = new model.TextModelResolvedOptions({\n\t\t\ttabSize: tabSize,\n\t\t\tindentSize: indentSize,\n\t\t\tinsertSpaces: insertSpaces,\n\t\t\tdefaultEOL: this._options.defaultEOL,\n\t\t\ttrimAutoWhitespace: trimAutoWhitespace,\n\t\t\tbracketPairColorizationOptions,\n\t\t});\n\n\t\tif (this._options.equals(newOpts)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst e = this._options.createChangeEvent(newOpts);\n\t\tthis._options = newOpts;\n\n\t\tthis._bracketPairs.handleDidChangeOptions(e);\n\t\tthis._decorationProvider.handleDidChangeOptions(e);\n\t\tthis._onDidChangeOptions.fire(e);\n\t}\n\n\tpublic detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void {\n\t\tthis._assertNotDisposed();\n\t\tconst guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);\n\t\tthis.updateOptions({\n\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\tindentSize: guessedIndentation.tabSize, // TODO@Alex: guess indentSize independent of tabSize\n\t\t});\n\t}\n\n\tpublic normalizeIndentation(str: string): string {\n\t\tthis._assertNotDisposed();\n\t\treturn normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);\n\t}\n\n\t//#endregion\n\n\t//#region Reading\n\n\tpublic getVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._versionId;\n\t}\n\n\tpublic mightContainRTL(): boolean {\n\t\treturn this._buffer.mightContainRTL();\n\t}\n\n\tpublic mightContainUnusualLineTerminators(): boolean {\n\t\treturn this._buffer.mightContainUnusualLineTerminators();\n\t}\n\n\tpublic removeUnusualLineTerminators(selections: Selection[] | null = null): void {\n\t\tconst matches = this.findMatches(strings.UNUSUAL_LINE_TERMINATORS.source, false, true, false, null, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tthis._buffer.resetMightContainUnusualLineTerminators();\n\t\tthis.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: null })), () => null);\n\t}\n\n\tpublic mightContainNonBasicASCII(): boolean {\n\t\treturn this._buffer.mightContainNonBasicASCII();\n\t}\n\n\tpublic getAlternativeVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._alternativeVersionId;\n\t}\n\n\tpublic getInitialUndoRedoSnapshot(): ResourceEditStackSnapshot | null {\n\t\tthis._assertNotDisposed();\n\t\treturn this._initialUndoRedoSnapshot;\n\t}\n\n\tpublic getOffsetAt(rawPosition: IPosition): number {\n\t\tthis._assertNotDisposed();\n\t\tconst position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, StringOffsetValidationType.Relaxed);\n\t\treturn this._buffer.getOffsetAt(position.lineNumber, position.column);\n\t}\n\n\tpublic getPositionAt(rawOffset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst offset = (Math.min(this._buffer.getLength(), Math.max(0, rawOffset)));\n\t\treturn this._buffer.getPositionAt(offset);\n\t}\n\n\tprivate _increaseVersionId(): void {\n\t\tthis._versionId = this._versionId + 1;\n\t\tthis._alternativeVersionId = this._versionId;\n\t}\n\n\tpublic _overwriteVersionId(versionId: number): void {\n\t\tthis._versionId = versionId;\n\t}\n\n\tpublic _overwriteAlternativeVersionId(newAlternativeVersionId: number): void {\n\t\tthis._alternativeVersionId = newAlternativeVersionId;\n\t}\n\n\tpublic _overwriteInitialUndoRedoSnapshot(newInitialUndoRedoSnapshot: ResourceEditStackSnapshot | null): void {\n\t\tthis._initialUndoRedoSnapshot = newInitialUndoRedoSnapshot;\n\t}\n\n\tpublic getValue(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): string {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM() + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic createSnapshot(preserveBOM: boolean = false): model.ITextSnapshot {\n\t\treturn new TextModelSnapshot(this._buffer.createSnapshot(preserveBOM));\n\t}\n\n\tpublic getValueLength(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): number {\n\t\tthis._assertNotDisposed();\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueLengthInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM().length + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic getValueInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getValueLengthInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getCharacterCountInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getLineCount(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getLineCount();\n\t}\n\n\tpublic getLineContent(lineNumber: number): string {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineContent(lineNumber);\n\t}\n\n\tpublic getLineLength(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineLength(lineNumber);\n\t}\n\n\tpublic getLinesContent(): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\treturn this._buffer.getLinesContent();\n\t}\n\n\tpublic getEOL(): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getEOL();\n\t}\n\n\tpublic getEndOfLineSequence(): model.EndOfLineSequence {\n\t\tthis._assertNotDisposed();\n\t\treturn (\n\t\t\tthis._buffer.getEOL() === '\\n'\n\t\t\t\t? model.EndOfLineSequence.LF\n\t\t\t\t: model.EndOfLineSequence.CRLF\n\t\t);\n\t}\n\n\tpublic getLineMinColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\treturn 1;\n\t}\n\n\tpublic getLineMaxColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLength(lineNumber) + 1;\n\t}\n\n\tpublic getLineFirstNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);\n\t}\n\n\tpublic getLineLastNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLastNonWhitespaceColumn(lineNumber);\n\t}\n\n\t/**\n\t * Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.\n\t * Will try to not allocate if possible.\n\t */\n\tpublic _validateRangeRelaxedNoAllocations(range: IRange): Range {\n\t\tconst linesCount = this._buffer.getLineCount();\n\n\t\tconst initialStartLineNumber = range.startLineNumber;\n\t\tconst initialStartColumn = range.startColumn;\n\t\tlet startLineNumber = Math.floor((typeof initialStartLineNumber === 'number' && !isNaN(initialStartLineNumber)) ? initialStartLineNumber : 1);\n\t\tlet startColumn = Math.floor((typeof initialStartColumn === 'number' && !isNaN(initialStartColumn)) ? initialStartColumn : 1);\n\n\t\tif (startLineNumber < 1) {\n\t\t\tstartLineNumber = 1;\n\t\t\tstartColumn = 1;\n\t\t} else if (startLineNumber > linesCount) {\n\t\t\tstartLineNumber = linesCount;\n\t\t\tstartColumn = this.getLineMaxColumn(startLineNumber);\n\t\t} else {\n\t\t\tif (startColumn <= 1) {\n\t\t\t\tstartColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(startLineNumber);\n\t\t\t\tif (startColumn >= maxColumn) {\n\t\t\t\t\tstartColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst initialEndLineNumber = range.endLineNumber;\n\t\tconst initialEndColumn = range.endColumn;\n\t\tlet endLineNumber = Math.floor((typeof initialEndLineNumber === 'number' && !isNaN(initialEndLineNumber)) ? initialEndLineNumber : 1);\n\t\tlet endColumn = Math.floor((typeof initialEndColumn === 'number' && !isNaN(initialEndColumn)) ? initialEndColumn : 1);\n\n\t\tif (endLineNumber < 1) {\n\t\t\tendLineNumber = 1;\n\t\t\tendColumn = 1;\n\t\t} else if (endLineNumber > linesCount) {\n\t\t\tendLineNumber = linesCount;\n\t\t\tendColumn = this.getLineMaxColumn(endLineNumber);\n\t\t} else {\n\t\t\tif (endColumn <= 1) {\n\t\t\t\tendColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(endLineNumber);\n\t\t\t\tif (endColumn >= maxColumn) {\n\t\t\t\t\tendColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tinitialStartLineNumber === startLineNumber\n\t\t\t&& initialStartColumn === startColumn\n\t\t\t&& initialEndLineNumber === endLineNumber\n\t\t\t&& initialEndColumn === endColumn\n\t\t\t&& range instanceof Range\n\t\t\t&& !(range instanceof Selection)\n\t\t) {\n\t\t\treturn range;\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tprivate _isValidPosition(lineNumber: number, column: number, validationType: StringOffsetValidationType): boolean {\n\t\tif (typeof lineNumber !== 'number' || typeof column !== 'number') {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isNaN(lineNumber) || isNaN(column)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (lineNumber < 1 || column < 1) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ((lineNumber | 0) !== lineNumber || (column | 0) !== column) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (column === 1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column > maxColumn) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate _validatePosition(_lineNumber: number, _column: number, validationType: StringOffsetValidationType): Position {\n\t\tconst lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1);\n\t\tconst column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1);\n\t\tconst lineCount = this._buffer.getLineCount();\n\n\t\tif (lineNumber < 1) {\n\t\t\treturn new Position(1, 1);\n\t\t}\n\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn new Position(lineCount, this.getLineMaxColumn(lineCount));\n\t\t}\n\n\t\tif (column <= 1) {\n\t\t\treturn new Position(lineNumber, 1);\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column >= maxColumn) {\n\t\t\treturn new Position(lineNumber, maxColumn);\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// If the position would end up in the middle of a high-low surrogate pair,\n\t\t\t// we move it to before the pair\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn new Position(lineNumber, column - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tpublic validatePosition(position: IPosition): Position {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif (position instanceof Position) {\n\t\t\tif (this._isValidPosition(position.lineNumber, position.column, validationType)) {\n\t\t\t\treturn position;\n\t\t\t}\n\t\t}\n\n\t\treturn this._validatePosition(position.lineNumber, position.column, validationType);\n\t}\n\n\tpublic isValidRange(range: Range): boolean {\n\t\treturn this._isValidRange(range, StringOffsetValidationType.SurrogatePairs);\n\t}\n\n\tprivate _isValidRange(range: Range, validationType: StringOffsetValidationType): boolean {\n\t\tconst startLineNumber = range.startLineNumber;\n\t\tconst startColumn = range.startColumn;\n\t\tconst endLineNumber = range.endLineNumber;\n\t\tconst endColumn = range.endColumn;\n\n\t\tif (!this._isValidPosition(startLineNumber, startColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this._isValidPosition(endLineNumber, endColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic validateRange(_range: IRange): Range {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif ((_range instanceof Range) && !(_range instanceof Selection)) {\n\t\t\tif (this._isValidRange(_range, validationType)) {\n\t\t\t\treturn _range;\n\t\t\t}\n\t\t}\n\n\t\tconst start = this._validatePosition(_range.startLineNumber, _range.startColumn, StringOffsetValidationType.Relaxed);\n\t\tconst end = this._validatePosition(_range.endLineNumber, _range.endColumn, StringOffsetValidationType.Relaxed);\n\n\t\tconst startLineNumber = start.lineNumber;\n\t\tconst startColumn = start.column;\n\t\tconst endLineNumber = end.lineNumber;\n\t\tconst endColumn = end.column;\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\tif (startLineNumber === endLineNumber && startColumn === endColumn) {\n\t\t\t\t// do not expand a collapsed range, simply move it to a valid location\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair && endInsideSurrogatePair) {\n\t\t\t\t// expand range at both ends\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair) {\n\t\t\t\t// only expand range at the start\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\t// only expand range at the end\n\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1);\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tpublic modifyPosition(rawPosition: IPosition, offset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst candidate = this.getOffsetAt(rawPosition) + offset;\n\t\treturn this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));\n\t}\n\n\tpublic getFullModelRange(): Range {\n\t\tthis._assertNotDisposed();\n\t\tconst lineCount = this.getLineCount();\n\t\treturn new Range(1, 1, lineCount, this.getLineMaxColumn(lineCount));\n\t}\n\n\tprivate findMatchesLineByLine(searchRange: Range, searchData: model.SearchData, captureMatches: boolean, limitResultCount: number): model.FindMatch[] {\n\t\treturn this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t}\n\n\tpublic findMatches(searchString: string, rawSearchScope: boolean | IRange | IRange[] | null, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount: number = LIMIT_FIND_COUNT): model.FindMatch[] {\n\t\tthis._assertNotDisposed();\n\n\t\tlet searchRanges: Range[] | null = null;\n\n\t\tif (rawSearchScope !== null && typeof rawSearchScope !== 'boolean') {\n\t\t\tif (!Array.isArray(rawSearchScope)) {\n\t\t\t\trawSearchScope = [rawSearchScope];\n\t\t\t}\n\n\t\t\tif (rawSearchScope.every((searchScope: IRange) => Range.isIRange(searchScope))) {\n\t\t\t\tsearchRanges = rawSearchScope.map((searchScope: IRange) => this.validateRange(searchScope));\n\t\t\t}\n\t\t}\n\n\t\tif (searchRanges === null) {\n\t\t\tsearchRanges = [this.getFullModelRange()];\n\t\t}\n\n\t\tsearchRanges = searchRanges.sort((d1, d2) => d1.startLineNumber - d2.startLineNumber || d1.startColumn - d2.startColumn);\n\n\t\tconst uniqueSearchRanges: Range[] = [];\n\t\tuniqueSearchRanges.push(searchRanges.reduce((prev, curr) => {\n\t\t\tif (Range.areIntersecting(prev, curr)) {\n\t\t\t\treturn prev.plusRange(curr);\n\t\t\t}\n\n\t\t\tuniqueSearchRanges.push(prev);\n\t\t\treturn curr;\n\t\t}));\n\n\t\tlet matchMapper: (value: Range, index: number, array: Range[]) => model.FindMatch[];\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\t// not regex, not multi line\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\n\t\t\tif (!searchData) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tmatchMapper = (searchRange: Range) => this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t\t} else {\n\t\t\tmatchMapper = (searchRange: Range) => TextModelSearch.findMatches(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchRange, captureMatches, limitResultCount);\n\t\t}\n\n\t\treturn uniqueSearchRanges.map(matchMapper).reduce((arr, matches: model.FindMatch[]) => arr.concat(matches), []);\n\t}\n\n\tpublic findNextMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\t\t\tif (!searchData) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst lineCount = this.getLineCount();\n\t\t\tlet searchRange = new Range(searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));\n\t\t\tlet ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\t\t\tTextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\tsearchRange = new Range(1, 1, searchStart.lineNumber, this.getLineMaxColumn(searchStart.lineNumber));\n\t\t\tret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\tpublic findPreviousMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\t\treturn TextModelSearch.findPreviousMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\t//#endregion\n\n\t//#region Editing\n\n\tpublic pushStackElement(): void {\n\t\tthis._commandManager.pushStackElement();\n\t}\n\n\tpublic popStackElement(): void {\n\t\tthis._commandManager.popStackElement();\n\t}\n\n\tpublic pushEOL(eol: model.EndOfLineSequence): void {\n\t\tconst currentEOL = (this.getEOL() === '\\n' ? model.EndOfLineSequence.LF : model.EndOfLineSequence.CRLF);\n\t\tif (currentEOL === eol) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t\t}\n\t\t\tthis._commandManager.pushEOL(eol);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _validateEditOperation(rawOperation: model.IIdentifiedSingleEditOperation): model.ValidAnnotatedEditOperation {\n\t\tif (rawOperation instanceof model.ValidAnnotatedEditOperation) {\n\t\t\treturn rawOperation;\n\t\t}\n\n\t\tconst validatedRange = this.validateRange(rawOperation.range);\n\n\t\t// Normalize edit when replacement text ends with lone CR\n\t\t// and the range ends right before a CRLF in the buffer.\n\t\t// We strip the trailing CR from the replacement text.\n\t\tlet opText = rawOperation.text;\n\t\tif (opText) {\n\t\t\tconst endsWithLoneCR = (\n\t\t\t\topText.length > 0 && opText.charCodeAt(opText.length - 1) === CharCode.CarriageReturn\n\t\t\t);\n\t\t\tconst removeTrailingCR = (\n\t\t\t\tthis.getEOL() === '\\r\\n' && endsWithLoneCR && validatedRange.endColumn === this.getLineMaxColumn(validatedRange.endLineNumber)\n\t\t\t);\n\t\t\tif (removeTrailingCR) {\n\t\t\t\topText = opText.substring(0, opText.length - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new model.ValidAnnotatedEditOperation(\n\t\t\trawOperation.identifier || null,\n\t\t\tvalidatedRange,\n\t\t\topText,\n\t\t\trawOperation.forceMoveMarkers || false,\n\t\t\trawOperation.isAutoWhitespaceEdit || false,\n\t\t\trawOperation._isTracked || false\n\t\t);\n\t}\n\n\tprivate _validateEditOperations(rawOperations: readonly model.IIdentifiedSingleEditOperation[]): model.ValidAnnotatedEditOperation[] {\n\t\tconst result: model.ValidAnnotatedEditOperation[] = [];\n\t\tfor (let i = 0, len = rawOperations.length; i < len; i++) {\n\t\t\tresult[i] = this._validateEditOperation(rawOperations[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic edit(edit: TextEdit, options?: { reason?: TextModelEditSource }): void {\n\t\tthis.pushEditOperations(null, edit.replacements.map(r => ({ range: r.range, text: r.text })), null);\n\t}\n\n\tpublic pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.IIdentifiedSingleEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\treturn this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer, group, reason);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.ValidAnnotatedEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\tif (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {\n\t\t\t// Go through each saved line number and insert a trim whitespace edit\n\t\t\t// if it is safe to do so (no conflicts with other edits).\n\n\t\t\tconst incomingEdits = editOperations.map((op) => {\n\t\t\t\treturn {\n\t\t\t\t\trange: this.validateRange(op.range),\n\t\t\t\t\ttext: op.text\n\t\t\t\t};\n\t\t\t});\n\n\t\t\t// Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor\n\t\t\t// We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace\n\t\t\tlet editsAreNearCursors = true;\n\t\t\tif (beforeCursorState) {\n\t\t\t\tfor (let i = 0, len = beforeCursorState.length; i < len; i++) {\n\t\t\t\t\tconst sel = beforeCursorState[i];\n\t\t\t\t\tlet foundEditNearSel = false;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst selIsAbove = editRange.startLineNumber > sel.endLineNumber;\n\t\t\t\t\t\tconst selIsBelow = sel.startLineNumber > editRange.endLineNumber;\n\t\t\t\t\t\tif (!selIsAbove && !selIsBelow) {\n\t\t\t\t\t\t\tfoundEditNearSel = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!foundEditNearSel) {\n\t\t\t\t\t\teditsAreNearCursors = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (editsAreNearCursors) {\n\t\t\t\tfor (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {\n\t\t\t\t\tconst trimLineNumber = this._trimAutoWhitespaceLines[i];\n\t\t\t\t\tconst maxLineColumn = this.getLineMaxColumn(trimLineNumber);\n\n\t\t\t\t\tlet allowTrimLine = true;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst editText = incomingEdits[j].text;\n\n\t\t\t\t\t\tif (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {\n\t\t\t\t\t\t\t// `trimLine` is completely outside this edit\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// At this point:\n\t\t\t\t\t\t// editRange.startLineNumber <= trimLine <= editRange.endLineNumber\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) after `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === 1\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) before `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Looks like we can't trim this line as it would interfere with an incoming edit\n\t\t\t\t\t\tallowTrimLine = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (allowTrimLine) {\n\t\t\t\t\t\tconst trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn);\n\t\t\t\t\t\teditOperations.push(new model.ValidAnnotatedEditOperation(null, trimRange, null, false, false, false));\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._trimAutoWhitespaceLines = null;\n\t\t}\n\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t}\n\t\treturn this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group, reason);\n\t}\n\n\t_applyUndo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.newPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.newEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.oldText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\t_applyRedo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.oldPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.oldEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.newText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, false, true, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\tprivate _applyUndoRedoEdits(edits: ISingleEditOperation[], eol: model.EndOfLineSequence, isUndoing: boolean, isRedoing: boolean, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tthis._isUndoing = isUndoing;\n\t\t\tthis._isRedoing = isRedoing;\n\t\t\tthis.applyEdits(edits, false);\n\t\t\tthis.setEOL(eol);\n\t\t\tthis._overwriteAlternativeVersionId(resultingAlternativeVersionId);\n\t\t} finally {\n\t\t\tthis._isUndoing = false;\n\t\t\tthis._isRedoing = false;\n\t\t\tthis._eventEmitter.endDeferredEmit(resultingSelection);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[]): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true): model.IValidEditOperation[];\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false, reason: TextModelEditSource): void;\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true, reason: TextModelEditSource): model.IValidEditOperation[];\n\tpublic applyEdits(rawOperations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits?: boolean, reason?: TextModelEditSource): void | model.IValidEditOperation[] {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tconst operations = this._validateEditOperations(rawOperations);\n\n\t\t\treturn this._doApplyEdits(operations, computeUndoEdits ?? false, reason ?? EditSources.applyEdits());\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _doApplyEdits(rawOperations: model.ValidAnnotatedEditOperation[], computeUndoEdits: boolean, reason: TextModelEditSource): void | model.IValidEditOperation[] {\n\n\t\tconst oldLineCount = this._buffer.getLineCount();\n\t\tconst result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace, computeUndoEdits);\n\t\tconst newLineCount = this._buffer.getLineCount();\n\n\t\tconst contentChanges = result.changes;\n\t\tthis._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;\n\n\t\tif (contentChanges.length !== 0) {\n\t\t\t// We do a first pass to update decorations\n\t\t\t// because we want to read decorations in the second pass\n\t\t\t// where we will emit content change events\n\t\t\t// and we want to read the final decorations\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tthis._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);\n\t\t\t}\n\n\t\t\tconst rawContentChanges: ModelRawChange[] = [];\n\n\t\t\tthis._increaseVersionId();\n\n\t\t\tlet lineCount = oldLineCount;\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tconst [eolCount] = countEOL(change.text);\n\t\t\t\tthis._onDidChangeDecorations.fire();\n\n\t\t\t\tconst startLineNumber = change.range.startLineNumber;\n\t\t\t\tconst endLineNumber = change.range.endLineNumber;\n\n\t\t\t\tconst deletingLinesCnt = endLineNumber - startLineNumber;\n\t\t\t\tconst insertingLinesCnt = eolCount;\n\t\t\t\tconst editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);\n\n\t\t\t\tconst changeLineCountDelta = (insertingLinesCnt - deletingLinesCnt);\n\n\t\t\t\tconst currentEditStartLineNumber = newLineCount - lineCount - changeLineCountDelta + startLineNumber;\n\t\t\t\tconst firstEditLineNumber = currentEditStartLineNumber;\n\t\t\t\tconst lastInsertedLineNumber = currentEditStartLineNumber + insertingLinesCnt;\n\n\t\t\t\tconst decorationsWithInjectedTextInEditedRange = this._decorationsTree.getInjectedTextInInterval(\n\t\t\t\t\tthis,\n\t\t\t\t\tthis.getOffsetAt(new Position(firstEditLineNumber, 1)),\n\t\t\t\t\tthis.getOffsetAt(new Position(lastInsertedLineNumber, this.getLineMaxColumn(lastInsertedLineNumber))),\n\t\t\t\t\t0\n\t\t\t\t);\n\n\n\t\t\t\tconst injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);\n\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\n\t\t\t\tfor (let j = editingLinesCnt; j >= 0; j--) {\n\t\t\t\t\tconst editLineNumber = startLineNumber + j;\n\t\t\t\t\tconst currentEditLineNumber = currentEditStartLineNumber + j;\n\n\t\t\t\t\tinjectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber > currentEditLineNumber);\n\t\t\t\t\tconst decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber === currentEditLineNumber);\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLineChanged(\n\t\t\t\t\t\t\teditLineNumber,\n\t\t\t\t\t\t\tthis.getLineContent(currentEditLineNumber),\n\t\t\t\t\t\t\tdecorationsInCurrentLine\n\t\t\t\t\t\t));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < deletingLinesCnt) {\n\t\t\t\t\t// Must delete some lines\n\t\t\t\t\tconst spliceStartLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\trawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < insertingLinesCnt) {\n\t\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\t\t\t\t\t// Must insert some lines\n\t\t\t\t\tconst spliceLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\tconst cnt = insertingLinesCnt - editingLinesCnt;\n\t\t\t\t\tconst fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;\n\t\t\t\t\tconst injectedTexts: (LineInjectedText[] | null)[] = [];\n\t\t\t\t\tconst newLines: string[] = [];\n\t\t\t\t\tfor (let i = 0; i < cnt; i++) {\n\t\t\t\t\t\tconst lineNumber = fromLineNumber + i;\n\t\t\t\t\t\tnewLines[i] = this.getLineContent(lineNumber);\n\n\t\t\t\t\t\tinjectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber < lineNumber);\n\t\t\t\t\t\tinjectedTexts[i] = injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber === lineNumber);\n\t\t\t\t\t}\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLinesInserted(\n\t\t\t\t\t\t\tspliceLineNumber + 1,\n\t\t\t\t\t\t\tstartLineNumber + insertingLinesCnt,\n\t\t\t\t\t\t\tnewLines,\n\t\t\t\t\t\t\tinjectedTexts\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlineCount += changeLineCountDelta;\n\t\t\t}\n\n\t\t\tthis._emitContentChangedEvent(\n\t\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t\trawContentChanges,\n\t\t\t\t\tthis.getVersionId(),\n\t\t\t\t\tthis._isUndoing,\n\t\t\t\t\tthis._isRedoing\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tchanges: contentChanges,\n\t\t\t\t\teol: this._buffer.getEOL(),\n\t\t\t\t\tisEolChange: false,\n\t\t\t\t\tversionId: this.getVersionId(),\n\t\t\t\t\tisUndoing: this._isUndoing,\n\t\t\t\t\tisRedoing: this._isRedoing,\n\t\t\t\t\tisFlush: false,\n\t\t\t\t\tdetailedReasons: [reason],\n\t\t\t\t\tdetailedReasonsChangeLengths: [contentChanges.length],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn (result.reverseEdits === null ? undefined : result.reverseEdits);\n\t}\n\n\tpublic undo(): void | Promise<void> {\n\t\treturn this._undoRedoService.undo(this.uri);\n\t}\n\n\tpublic canUndo(): boolean {\n\t\treturn this._undoRedoService.canUndo(this.uri);\n\t}\n\n\tpublic redo(): void | Promise<void> {\n\t\treturn this._undoRedoService.redo(this.uri);\n\t}\n\n\tpublic canRedo(): boolean {\n\t\treturn this._undoRedoService.canRedo(this.uri);\n\t}\n\n\t//#endregion\n\n\t//#region Decorations\n\n\tprivate handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines: Set<number> | null, affectedLineHeights: Set<LineHeightChangingDecoration> | null, affectedFontLines: Set<LineFontChangingDecoration> | null): void {\n\t\t// This is called before the decoration changed event is fired.\n\n\t\tif (affectedInjectedTextLines && affectedInjectedTextLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedInjectedTextLines);\n\t\t\tconst lineChangeEvents = affectedLines.map(lineNumber => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));\n\t\t\tthis._onDidChangeInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));\n\t\t}\n\t\tthis._fireOnDidChangeLineHeight(affectedLineHeights);\n\t\tthis._fireOnDidChangeFont(affectedFontLines);\n\t}\n\n\tprivate _fireOnDidChangeLineHeight(affectedLineHeights: Set<LineHeightChangingDecoration> | null): void {\n\t\tif (affectedLineHeights && affectedLineHeights.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedLineHeights);\n\t\t\tconst lineHeightChangeEvent = affectedLines.map(specialLineHeightChange => new ModelLineHeightChanged(specialLineHeightChange.ownerId, specialLineHeightChange.decorationId, specialLineHeightChange.lineNumber, specialLineHeightChange.lineHeight));\n\t\t\tthis._onDidChangeLineHeight.fire(new ModelLineHeightChangedEvent(lineHeightChangeEvent));\n\t\t}\n\t}\n\n\tprivate _fireOnDidChangeFont(affectedFontLines: Set<LineFontChangingDecoration> | null): void {\n\t\tif (affectedFontLines && affectedFontLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedFontLines);\n\t\t\tconst fontChangeEvent = affectedLines.map(fontChange => new ModelFontChanged(fontChange.ownerId, fontChange.lineNumber));\n\t\t\tthis._onDidChangeFont.fire(new ModelFontChangedEvent(fontChangeEvent));\n\t\t}\n\t}\n\n\tpublic changeDecorations<T>(callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T, ownerId: number = 0): T | null {\n\t\tthis._assertNotDisposed();\n\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._changeDecorations(ownerId, callback);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _changeDecorations<T>(ownerId: number, callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T): T | null {\n\t\tconst changeAccessor: model.IModelDecorationsChangeAccessor = {\n\t\t\taddDecoration: (range: IRange, options: model.IModelDecorationOptions): string => {\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0];\n\t\t\t},\n\t\t\tchangeDecoration: (id: string, newRange: IRange): void => {\n\t\t\t\tthis._changeDecorationImpl(ownerId, id, newRange);\n\t\t\t},\n\t\t\tchangeDecorationOptions: (id: string, options: model.IModelDecorationOptions) => {\n\t\t\t\tthis._changeDecorationOptionsImpl(ownerId, id, _normalizeOptions(options));\n\t\t\t},\n\t\t\tremoveDecoration: (id: string): void => {\n\t\t\t\tthis._deltaDecorationsImpl(ownerId, [id], []);\n\t\t\t},\n\t\t\tdeltaDecorations: (oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[]): string[] => {\n\t\t\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t\t\t// nothing to do\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t\t}\n\t\t};\n\t\tlet result: T | null = null;\n\t\ttry {\n\t\t\tresult = callback(changeAccessor);\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t\t// Invalidate change accessor\n\t\tchangeAccessor.addDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecorationOptions = invalidFunc;\n\t\tchangeAccessor.removeDecoration = invalidFunc;\n\t\tchangeAccessor.deltaDecorations = invalidFunc;\n\t\treturn result;\n\t}\n\n\tpublic deltaDecorations(oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[], ownerId: number = 0): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (!oldDecorations) {\n\t\t\toldDecorations = [];\n\t\t}\n\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t// nothing to do\n\t\t\treturn [];\n\t\t}\n\n\t\ttry {\n\t\t\tthis._deltaDecorationCallCnt++;\n\t\t\tif (this._deltaDecorationCallCnt > 1) {\n\t\t\t\tconsole.warn(`Invoking deltaDecorations recursively could lead to leaking decorations.`);\n\t\t\t\tonUnexpectedError(new Error(`Invoking deltaDecorations recursively could lead to leaking decorations.`));\n\t\t\t}\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t\tthis._deltaDecorationCallCnt--;\n\t\t}\n\t}\n\n\t_getTrackedRange(id: string): Range | null {\n\t\treturn this.getDecorationRange(id);\n\t}\n\n\t_setTrackedRange(id: string | null, newRange: null, newStickiness: model.TrackedRangeStickiness): null;\n\t_setTrackedRange(id: string | null, newRange: Range, newStickiness: model.TrackedRangeStickiness): string;\n\t_setTrackedRange(id: string | null, newRange: Range | null, newStickiness: model.TrackedRangeStickiness): string | null {\n\t\tconst node = (id ? this._decorations[id] : null);\n\n\t\tif (!node) {\n\t\t\tif (!newRange) {\n\t\t\t\t// node doesn't exist, the request is to delete => nothing to do\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// node doesn't exist, the request is to set => add the tracked range\n\t\t\treturn this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }], true)[0];\n\t\t}\n\n\t\tif (!newRange) {\n\t\t\t// node exists, the request is to delete => delete node\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t\treturn null;\n\t\t}\n\n\t\t// node exists, the request is to set => change the tracked range and its options\n\t\tconst range = this._validateRangeRelaxedNoAllocations(newRange);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tnode.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);\n\t\tthis._decorationsTree.insert(node);\n\t\treturn node.id;\n\t}\n\n\tpublic removeAllDecorationsWithOwnerId(ownerId: number): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tconst nodes = this._decorationsTree.collectNodesFromOwner(ownerId);\n\t\tfor (let i = 0, len = nodes.length; i < len; i++) {\n\t\t\tconst node = nodes[i];\n\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t}\n\t}\n\n\tpublic getDecorationOptions(decorationId: string): model.IModelDecorationOptions | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn node.options;\n\t}\n\n\tpublic getDecorationRange(decorationId: string): Range | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this._decorationsTree.getNodeRange(this, node);\n\t}\n\n\tpublic getLineDecorations(lineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\treturn [];\n\t\t}\n\t\treturn this.getLinesDecorations(lineNumber, lineNumber, ownerId, filterOutValidation, filterFontDecorations);\n\t}\n\n\tpublic getLinesDecorations(_startLineNumber: number, _endLineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst lineCount = this.getLineCount();\n\t\tconst startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));\n\t\tconst endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\t\tconst range = new Range(startLineNumber, 1, endLineNumber, endColumn);\n\n\t\tconst decorations = this._getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation));\n\t\tpushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(range, ownerId, filterOutValidation));\n\t\treturn decorations;\n\t}\n\n\tpublic getDecorationsInRange(range: IRange, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMinimapDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst validatedRange = this.validateRange(range);\n\n\t\tconst decorations = this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));\n\t\tpushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));\n\t\treturn decorations;\n\t}\n\n\tpublic getOverviewRulerDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, true, false);\n\t}\n\n\tpublic getInjectedTextDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllInjectedText(this, ownerId);\n\t}\n\n\tpublic getCustomLineHeightsDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllCustomLineHeights(this, ownerId);\n\t}\n\n\tprivate _getInjectedTextInLine(lineNumber: number): LineInjectedText[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(lineNumber, 1);\n\t\tconst endOffset = startOffset + this._buffer.getLineLength(lineNumber);\n\n\t\tconst result = this._decorationsTree.getInjectedTextInInterval(this, startOffset, endOffset, 0);\n\t\treturn LineInjectedText.fromDecorations(result).filter(t => t.lineNumber === lineNumber);\n\t}\n\n\tpublic getFontDecorationsInRange(range: IRange, ownerId: number = 0): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\treturn this._decorationsTree.getFontDecorationsInInterval(this, startOffset, endOffset, ownerId);\n\t}\n\n\tpublic getAllDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tlet result = this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, false, false);\n\t\tresult = result.concat(this._decorationProvider.getAllDecorations(ownerId, filterOutValidation));\n\t\tresult = result.concat(this._fontTokenDecorationsProvider.getAllDecorations(ownerId, filterOutValidation));\n\t\treturn result;\n\t}\n\n\tpublic getAllMarginDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, false, false, false, true);\n\t}\n\n\tprivate _getDecorationsInRange(filterRange: Range, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);\n\t\treturn this._decorationsTree.getAllInInterval(this, startOffset, endOffset, filterOwnerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t}\n\n\tpublic getRangeAt(start: number, end: number): Range {\n\t\treturn this._buffer.getRangeAt(start, end - start);\n\t}\n\n\tprivate _changeDecorationImpl(ownerId: number, decorationId: string, _range: IRange): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (node.options.after) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, oldRange!.startLineNumber, null);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, oldRange!.startLineNumber);\n\t\t}\n\n\t\tconst range = this._validateRangeRelaxedNoAllocations(_range);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tthis._decorationsTree.insert(node);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\n\t\tif (node.options.after) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, range.startLineNumber, node.options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t}\n\t}\n\n\tprivate _changeDecorationOptionsImpl(ownerId: number, decorationId: string, options: ModelDecorationOptions): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n\t\tconst nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);\n\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\n\t\tif (node.options.after || options.after) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t}\n\t\tif (node.options.before || options.before) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null || options.lineHeight !== null) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont || options.affectsFont) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t}\n\n\t\tconst movedInOverviewRuler = nodeWasInOverviewRuler !== nodeIsInOverviewRuler;\n\t\tconst changedWhetherInjectedText = isOptionsInjectedText(options) !== isNodeInjectedText(node);\n\t\tif (movedInOverviewRuler || changedWhetherInjectedText) {\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tnode.setOptions(options);\n\t\t\tthis._decorationsTree.insert(node);\n\t\t} else {\n\t\t\tnode.setOptions(options);\n\t\t}\n\t}\n\n\tprivate _deltaDecorationsImpl(ownerId: number, oldDecorationsIds: string[], newDecorations: model.IModelDeltaDecoration[], suppressEvents: boolean = false): string[] {\n\t\tconst versionId = this.getVersionId();\n\n\t\tconst oldDecorationsLen = oldDecorationsIds.length;\n\t\tlet oldDecorationIndex = 0;\n\n\t\tconst newDecorationsLen = newDecorations.length;\n\t\tlet newDecorationIndex = 0;\n\n\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\ttry {\n\t\t\tconst result = new Array<string>(newDecorationsLen);\n\t\t\twhile (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {\n\n\t\t\t\tlet node: IntervalNode | null = null;\n\n\t\t\t\tif (oldDecorationIndex < oldDecorationsLen) {\n\t\t\t\t\t// (1) get ourselves an old node\n\t\t\t\t\tlet decorationId: string;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tdecorationId = oldDecorationsIds[oldDecorationIndex++];\n\t\t\t\t\t\tnode = this._decorations[decorationId];\n\t\t\t\t\t} while (!node && oldDecorationIndex < oldDecorationsLen);\n\n\t\t\t\t\t// (2) remove the node from the tree (if it exists)\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, null);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._decorationsTree.delete(node);\n\n\t\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newDecorationIndex < newDecorationsLen) {\n\t\t\t\t\t// (3) create a new node if necessary\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tconst internalDecorationId = (++this._lastDecorationId);\n\t\t\t\t\t\tconst decorationId = `${this._instanceId};${internalDecorationId}`;\n\t\t\t\t\t\tnode = new IntervalNode(decorationId, 0, 0);\n\t\t\t\t\t\tthis._decorations[decorationId] = node;\n\t\t\t\t\t}\n\n\t\t\t\t\t// (4) initialize node\n\t\t\t\t\tconst newDecoration = newDecorations[newDecorationIndex];\n\t\t\t\t\tconst range = this._validateRangeRelaxedNoAllocations(newDecoration.range);\n\t\t\t\t\tconst options = _normalizeOptions(newDecoration.options);\n\t\t\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\t\t\tnode.ownerId = ownerId;\n\t\t\t\t\tnode.reset(versionId, startOffset, endOffset, range);\n\t\t\t\t\tnode.setOptions(options);\n\n\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, node.id, range.startLineNumber, node.options.lineHeight);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._decorationsTree.insert(node);\n\n\t\t\t\t\tresult[newDecorationIndex] = node.id;\n\n\t\t\t\t\tnewDecorationIndex++;\n\t\t\t\t} else {\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tdelete this._decorations[node.id];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region Tokenization\n\n\t// TODO move them to the tokenization part.\n\tpublic getLanguageId(): string {\n\t\treturn this.tokenization.getLanguageId();\n\t}\n\n\tpublic setLanguage(languageIdOrSelection: string | ILanguageSelection, source?: string): void {\n\t\tif (typeof languageIdOrSelection === 'string') {\n\t\t\tthis._languageSelectionListener.clear();\n\t\t\tthis._setLanguage(languageIdOrSelection, source);\n\t\t} else {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId, source));\n\t\t\tthis._setLanguage(languageIdOrSelection.languageId, source);\n\t\t}\n\t}\n\n\tprivate _setLanguage(languageId: string, source?: string): void {\n\t\tthis.tokenization.setLanguageId(languageId, source);\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\t}\n\n\tpublic getLanguageIdAtPosition(lineNumber: number, column: number): string {\n\t\treturn this.tokenization.getLanguageIdAtPosition(lineNumber, column);\n\t}\n\n\tpublic getWordAtPosition(position: IPosition): IWordAtPosition | null {\n\t\treturn this._tokenizationTextModelPart.getWordAtPosition(position);\n\t}\n\n\tpublic getWordUntilPosition(position: IPosition): IWordAtPosition {\n\t\treturn this._tokenizationTextModelPart.getWordUntilPosition(position);\n\t}\n\n\t//#endregion\n\tnormalizePosition(position: Position, affinity: model.PositionAffinity): Position {\n\t\treturn position;\n\t}\n\n\t/**\n\t * Gets the column at which indentation stops at a given line.\n\t * @internal\n\t*/\n\tpublic getLineIndentColumn(lineNumber: number): number {\n\t\t// Columns start with 1.\n\t\treturn indentOfLine(this.getLineContent(lineNumber)) + 1;\n\t}\n\n\tpublic override toString(): string {\n\t\treturn `TextModel(${this.uri.toString()})`;\n\t}\n}\n\nexport function indentOfLine(line: string): number {\n\tlet indent = 0;\n\tfor (const c of line) {\n\t\tif (c === ' ' || c === '\\t') {\n\t\t\tindent++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn indent;\n}\n\n//#region Decorations\n\nfunction isNodeInOverviewRuler(node: IntervalNode): boolean {\n\treturn (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n}\n\nfunction isOptionsInjectedText(options: ModelDecorationOptions): boolean {\n\treturn !!options.after || !!options.before;\n}\n\nfunction isNodeInjectedText(node: IntervalNode): boolean {\n\treturn !!node.options.after || !!node.options.before;\n}\n\nexport interface IDecorationsTreesHost {\n\tgetVersionId(): number;\n\tgetRangeAt(start: number, end: number): Range;\n}\n\nclass DecorationsTrees {\n\n\t/**\n\t * This tree holds decorations that do not show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree0: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree1: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that contain injected text.\n\t */\n\tprivate readonly _injectedTextDecorationsTree: IntervalTree;\n\n\tconstructor() {\n\t\tthis._decorationsTree0 = new IntervalTree();\n\t\tthis._decorationsTree1 = new IntervalTree();\n\t\tthis._injectedTextDecorationsTree = new IntervalTree();\n\t}\n\n\tpublic ensureAllNodesHaveRanges(host: IDecorationsTreesHost): void {\n\t\tthis.getAll(host, 0, false, false, false, false);\n\t}\n\n\tprivate _ensureNodesHaveRanges(host: IDecorationsTreesHost, nodes: IntervalNode[]): model.IModelDecoration[] {\n\t\tfor (const node of nodes) {\n\t\t\tif (node.range === null) {\n\t\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t\t}\n\t\t}\n\t\treturn <model.IModelDecoration[]>nodes;\n\t}\n\n\tpublic getAllInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _intervalSearch(start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r2 = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic getInjectedTextInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getFontDecorationsInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst decorations = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, decorations).filter((i) => i.options.affectsFont);\n\t}\n\n\tpublic getAllInjectedText(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.search(filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getAllCustomLineHeights(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, false, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => typeof i.options.lineHeight === 'number');\n\t}\n\n\tpublic getAll(host: IDecorationsTreesHost, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, filterOutValidation, filterFontDecorations, overviewRulerOnly, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _search(filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tif (overviewRulerOnly) {\n\t\t\treturn this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t} else {\n\t\t\tconst r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r2 = this._injectedTextDecorationsTree.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\treturn r0.concat(r1).concat(r2);\n\t\t}\n\t}\n\n\tpublic collectNodesFromOwner(ownerId: number): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesFromOwner(ownerId);\n\t\tconst r1 = this._decorationsTree1.collectNodesFromOwner(ownerId);\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesFromOwner(ownerId);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic collectNodesPostOrder(): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesPostOrder();\n\t\tconst r1 = this._decorationsTree1.collectNodesPostOrder();\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic insert(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.insert(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.insert(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.insert(node);\n\t\t}\n\t}\n\n\tpublic delete(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.delete(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.delete(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.delete(node);\n\t\t}\n\t}\n\n\tpublic getNodeRange(host: IDecorationsTreesHost, node: IntervalNode): Range {\n\t\tconst versionId = host.getVersionId();\n\t\tif (node.cachedVersionId !== versionId) {\n\t\t\tthis._resolveNode(node, versionId);\n\t\t}\n\t\tif (node.range === null) {\n\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t}\n\t\treturn node.range;\n\t}\n\n\tprivate _resolveNode(node: IntervalNode, cachedVersionId: number): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.resolveNode(node, cachedVersionId);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.resolveNode(node, cachedVersionId);\n\t\t} else {\n\t\t\tthis._decorationsTree0.resolveNode(node, cachedVersionId);\n\t\t}\n\t}\n\n\tpublic acceptReplace(offset: number, length: number, textLength: number, forceMoveMarkers: boolean): void {\n\t\tthis._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._injectedTextDecorationsTree.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t}\n}\n\nfunction cleanClassName(className: string): string {\n\treturn className.replace(/[^a-z0-9\\-_]/gi, ' ');\n}\n\nclass DecorationOptions implements model.IDecorationOptions {\n\treadonly color: string | ThemeColor;\n\treadonly darkColor: string | ThemeColor;\n\n\tconstructor(options: model.IDecorationOptions) {\n\t\tthis.color = options.color || '';\n\t\tthis.darkColor = options.darkColor || '';\n\n\t}\n}\n\nexport class ModelDecorationOverviewRulerOptions extends DecorationOptions {\n\treadonly position: model.OverviewRulerLane;\n\tprivate _resolvedColor: string | null;\n\n\tconstructor(options: model.IModelDecorationOverviewRulerOptions) {\n\t\tsuper(options);\n\t\tthis._resolvedColor = null;\n\t\tthis.position = (typeof options.position === 'number' ? options.position : model.OverviewRulerLane.Center);\n\t}\n\n\tpublic getColor(theme: IColorTheme): string {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = null;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): string {\n\t\tif (typeof color === 'string') {\n\t\t\treturn color;\n\t\t}\n\t\tconst c = color ? theme.getColor(color.id) : null;\n\t\tif (!c) {\n\t\t\treturn '';\n\t\t}\n\t\treturn c.toString();\n\t}\n}\n\nexport class ModelDecorationGlyphMarginOptions {\n\treadonly position: model.GlyphMarginLane;\n\treadonly persistLane: boolean | undefined;\n\n\tconstructor(options: model.IModelDecorationGlyphMarginOptions | null | undefined) {\n\t\tthis.position = options?.position ?? model.GlyphMarginLane.Center;\n\t\tthis.persistLane = options?.persistLane;\n\t}\n}\n\nexport class ModelDecorationMinimapOptions extends DecorationOptions {\n\treadonly position: model.MinimapPosition;\n\treadonly sectionHeaderStyle: model.MinimapSectionHeaderStyle | null;\n\treadonly sectionHeaderText: string | null;\n\tprivate _resolvedColor: Color | undefined;\n\n\tconstructor(options: model.IModelDecorationMinimapOptions) {\n\t\tsuper(options);\n\t\tthis.position = options.position;\n\t\tthis.sectionHeaderStyle = options.sectionHeaderStyle ?? null;\n\t\tthis.sectionHeaderText = options.sectionHeaderText ?? null;\n\t}\n\n\tpublic getColor(theme: IColorTheme): Color | undefined {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = undefined;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): Color | undefined {\n\t\tif (typeof color === 'string') {\n\t\t\treturn Color.fromHex(color);\n\t\t}\n\t\treturn theme.getColor(color.id);\n\t}\n}\n\nexport class ModelDecorationInjectedTextOptions implements model.InjectedTextOptions {\n\tpublic static from(options: model.InjectedTextOptions): ModelDecorationInjectedTextOptions {\n\t\tif (options instanceof ModelDecorationInjectedTextOptions) {\n\t\t\treturn options;\n\t\t}\n\t\treturn new ModelDecorationInjectedTextOptions(options);\n\t}\n\n\tpublic readonly content: string;\n\tpublic readonly tokens: TokenArray | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly attachedData: unknown | null;\n\treadonly cursorStops: model.InjectedTextCursorStops | null;\n\n\tprivate constructor(options: model.InjectedTextOptions) {\n\t\tthis.content = options.content || '';\n\t\tthis.tokens = options.tokens ?? null;\n\t\tthis.inlineClassName = options.inlineClassName || null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.attachedData = options.attachedData || null;\n\t\tthis.cursorStops = options.cursorStops || null;\n\t}\n}\n\nexport class ModelDecorationOptions implements model.IModelDecorationOptions {\n\n\tpublic static EMPTY: ModelDecorationOptions;\n\n\tpublic static register(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\n\tpublic static createDynamic(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\treadonly description: string;\n\treadonly blockClassName: string | null;\n\treadonly blockIsAfterEnd: boolean | null;\n\treadonly blockDoesNotCollapse?: boolean | null;\n\treadonly blockPadding: [top: number, right: number, bottom: number, left: number] | null;\n\treadonly stickiness: model.TrackedRangeStickiness;\n\treadonly zIndex: number;\n\treadonly className: string | null;\n\treadonly shouldFillLineOnLineBreak: boolean | null;\n\treadonly hoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly glyphMarginHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly isWholeLine: boolean;\n\treadonly lineHeight: number | null;\n\treadonly fontSize: string | null;\n\treadonly showIfCollapsed: boolean;\n\treadonly collapseOnReplaceEdit: boolean;\n\treadonly overviewRuler: ModelDecorationOverviewRulerOptions | null;\n\treadonly minimap: ModelDecorationMinimapOptions | null;\n\treadonly glyphMargin?: model.IModelDecorationGlyphMarginOptions | null | undefined;\n\treadonly glyphMarginClassName: string | null;\n\treadonly linesDecorationsClassName: string | null;\n\treadonly lineNumberClassName: string | null;\n\treadonly lineNumberHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly linesDecorationsTooltip: string | null;\n\treadonly firstLineDecorationClassName: string | null;\n\treadonly marginClassName: string | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly beforeContentClassName: string | null;\n\treadonly afterContentClassName: string | null;\n\treadonly after: ModelDecorationInjectedTextOptions | null;\n\treadonly before: ModelDecorationInjectedTextOptions | null;\n\treadonly hideInCommentTokens: boolean | null;\n\treadonly hideInStringTokens: boolean | null;\n\treadonly affectsFont: boolean | null;\n\treadonly textDirection?: model.TextDirection | null | undefined;\n\n\tprivate constructor(options: model.IModelDecorationOptions) {\n\t\tthis.description = options.description;\n\t\tthis.blockClassName = options.blockClassName ? cleanClassName(options.blockClassName) : null;\n\t\tthis.blockDoesNotCollapse = options.blockDoesNotCollapse ?? null;\n\t\tthis.blockIsAfterEnd = options.blockIsAfterEnd ?? null;\n\t\tthis.blockPadding = options.blockPadding ?? null;\n\t\tthis.stickiness = options.stickiness || model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;\n\t\tthis.zIndex = options.zIndex || 0;\n\t\tthis.className = options.className ? cleanClassName(options.className) : null;\n\t\tthis.shouldFillLineOnLineBreak = options.shouldFillLineOnLineBreak ?? null;\n\t\tthis.hoverMessage = options.hoverMessage || null;\n\t\tthis.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;\n\t\tthis.lineNumberHoverMessage = options.lineNumberHoverMessage || null;\n\t\tthis.isWholeLine = options.isWholeLine || false;\n\t\tthis.lineHeight = options.lineHeight ? Math.min(options.lineHeight, LINE_HEIGHT_CEILING) : null;\n\t\tthis.fontSize = options.fontSize || null;\n\t\tthis.affectsFont = !!options.fontSize || !!options.fontFamily || !!options.fontWeight || !!options.fontStyle;\n\t\tthis.showIfCollapsed = options.showIfCollapsed || false;\n\t\tthis.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;\n\t\tthis.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;\n\t\tthis.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;\n\t\tthis.glyphMargin = options.glyphMarginClassName ? new ModelDecorationGlyphMarginOptions(options.glyphMargin) : null;\n\t\tthis.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;\n\t\tthis.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;\n\t\tthis.lineNumberClassName = options.lineNumberClassName ? cleanClassName(options.lineNumberClassName) : null;\n\t\tthis.linesDecorationsTooltip = options.linesDecorationsTooltip ? strings.htmlAttributeEncodeValue(options.linesDecorationsTooltip) : null;\n\t\tthis.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;\n\t\tthis.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;\n\t\tthis.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;\n\t\tthis.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;\n\t\tthis.after = options.after ? ModelDecorationInjectedTextOptions.from(options.after) : null;\n\t\tthis.before = options.before ? ModelDecorationInjectedTextOptions.from(options.before) : null;\n\t\tthis.hideInCommentTokens = options.hideInCommentTokens ?? false;\n\t\tthis.hideInStringTokens = options.hideInStringTokens ?? false;\n\t\tthis.textDirection = options.textDirection ?? null;\n\t}\n}\nModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: 'empty' });\n\n/**\n * The order carefully matches the values of the enum.\n */\nconst TRACKED_RANGE_OPTIONS = [\n\tModelDecorationOptions.register({ description: 'tracked-range-always-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-never-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-before', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-after', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter }),\n];\n\nfunction _normalizeOptions(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\tif (options instanceof ModelDecorationOptions) {\n\t\treturn options;\n\t}\n\treturn ModelDecorationOptions.createDynamic(options);\n}\n\n\nclass DidChangeDecorationsEmitter extends Disposable {\n\n\tprivate readonly _actual: Emitter<IModelDecorationsChangedEvent> = this._register(new Emitter<IModelDecorationsChangedEvent>());\n\tpublic readonly event: Event<IModelDecorationsChangedEvent> = this._actual.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _shouldFireDeferred: boolean;\n\tprivate _affectsMinimap: boolean;\n\tprivate _affectsOverviewRuler: boolean;\n\tprivate _affectedInjectedTextLines: Set<number> | null = null;\n\tprivate _affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null = null;\n\tprivate _affectedFontLines: SetWithKey<LineFontChangingDecoration> | null = null;\n\tprivate _affectsGlyphMargin: boolean;\n\tprivate _affectsLineNumber: boolean;\n\n\tconstructor(private readonly handleBeforeFire: (affectedInjectedTextLines: Set<number> | null, affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null, affectedFontLines: SetWithKey<LineFontChangingDecoration> | null) => void) {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._affectsLineNumber = false;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._shouldFireDeferred) {\n\t\t\t\tthis.doFire();\n\t\t\t}\n\n\t\t\tthis._affectedInjectedTextLines?.clear();\n\t\t\tthis._affectedInjectedTextLines = null;\n\t\t\tthis._affectedLineHeights?.clear();\n\t\t\tthis._affectedLineHeights = null;\n\t\t\tthis._affectedFontLines?.clear();\n\t\t\tthis._affectedFontLines = null;\n\t\t}\n\t}\n\n\tpublic recordLineAffectedByInjectedText(lineNumber: number): void {\n\t\tif (!this._affectedInjectedTextLines) {\n\t\t\tthis._affectedInjectedTextLines = new Set();\n\t\t}\n\t\tthis._affectedInjectedTextLines.add(lineNumber);\n\t}\n\n\tpublic recordLineAffectedByLineHeightChange(ownerId: number, decorationId: string, lineNumber: number, lineHeight: number | null): void {\n\t\tif (!this._affectedLineHeights) {\n\t\t\tthis._affectedLineHeights = new SetWithKey<LineHeightChangingDecoration>([], LineHeightChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedLineHeights.add(new LineHeightChangingDecoration(ownerId, decorationId, lineNumber, lineHeight));\n\t}\n\n\tpublic recordLineAffectedByFontChange(ownerId: number, decorationId: string, lineNumber: number): void {\n\t\tif (!this._affectedFontLines) {\n\t\t\tthis._affectedFontLines = new SetWithKey<LineFontChangingDecoration>([], LineFontChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedFontLines.add(new LineFontChangingDecoration(ownerId, decorationId, lineNumber));\n\t}\n\n\tpublic checkAffectedAndFire(options: ModelDecorationOptions): void {\n\t\tthis._affectsMinimap ||= !!options.minimap?.position;\n\t\tthis._affectsOverviewRuler ||= !!options.overviewRuler?.color;\n\t\tthis._affectsGlyphMargin ||= !!options.glyphMarginClassName;\n\t\tthis._affectsLineNumber ||= !!options.lineNumberClassName;\n\t\tthis.tryFire();\n\t}\n\n\tpublic fire(): void {\n\t\tthis._affectsMinimap = true;\n\t\tthis._affectsOverviewRuler = true;\n\t\tthis._affectsGlyphMargin = true;\n\t\tthis.tryFire();\n\t}\n\n\tprivate tryFire() {\n\t\tif (this._deferredCnt === 0) {\n\t\t\tthis.doFire();\n\t\t} else {\n\t\t\tthis._shouldFireDeferred = true;\n\t\t}\n\t}\n\n\tprivate doFire() {\n\t\tthis.handleBeforeFire(this._affectedInjectedTextLines, this._affectedLineHeights, this._affectedFontLines);\n\n\t\tconst event: IModelDecorationsChangedEvent = {\n\t\t\taffectsMinimap: this._affectsMinimap,\n\t\t\taffectsOverviewRuler: this._affectsOverviewRuler,\n\t\t\taffectsGlyphMargin: this._affectsGlyphMargin,\n\t\t\taffectsLineNumber: this._affectsLineNumber,\n\t\t};\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._actual.fire(event);\n\t}\n}\n\n//#endregion\n\nclass DidChangeContentEmitter extends Disposable {\n\n\t/**\n\t * Both `fastEvent` and `slowEvent` work the same way and contain the same events, but first we invoke `fastEvent` and then `slowEvent`.\n\t */\n\tprivate readonly _fastEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly fastEvent: Event<InternalModelContentChangeEvent> = this._fastEmitter.event;\n\tprivate readonly _slowEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly slowEvent: Event<InternalModelContentChangeEvent> = this._slowEmitter.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _deferredEvent: InternalModelContentChangeEvent | null;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._deferredEvent = null;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(resultingSelection: Selection[] | null = null): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._deferredEvent !== null) {\n\t\t\t\tthis._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection;\n\t\t\t\tconst e = this._deferredEvent;\n\t\t\t\tthis._deferredEvent = null;\n\t\t\t\tthis._fastEmitter.fire(e);\n\t\t\t\tthis._slowEmitter.fire(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic fire(e: InternalModelContentChangeEvent): void {\n\t\tif (this._deferredCnt > 0) {\n\t\t\tif (this._deferredEvent) {\n\t\t\t\tthis._deferredEvent = this._deferredEvent.merge(e);\n\t\t\t} else {\n\t\t\t\tthis._deferredEvent = e;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis._fastEmitter.fire(e);\n\t\tthis._slowEmitter.fire(e);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ArrayQueue, pushMany } from '../../../base/common/arrays.js';\nimport { CharCode } from '../../../base/common/charCode.js';\nimport { SetWithKey } from '../../../base/common/collections.js';\nimport { Color } from '../../../base/common/color.js';\nimport { BugIndicatingError, illegalArgument, onUnexpectedError } from '../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../base/common/event.js';\nimport { IMarkdownString } from '../../../base/common/htmlContent.js';\nimport { Disposable, IDisposable, MutableDisposable, combinedDisposable } from '../../../base/common/lifecycle.js';\nimport * as strings from '../../../base/common/strings.js';\nimport { ThemeColor } from '../../../base/common/themables.js';\nimport { Constants } from '../../../base/common/uint.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';\nimport { isDark } from '../../../platform/theme/common/theme.js';\nimport { IColorTheme } from '../../../platform/theme/common/themeService.js';\nimport { IUndoRedoService, ResourceEditStackSnapshot, UndoRedoGroup } from '../../../platform/undoRedo/common/undoRedo.js';\nimport { ISingleEditOperation } from '../core/editOperation.js';\nimport { TextEdit } from '../core/edits/textEdit.js';\nimport { countEOL } from '../core/misc/eolCounter.js';\nimport { normalizeIndentation } from '../core/misc/indentation.js';\nimport { EDITOR_MODEL_DEFAULTS } from '../core/misc/textModelDefaults.js';\nimport { IPosition, Position } from '../core/position.js';\nimport { IRange, Range } from '../core/range.js';\nimport { Selection } from '../core/selection.js';\nimport { TextChange } from '../core/textChange.js';\nimport { IWordAtPosition } from '../core/wordHelper.js';\nimport { FormattingOptions } from '../languages.js';\nimport { ILanguageSelection, ILanguageService } from '../languages/language.js';\nimport { ILanguageConfigurationService } from '../languages/languageConfigurationRegistry.js';\nimport * as model from '../model.js';\nimport { IBracketPairsTextModelPart } from '../textModelBracketPairs.js';\nimport { EditSources, TextModelEditSource } from '../textModelEditSource.js';\nimport { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelOptionsChangedEvent, InternalModelContentChangeEvent, LineInjectedText, ModelFontChanged, ModelFontChangedEvent, ModelInjectedTextChangedEvent, ModelLineHeightChanged, ModelLineHeightChangedEvent, ModelRawChange, ModelRawContentChangedEvent, ModelRawEOLChanged, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from '../textModelEvents.js';\nimport { IGuidesTextModelPart } from '../textModelGuides.js';\nimport { ITokenizationTextModelPart } from '../tokenizationTextModelPart.js';\nimport { TokenArray } from '../tokens/lineTokens.js';\nimport { BracketPairsTextModelPart } from './bracketPairsTextModelPart/bracketPairsImpl.js';\nimport { ColorizedBracketPairsDecorationProvider } from './bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js';\nimport { EditStack } from './editStack.js';\nimport { GuidesTextModelPart } from './guidesTextModelPart.js';\nimport { guessIndentation } from './indentationGuesser.js';\nimport { IntervalNode, IntervalTree, recomputeMaxEnd } from './intervalTree.js';\nimport { PieceTreeTextBuffer } from './pieceTreeTextBuffer/pieceTreeTextBuffer.js';\nimport { PieceTreeTextBufferBuilder } from './pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js';\nimport { SearchParams, TextModelSearch } from './textModelSearch.js';\nimport { AttachedViews } from './tokens/abstractSyntaxTokenBackend.js';\nimport { TokenizationFontDecorationProvider } from './tokens/tokenizationFontDecorationsProvider.js';\nimport { LineFontChangingDecoration, LineHeightChangingDecoration } from './decorationProvider.js';\nimport { TokenizationTextModelPart } from './tokens/tokenizationTextModelPart.js';\n\nexport function createTextBufferFactory(text: string): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\tbuilder.acceptChunk(text);\n\treturn builder.finish();\n}\n\nexport function createTextBufferFactoryFromSnapshot(snapshot: model.ITextSnapshot): model.ITextBufferFactory {\n\tconst builder = new PieceTreeTextBufferBuilder();\n\n\tlet chunk: string | null;\n\twhile (typeof (chunk = snapshot.read()) === 'string') {\n\t\tbuilder.acceptChunk(chunk);\n\t}\n\n\treturn builder.finish();\n}\n\nexport function createTextBuffer(value: string | model.ITextBufferFactory | model.ITextSnapshot, defaultEOL: model.DefaultEndOfLine): { textBuffer: model.ITextBuffer; disposable: IDisposable } {\n\tlet factory: model.ITextBufferFactory;\n\tif (typeof value === 'string') {\n\t\tfactory = createTextBufferFactory(value);\n\t} else if (model.isITextSnapshot(value)) {\n\t\tfactory = createTextBufferFactoryFromSnapshot(value);\n\t} else {\n\t\tfactory = value;\n\t}\n\treturn factory.create(defaultEOL);\n}\n\nlet MODEL_ID = 0;\n\nconst LIMIT_FIND_COUNT = 999;\nconst LONG_LINE_BOUNDARY = 10000;\nconst LINE_HEIGHT_CEILING = 300;\n\nclass TextModelSnapshot implements model.ITextSnapshot {\n\n\tprivate readonly _source: model.ITextSnapshot;\n\tprivate _eos: boolean;\n\n\tconstructor(source: model.ITextSnapshot) {\n\t\tthis._source = source;\n\t\tthis._eos = false;\n\t}\n\n\tpublic read(): string | null {\n\t\tif (this._eos) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst result: string[] = [];\n\t\tlet resultCnt = 0;\n\t\tlet resultLength = 0;\n\n\t\tdo {\n\t\t\tconst tmp = this._source.read();\n\n\t\t\tif (tmp === null) {\n\t\t\t\t// end-of-stream\n\t\t\t\tthis._eos = true;\n\t\t\t\tif (resultCnt === 0) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\treturn result.join('');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (tmp.length > 0) {\n\t\t\t\tresult[resultCnt++] = tmp;\n\t\t\t\tresultLength += tmp.length;\n\t\t\t}\n\n\t\t\tif (resultLength >= 64 * 1024) {\n\t\t\t\treturn result.join('');\n\t\t\t}\n\t\t} while (true);\n\t}\n}\n\nconst invalidFunc = () => { throw new Error(`Invalid change accessor`); };\n\nconst enum StringOffsetValidationType {\n\t/**\n\t * Even allowed in surrogate pairs\n\t */\n\tRelaxed = 0,\n\t/**\n\t * Not allowed in surrogate pairs\n\t */\n\tSurrogatePairs = 1,\n}\n\nexport class TextModel extends Disposable implements model.ITextModel, IDecorationsTreesHost {\n\n\tstatic _MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB, // used in tests\n\tprivate static readonly LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;\n\tprivate static readonly LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines\n\tprivate static readonly LARGE_FILE_HEAP_OPERATION_THRESHOLD = 256 * 1024 * 1024; // 256M characters, usually ~> 512MB memory usage\n\n\tpublic static DEFAULT_CREATION_OPTIONS: model.ITextModelCreationOptions = {\n\t\tisForSimpleWidget: false,\n\t\ttabSize: EDITOR_MODEL_DEFAULTS.tabSize,\n\t\tindentSize: EDITOR_MODEL_DEFAULTS.indentSize,\n\t\tinsertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,\n\t\tdetectIndentation: false,\n\t\tdefaultEOL: model.DefaultEndOfLine.LF,\n\t\ttrimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,\n\t\tlargeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,\n\t\tbracketPairColorizationOptions: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions,\n\t};\n\n\tpublic static resolveOptions(textBuffer: model.ITextBuffer, options: model.ITextModelCreationOptions): model.TextModelResolvedOptions {\n\t\tif (options.detectIndentation) {\n\t\t\tconst guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces);\n\t\t\treturn new model.TextModelResolvedOptions({\n\t\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\t\tindentSize: 'tabSize', // TODO@Alex: guess indentSize independent of tabSize\n\t\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\t\ttrimAutoWhitespace: options.trimAutoWhitespace,\n\t\t\t\tdefaultEOL: options.defaultEOL,\n\t\t\t\tbracketPairColorizationOptions: options.bracketPairColorizationOptions,\n\t\t\t});\n\t\t}\n\n\t\treturn new model.TextModelResolvedOptions(options);\n\t}\n\n\t//#region Events\n\tprivate readonly _onWillDispose: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onWillDispose: Event<void> = this._onWillDispose.event;\n\n\tprivate readonly _onDidChangeDecorations: DidChangeDecorationsEmitter = this._register(new DidChangeDecorationsEmitter((affectedInjectedTextLines, affectedLineHeights, affectedFontLines) => this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines, affectedLineHeights, affectedFontLines)));\n\tpublic readonly onDidChangeDecorations: Event<IModelDecorationsChangedEvent> = this._onDidChangeDecorations.event;\n\n\tpublic get onDidChangeLanguage() { return this._tokenizationTextModelPart.onDidChangeLanguage; }\n\tpublic get onDidChangeLanguageConfiguration() { return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration; }\n\tpublic get onDidChangeTokens() { return this._tokenizationTextModelPart.onDidChangeTokens; }\n\n\tprivate readonly _onDidChangeOptions: Emitter<IModelOptionsChangedEvent> = this._register(new Emitter<IModelOptionsChangedEvent>());\n\tpublic get onDidChangeOptions(): Event<IModelOptionsChangedEvent> { return this._onDidChangeOptions.event; }\n\n\tprivate readonly _onDidChangeAttached: Emitter<void> = this._register(new Emitter<void>());\n\tpublic get onDidChangeAttached(): Event<void> { return this._onDidChangeAttached.event; }\n\n\tprivate readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>());\n\n\tprivate readonly _onDidChangeLineHeight: Emitter<ModelLineHeightChangedEvent> = this._register(new Emitter<ModelLineHeightChangedEvent>());\n\tpublic get onDidChangeLineHeight(): Event<ModelLineHeightChangedEvent> { return this._onDidChangeLineHeight.event; }\n\n\tprivate readonly _onDidChangeFont: Emitter<ModelFontChangedEvent> = this._register(new Emitter<ModelFontChangedEvent>());\n\tpublic get onDidChangeFont(): Event<ModelFontChangedEvent> { return this._onDidChangeFont.event; }\n\n\tprivate readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter());\n\tpublic onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable {\n\t\treturn this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));\n\t}\n\tpublic onDidChangeContentOrInjectedText(listener: (e: InternalModelContentChangeEvent | ModelInjectedTextChangedEvent) => void): IDisposable {\n\t\treturn combinedDisposable(\n\t\t\tthis._eventEmitter.fastEvent(e => listener(e)),\n\t\t\tthis._onDidChangeInjectedText.event(e => listener(e))\n\t\t);\n\t}\n\t//#endregion\n\n\tpublic readonly id: string;\n\tpublic readonly isForSimpleWidget: boolean;\n\tprivate readonly _associatedResource: URI;\n\tprivate _attachedEditorCount: number;\n\tprivate _buffer: model.ITextBuffer;\n\tprivate _bufferDisposable: IDisposable;\n\tprivate _options: model.TextModelResolvedOptions;\n\tprivate readonly _languageSelectionListener = this._register(new MutableDisposable<IDisposable>());\n\n\tprivate _isDisposed: boolean;\n\tprivate __isDisposing: boolean;\n\tpublic _isDisposing(): boolean { return this.__isDisposing; }\n\tprivate _versionId: number;\n\t/**\n\t * Unlike, versionId, this can go down (via undo) or go to previous values (via redo)\n\t */\n\tprivate _alternativeVersionId: number;\n\tprivate _initialUndoRedoSnapshot: ResourceEditStackSnapshot | null;\n\tprivate readonly _isTooLargeForSyncing: boolean;\n\tprivate readonly _isTooLargeForTokenization: boolean;\n\tprivate readonly _isTooLargeForHeapOperation: boolean;\n\n\t//#region Editing\n\tprivate readonly _commandManager: EditStack;\n\tprivate _isUndoing: boolean;\n\tprivate _isRedoing: boolean;\n\tprivate _trimAutoWhitespaceLines: number[] | null;\n\t//#endregion\n\n\t//#region Decorations\n\t/**\n\t * Used to workaround broken clients that might attempt using a decoration id generated by a different model.\n\t * It is not globally unique in order to limit it to one character.\n\t */\n\tprivate readonly _instanceId: string;\n\tprivate _deltaDecorationCallCnt: number = 0;\n\tprivate _lastDecorationId: number;\n\tprivate _decorations: { [decorationId: string]: IntervalNode };\n\tprivate _decorationsTree: DecorationsTrees;\n\tprivate readonly _decorationProvider: ColorizedBracketPairsDecorationProvider;\n\tprivate readonly _fontTokenDecorationsProvider: TokenizationFontDecorationProvider;\n\t//#endregion\n\n\tprivate readonly _tokenizationTextModelPart: TokenizationTextModelPart;\n\tpublic get tokenization(): ITokenizationTextModelPart { return this._tokenizationTextModelPart; }\n\n\tprivate readonly _bracketPairs: BracketPairsTextModelPart;\n\tpublic get bracketPairs(): IBracketPairsTextModelPart { return this._bracketPairs; }\n\n\tprivate readonly _guidesTextModelPart: GuidesTextModelPart;\n\tpublic get guides(): IGuidesTextModelPart { return this._guidesTextModelPart; }\n\n\tprivate readonly _attachedViews = new AttachedViews();\n\n\tconstructor(\n\t\tsource: string | model.ITextBufferFactory,\n\t\tlanguageIdOrSelection: string | ILanguageSelection,\n\t\tcreationOptions: model.ITextModelCreationOptions,\n\t\tassociatedResource: URI | null = null,\n\t\t@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@IInstantiationService private readonly instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\t// Generate a new unique model id\n\t\tMODEL_ID++;\n\t\tthis.id = '$model' + MODEL_ID;\n\t\tthis.isForSimpleWidget = creationOptions.isForSimpleWidget;\n\t\tif (typeof associatedResource === 'undefined' || associatedResource === null) {\n\t\t\tthis._associatedResource = URI.parse('inmemory://model/' + MODEL_ID);\n\t\t} else {\n\t\t\tthis._associatedResource = associatedResource;\n\t\t}\n\t\tthis._attachedEditorCount = 0;\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(source, creationOptions.defaultEOL);\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable = disposable;\n\n\t\tconst bufferLineCount = this._buffer.getLineCount();\n\t\tconst bufferTextLength = this._buffer.getValueLengthInRange(new Range(1, 1, bufferLineCount, this._buffer.getLineLength(bufferLineCount) + 1), model.EndOfLinePreference.TextDefined);\n\n\t\t// !!! Make a decision in the ctor and permanently respect this decision !!!\n\t\t// If a model is too large at construction time, it will never get tokenized,\n\t\t// under no circumstances.\n\t\tif (creationOptions.largeFileOptimizations) {\n\t\t\tthis._isTooLargeForTokenization = (\n\t\t\t\t(bufferTextLength > TextModel.LARGE_FILE_SIZE_THRESHOLD)\n\t\t\t\t|| (bufferLineCount > TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD)\n\t\t\t);\n\n\t\t\tthis._isTooLargeForHeapOperation = bufferTextLength > TextModel.LARGE_FILE_HEAP_OPERATION_THRESHOLD;\n\t\t} else {\n\t\t\tthis._isTooLargeForTokenization = false;\n\t\t\tthis._isTooLargeForHeapOperation = false;\n\t\t}\n\n\t\tthis._options = TextModel.resolveOptions(this._buffer, creationOptions);\n\n\t\tconst languageId = (typeof languageIdOrSelection === 'string' ? languageIdOrSelection : languageIdOrSelection.languageId);\n\t\tif (typeof languageIdOrSelection !== 'string') {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId));\n\t\t}\n\n\t\tthis._bracketPairs = this._register(new BracketPairsTextModelPart(this, this._languageConfigurationService));\n\t\tthis._guidesTextModelPart = this._register(new GuidesTextModelPart(this, this._languageConfigurationService));\n\t\tthis._decorationProvider = this._register(new ColorizedBracketPairsDecorationProvider(this));\n\t\tthis._tokenizationTextModelPart = this.instantiationService.createInstance(TokenizationTextModelPart,\n\t\t\tthis,\n\t\t\tthis._bracketPairs,\n\t\t\tlanguageId,\n\t\t\tthis._attachedViews\n\t\t);\n\t\tthis._fontTokenDecorationsProvider = this._register(new TokenizationFontDecorationProvider(this, this._tokenizationTextModelPart));\n\n\t\tthis._isTooLargeForSyncing = (bufferTextLength > TextModel._MODEL_SYNC_LIMIT);\n\n\t\tthis._versionId = 1;\n\t\tthis._alternativeVersionId = 1;\n\t\tthis._initialUndoRedoSnapshot = null;\n\n\t\tthis._isDisposed = false;\n\t\tthis.__isDisposing = false;\n\n\t\tthis._instanceId = strings.singleLetterHash(MODEL_ID);\n\t\tthis._lastDecorationId = 0;\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\tthis._commandManager = new EditStack(this, this._undoRedoService);\n\t\tthis._isUndoing = false;\n\t\tthis._isRedoing = false;\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\n\t\tthis._register(this._decorationProvider.onDidChange(() => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\t\tthis._register(this._fontTokenDecorationsProvider.onDidChangeLineHeight((affectedLineHeights) => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._fireOnDidChangeLineHeight(affectedLineHeights);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\t\tthis._register(this._fontTokenDecorationsProvider.onDidChangeFont((affectedFontLines) => {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.fire();\n\t\t\tthis._fireOnDidChangeFont(affectedFontLines);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}));\n\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\n\t\tthis._register(this._languageConfigurationService.onDidChange(e => {\n\t\t\tthis._bracketPairs.handleLanguageConfigurationServiceChange(e);\n\t\t\tthis._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(e);\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.__isDisposing = true;\n\t\tthis._onWillDispose.fire();\n\t\tthis._tokenizationTextModelPart.dispose();\n\t\tthis._isDisposed = true;\n\t\tsuper.dispose();\n\t\tthis._bufferDisposable.dispose();\n\t\tthis.__isDisposing = false;\n\t\t// Manually release reference to previous text buffer to avoid large leaks\n\t\t// in case someone leaks a TextModel reference\n\t\tconst emptyDisposedTextBuffer = new PieceTreeTextBuffer([], '', '\\n', false, false, true, true);\n\t\temptyDisposedTextBuffer.dispose();\n\t\tthis._buffer = emptyDisposedTextBuffer;\n\t\tthis._bufferDisposable = Disposable.None;\n\t}\n\n\tprivate _assertNotDisposed(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError('Model is disposed!');\n\t\t}\n\t}\n\n\tpublic getTextBuffer(): model.ITextBuffer {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer;\n\t}\n\n\tprivate _emitContentChangedEvent(rawChange: ModelRawContentChangedEvent, change: IModelContentChangedEvent): void {\n\t\tif (this.__isDisposing) {\n\t\t\t// Do not confuse listeners by emitting any event after disposing\n\t\t\treturn;\n\t\t}\n\t\tthis._tokenizationTextModelPart.handleDidChangeContent(change);\n\t\tthis._bracketPairs.handleDidChangeContent(change);\n\t\tthis._fontTokenDecorationsProvider.handleDidChangeContent(change);\n\t\tthis._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));\n\t}\n\n\tpublic setValue(value: string | model.ITextSnapshot, reason = EditSources.setValue()): void {\n\t\tthis._assertNotDisposed();\n\n\t\tif (value === null || value === undefined) {\n\t\t\tthrow illegalArgument();\n\t\t}\n\n\t\tconst { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);\n\t\tthis._setValueFromTextBuffer(textBuffer, disposable, reason);\n\t}\n\n\tprivate _createContentChanged2(range: Range, rangeOffset: number, rangeLength: number, rangeEndPosition: Position, text: string, isUndoing: boolean, isRedoing: boolean, isFlush: boolean, isEolChange: boolean, reason: TextModelEditSource): IModelContentChangedEvent {\n\t\treturn {\n\t\t\tchanges: [{\n\t\t\t\trange: range,\n\t\t\t\trangeOffset: rangeOffset,\n\t\t\t\trangeLength: rangeLength,\n\t\t\t\ttext: text,\n\t\t\t}],\n\t\t\teol: this._buffer.getEOL(),\n\t\t\tisEolChange: isEolChange,\n\t\t\tversionId: this.getVersionId(),\n\t\t\tisUndoing: isUndoing,\n\t\t\tisRedoing: isRedoing,\n\t\t\tisFlush: isFlush,\n\t\t\tdetailedReasons: [reason],\n\t\t\tdetailedReasonsChangeLengths: [1],\n\t\t};\n\t}\n\n\tprivate _setValueFromTextBuffer(textBuffer: model.ITextBuffer, textBufferDisposable: IDisposable, reason: TextModelEditSource): void {\n\t\tthis._assertNotDisposed();\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._buffer = textBuffer;\n\t\tthis._bufferDisposable.dispose();\n\t\tthis._bufferDisposable = textBufferDisposable;\n\t\tthis._increaseVersionId();\n\n\t\t// Destroy all my decorations\n\t\tthis._decorations = Object.create(null);\n\t\tthis._decorationsTree = new DecorationsTrees();\n\n\t\t// Destroy my edit history and settings\n\t\tthis._commandManager.clear();\n\t\tthis._trimAutoWhitespaceLines = null;\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawFlush()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, true, false, reason)\n\t\t);\n\t}\n\n\tpublic setEOL(eol: model.EndOfLineSequence): void {\n\t\tthis._assertNotDisposed();\n\t\tconst newEOL = (eol === model.EndOfLineSequence.CRLF ? '\\r\\n' : '\\n');\n\t\tif (this._buffer.getEOL() === newEOL) {\n\t\t\t// Nothing to do\n\t\t\treturn;\n\t\t}\n\n\t\tconst oldFullModelRange = this.getFullModelRange();\n\t\tconst oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);\n\t\tconst endLineNumber = this.getLineCount();\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\n\t\tthis._onBeforeEOLChange();\n\t\tthis._buffer.setEOL(newEOL);\n\t\tthis._increaseVersionId();\n\t\tthis._onAfterEOLChange();\n\n\t\tthis._emitContentChangedEvent(\n\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t[\n\t\t\t\t\tnew ModelRawEOLChanged()\n\t\t\t\t],\n\t\t\t\tthis._versionId,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tthis._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, false, true, EditSources.eolChange())\n\t\t);\n\t}\n\n\tprivate _onBeforeEOLChange(): void {\n\t\t// Ensure all decorations get their `range` set.\n\t\tthis._decorationsTree.ensureAllNodesHaveRanges(this);\n\t}\n\n\tprivate _onAfterEOLChange(): void {\n\t\t// Transform back `range` to offsets\n\t\tconst versionId = this.getVersionId();\n\t\tconst allDecorations = this._decorationsTree.collectNodesPostOrder();\n\t\tfor (let i = 0, len = allDecorations.length; i < len; i++) {\n\t\t\tconst node = allDecorations[i];\n\t\t\tconst range = node.range!; // the range is defined due to `_onBeforeEOLChange`\n\n\t\t\tconst delta = node.cachedAbsoluteStart - node.start;\n\n\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\tnode.cachedAbsoluteStart = startOffset;\n\t\t\tnode.cachedAbsoluteEnd = endOffset;\n\t\t\tnode.cachedVersionId = versionId;\n\n\t\t\tnode.start = startOffset - delta;\n\t\t\tnode.end = endOffset - delta;\n\n\t\t\trecomputeMaxEnd(node);\n\t\t}\n\t}\n\n\tpublic onBeforeAttached(): model.IAttachedView {\n\t\tthis._attachedEditorCount++;\n\t\tif (this._attachedEditorCount === 1) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\treturn this._attachedViews.attachView();\n\t}\n\n\tpublic onBeforeDetached(view: model.IAttachedView): void {\n\t\tthis._attachedEditorCount--;\n\t\tif (this._attachedEditorCount === 0) {\n\t\t\tthis._tokenizationTextModelPart.handleDidChangeAttached();\n\t\t\tthis._onDidChangeAttached.fire(undefined);\n\t\t}\n\t\tthis._attachedViews.detachView(view);\n\t}\n\n\tpublic isAttachedToEditor(): boolean {\n\t\treturn this._attachedEditorCount > 0;\n\t}\n\n\tpublic getAttachedEditorCount(): number {\n\t\treturn this._attachedEditorCount;\n\t}\n\n\tpublic isTooLargeForSyncing(): boolean {\n\t\treturn this._isTooLargeForSyncing;\n\t}\n\n\tpublic isTooLargeForTokenization(): boolean {\n\t\treturn this._isTooLargeForTokenization;\n\t}\n\n\tpublic isTooLargeForHeapOperation(): boolean {\n\t\treturn this._isTooLargeForHeapOperation;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\tpublic isDominatedByLongLines(): boolean {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForTokenization()) {\n\t\t\t// Cannot word wrap huge files anyways, so it doesn't really matter\n\t\t\treturn false;\n\t\t}\n\t\tlet smallLineCharCount = 0;\n\t\tlet longLineCharCount = 0;\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tfor (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {\n\t\t\tconst lineLength = this._buffer.getLineLength(lineNumber);\n\t\t\tif (lineLength >= LONG_LINE_BOUNDARY) {\n\t\t\t\tlongLineCharCount += lineLength;\n\t\t\t} else {\n\t\t\t\tsmallLineCharCount += lineLength;\n\t\t\t}\n\t\t}\n\n\t\treturn (longLineCharCount > smallLineCharCount);\n\t}\n\n\tpublic get uri(): URI {\n\t\treturn this._associatedResource;\n\t}\n\n\t//#region Options\n\n\tpublic getOptions(): model.TextModelResolvedOptions {\n\t\tthis._assertNotDisposed();\n\t\treturn this._options;\n\t}\n\n\tpublic getFormattingOptions(): FormattingOptions {\n\t\treturn {\n\t\t\ttabSize: this._options.indentSize,\n\t\t\tinsertSpaces: this._options.insertSpaces\n\t\t};\n\t}\n\n\tpublic updateOptions(_newOpts: model.ITextModelUpdateOptions): void {\n\t\tthis._assertNotDisposed();\n\t\tconst tabSize = (typeof _newOpts.tabSize !== 'undefined') ? _newOpts.tabSize : this._options.tabSize;\n\t\tconst indentSize = (typeof _newOpts.indentSize !== 'undefined') ? _newOpts.indentSize : this._options.originalIndentSize;\n\t\tconst insertSpaces = (typeof _newOpts.insertSpaces !== 'undefined') ? _newOpts.insertSpaces : this._options.insertSpaces;\n\t\tconst trimAutoWhitespace = (typeof _newOpts.trimAutoWhitespace !== 'undefined') ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;\n\t\tconst bracketPairColorizationOptions = (typeof _newOpts.bracketColorizationOptions !== 'undefined') ? _newOpts.bracketColorizationOptions : this._options.bracketPairColorizationOptions;\n\n\t\tconst newOpts = new model.TextModelResolvedOptions({\n\t\t\ttabSize: tabSize,\n\t\t\tindentSize: indentSize,\n\t\t\tinsertSpaces: insertSpaces,\n\t\t\tdefaultEOL: this._options.defaultEOL,\n\t\t\ttrimAutoWhitespace: trimAutoWhitespace,\n\t\t\tbracketPairColorizationOptions,\n\t\t});\n\n\t\tif (this._options.equals(newOpts)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst e = this._options.createChangeEvent(newOpts);\n\t\tthis._options = newOpts;\n\n\t\tthis._bracketPairs.handleDidChangeOptions(e);\n\t\tthis._decorationProvider.handleDidChangeOptions(e);\n\t\tthis._onDidChangeOptions.fire(e);\n\t}\n\n\tpublic detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void {\n\t\tthis._assertNotDisposed();\n\t\tconst guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);\n\t\tthis.updateOptions({\n\t\t\tinsertSpaces: guessedIndentation.insertSpaces,\n\t\t\ttabSize: guessedIndentation.tabSize,\n\t\t\tindentSize: guessedIndentation.tabSize, // TODO@Alex: guess indentSize independent of tabSize\n\t\t});\n\t}\n\n\tpublic normalizeIndentation(str: string): string {\n\t\tthis._assertNotDisposed();\n\t\treturn normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);\n\t}\n\n\t//#endregion\n\n\t//#region Reading\n\n\tpublic getVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._versionId;\n\t}\n\n\tpublic mightContainRTL(): boolean {\n\t\treturn this._buffer.mightContainRTL();\n\t}\n\n\tpublic mightContainUnusualLineTerminators(): boolean {\n\t\treturn this._buffer.mightContainUnusualLineTerminators();\n\t}\n\n\tpublic removeUnusualLineTerminators(selections: Selection[] | null = null): void {\n\t\tconst matches = this.findMatches(strings.UNUSUAL_LINE_TERMINATORS.source, false, true, false, null, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tthis._buffer.resetMightContainUnusualLineTerminators();\n\t\tthis.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: null })), () => null);\n\t}\n\n\tpublic mightContainNonBasicASCII(): boolean {\n\t\treturn this._buffer.mightContainNonBasicASCII();\n\t}\n\n\tpublic getAlternativeVersionId(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._alternativeVersionId;\n\t}\n\n\tpublic getInitialUndoRedoSnapshot(): ResourceEditStackSnapshot | null {\n\t\tthis._assertNotDisposed();\n\t\treturn this._initialUndoRedoSnapshot;\n\t}\n\n\tpublic getOffsetAt(rawPosition: IPosition): number {\n\t\tthis._assertNotDisposed();\n\t\tconst position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, StringOffsetValidationType.Relaxed);\n\t\treturn this._buffer.getOffsetAt(position.lineNumber, position.column);\n\t}\n\n\tpublic getPositionAt(rawOffset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst offset = (Math.min(this._buffer.getLength(), Math.max(0, rawOffset)));\n\t\treturn this._buffer.getPositionAt(offset);\n\t}\n\n\tprivate _increaseVersionId(): void {\n\t\tthis._versionId = this._versionId + 1;\n\t\tthis._alternativeVersionId = this._versionId;\n\t}\n\n\tpublic _overwriteVersionId(versionId: number): void {\n\t\tthis._versionId = versionId;\n\t}\n\n\tpublic _overwriteAlternativeVersionId(newAlternativeVersionId: number): void {\n\t\tthis._alternativeVersionId = newAlternativeVersionId;\n\t}\n\n\tpublic _overwriteInitialUndoRedoSnapshot(newInitialUndoRedoSnapshot: ResourceEditStackSnapshot | null): void {\n\t\tthis._initialUndoRedoSnapshot = newInitialUndoRedoSnapshot;\n\t}\n\n\tpublic getValue(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): string {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM() + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic createSnapshot(preserveBOM: boolean = false): model.ITextSnapshot {\n\t\treturn new TextModelSnapshot(this._buffer.createSnapshot(preserveBOM));\n\t}\n\n\tpublic getValueLength(eol?: model.EndOfLinePreference, preserveBOM: boolean = false): number {\n\t\tthis._assertNotDisposed();\n\t\tconst fullModelRange = this.getFullModelRange();\n\t\tconst fullModelValue = this.getValueLengthInRange(fullModelRange, eol);\n\n\t\tif (preserveBOM) {\n\t\t\treturn this._buffer.getBOM().length + fullModelValue;\n\t\t}\n\n\t\treturn fullModelValue;\n\t}\n\n\tpublic getValueInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getValueLengthInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getCharacterCountInRange(rawRange: IRange, eol: model.EndOfLinePreference = model.EndOfLinePreference.TextDefined): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);\n\t}\n\n\tpublic getLineCount(): number {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getLineCount();\n\t}\n\n\tpublic getLineContent(lineNumber: number): string {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineContent(lineNumber);\n\t}\n\n\tpublic getLineLength(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\n\t\treturn this._buffer.getLineLength(lineNumber);\n\t}\n\n\tpublic getLinesContent(): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (this.isTooLargeForHeapOperation()) {\n\t\t\tthrow new BugIndicatingError('Operation would exceed heap memory limits');\n\t\t}\n\n\t\treturn this._buffer.getLinesContent();\n\t}\n\n\tpublic getEOL(): string {\n\t\tthis._assertNotDisposed();\n\t\treturn this._buffer.getEOL();\n\t}\n\n\tpublic getEndOfLineSequence(): model.EndOfLineSequence {\n\t\tthis._assertNotDisposed();\n\t\treturn (\n\t\t\tthis._buffer.getEOL() === '\\n'\n\t\t\t\t? model.EndOfLineSequence.LF\n\t\t\t\t: model.EndOfLineSequence.CRLF\n\t\t);\n\t}\n\n\tpublic getLineMinColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\treturn 1;\n\t}\n\n\tpublic getLineMaxColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLength(lineNumber) + 1;\n\t}\n\n\tpublic getLineFirstNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);\n\t}\n\n\tpublic getLineLastNonWhitespaceColumn(lineNumber: number): number {\n\t\tthis._assertNotDisposed();\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\tthrow new BugIndicatingError('Illegal value for lineNumber');\n\t\t}\n\t\treturn this._buffer.getLineLastNonWhitespaceColumn(lineNumber);\n\t}\n\n\t/**\n\t * Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.\n\t * Will try to not allocate if possible.\n\t */\n\tpublic _validateRangeRelaxedNoAllocations(range: IRange): Range {\n\t\tconst linesCount = this._buffer.getLineCount();\n\n\t\tconst initialStartLineNumber = range.startLineNumber;\n\t\tconst initialStartColumn = range.startColumn;\n\t\tlet startLineNumber = Math.floor((typeof initialStartLineNumber === 'number' && !isNaN(initialStartLineNumber)) ? initialStartLineNumber : 1);\n\t\tlet startColumn = Math.floor((typeof initialStartColumn === 'number' && !isNaN(initialStartColumn)) ? initialStartColumn : 1);\n\n\t\tif (startLineNumber < 1) {\n\t\t\tstartLineNumber = 1;\n\t\t\tstartColumn = 1;\n\t\t} else if (startLineNumber > linesCount) {\n\t\t\tstartLineNumber = linesCount;\n\t\t\tstartColumn = this.getLineMaxColumn(startLineNumber);\n\t\t} else {\n\t\t\tif (startColumn <= 1) {\n\t\t\t\tstartColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(startLineNumber);\n\t\t\t\tif (startColumn >= maxColumn) {\n\t\t\t\t\tstartColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst initialEndLineNumber = range.endLineNumber;\n\t\tconst initialEndColumn = range.endColumn;\n\t\tlet endLineNumber = Math.floor((typeof initialEndLineNumber === 'number' && !isNaN(initialEndLineNumber)) ? initialEndLineNumber : 1);\n\t\tlet endColumn = Math.floor((typeof initialEndColumn === 'number' && !isNaN(initialEndColumn)) ? initialEndColumn : 1);\n\n\t\tif (endLineNumber < 1) {\n\t\t\tendLineNumber = 1;\n\t\t\tendColumn = 1;\n\t\t} else if (endLineNumber > linesCount) {\n\t\t\tendLineNumber = linesCount;\n\t\t\tendColumn = this.getLineMaxColumn(endLineNumber);\n\t\t} else {\n\t\t\tif (endColumn <= 1) {\n\t\t\t\tendColumn = 1;\n\t\t\t} else {\n\t\t\t\tconst maxColumn = this.getLineMaxColumn(endLineNumber);\n\t\t\t\tif (endColumn >= maxColumn) {\n\t\t\t\t\tendColumn = maxColumn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tinitialStartLineNumber === startLineNumber\n\t\t\t&& initialStartColumn === startColumn\n\t\t\t&& initialEndLineNumber === endLineNumber\n\t\t\t&& initialEndColumn === endColumn\n\t\t\t&& range instanceof Range\n\t\t\t&& !(range instanceof Selection)\n\t\t) {\n\t\t\treturn range;\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tprivate _isValidPosition(lineNumber: number, column: number, validationType: StringOffsetValidationType): boolean {\n\t\tif (typeof lineNumber !== 'number' || typeof column !== 'number') {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isNaN(lineNumber) || isNaN(column)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (lineNumber < 1 || column < 1) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ((lineNumber | 0) !== lineNumber || (column | 0) !== column) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst lineCount = this._buffer.getLineCount();\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (column === 1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column > maxColumn) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate _validatePosition(_lineNumber: number, _column: number, validationType: StringOffsetValidationType): Position {\n\t\tconst lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1);\n\t\tconst column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1);\n\t\tconst lineCount = this._buffer.getLineCount();\n\n\t\tif (lineNumber < 1) {\n\t\t\treturn new Position(1, 1);\n\t\t}\n\n\t\tif (lineNumber > lineCount) {\n\t\t\treturn new Position(lineCount, this.getLineMaxColumn(lineCount));\n\t\t}\n\n\t\tif (column <= 1) {\n\t\t\treturn new Position(lineNumber, 1);\n\t\t}\n\n\t\tconst maxColumn = this.getLineMaxColumn(lineNumber);\n\t\tif (column >= maxColumn) {\n\t\t\treturn new Position(lineNumber, maxColumn);\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\t// If the position would end up in the middle of a high-low surrogate pair,\n\t\t\t// we move it to before the pair\n\t\t\t// !!At this point, column > 1\n\t\t\tconst charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);\n\t\t\tif (strings.isHighSurrogate(charCodeBefore)) {\n\t\t\t\treturn new Position(lineNumber, column - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tpublic validatePosition(position: IPosition): Position {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif (position instanceof Position) {\n\t\t\tif (this._isValidPosition(position.lineNumber, position.column, validationType)) {\n\t\t\t\treturn position;\n\t\t\t}\n\t\t}\n\n\t\treturn this._validatePosition(position.lineNumber, position.column, validationType);\n\t}\n\n\tpublic isValidRange(range: Range): boolean {\n\t\treturn this._isValidRange(range, StringOffsetValidationType.SurrogatePairs);\n\t}\n\n\tprivate _isValidRange(range: Range, validationType: StringOffsetValidationType): boolean {\n\t\tconst startLineNumber = range.startLineNumber;\n\t\tconst startColumn = range.startColumn;\n\t\tconst endLineNumber = range.endLineNumber;\n\t\tconst endColumn = range.endColumn;\n\n\t\tif (!this._isValidPosition(startLineNumber, startColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this._isValidPosition(endLineNumber, endColumn, StringOffsetValidationType.Relaxed)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic validateRange(_range: IRange): Range {\n\t\tconst validationType = StringOffsetValidationType.SurrogatePairs;\n\t\tthis._assertNotDisposed();\n\n\t\t// Avoid object allocation and cover most likely case\n\t\tif ((_range instanceof Range) && !(_range instanceof Selection)) {\n\t\t\tif (this._isValidRange(_range, validationType)) {\n\t\t\t\treturn _range;\n\t\t\t}\n\t\t}\n\n\t\tconst start = this._validatePosition(_range.startLineNumber, _range.startColumn, StringOffsetValidationType.Relaxed);\n\t\tconst end = this._validatePosition(_range.endLineNumber, _range.endColumn, StringOffsetValidationType.Relaxed);\n\n\t\tconst startLineNumber = start.lineNumber;\n\t\tconst startColumn = start.column;\n\t\tconst endLineNumber = end.lineNumber;\n\t\tconst endColumn = end.column;\n\n\t\tif (validationType === StringOffsetValidationType.SurrogatePairs) {\n\t\t\tconst charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);\n\t\t\tconst charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);\n\n\t\t\tconst startInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeStart);\n\t\t\tconst endInsideSurrogatePair = strings.isHighSurrogate(charCodeBeforeEnd);\n\n\t\t\tif (!startInsideSurrogatePair && !endInsideSurrogatePair) {\n\t\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\tif (startLineNumber === endLineNumber && startColumn === endColumn) {\n\t\t\t\t// do not expand a collapsed range, simply move it to a valid location\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair && endInsideSurrogatePair) {\n\t\t\t\t// expand range at both ends\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);\n\t\t\t}\n\n\t\t\tif (startInsideSurrogatePair) {\n\t\t\t\t// only expand range at the start\n\t\t\t\treturn new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn);\n\t\t\t}\n\n\t\t\t// only expand range at the end\n\t\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1);\n\t\t}\n\n\t\treturn new Range(startLineNumber, startColumn, endLineNumber, endColumn);\n\t}\n\n\tpublic modifyPosition(rawPosition: IPosition, offset: number): Position {\n\t\tthis._assertNotDisposed();\n\t\tconst candidate = this.getOffsetAt(rawPosition) + offset;\n\t\treturn this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));\n\t}\n\n\tpublic getFullModelRange(): Range {\n\t\tthis._assertNotDisposed();\n\t\tconst lineCount = this.getLineCount();\n\t\treturn new Range(1, 1, lineCount, this.getLineMaxColumn(lineCount));\n\t}\n\n\tprivate findMatchesLineByLine(searchRange: Range, searchData: model.SearchData, captureMatches: boolean, limitResultCount: number): model.FindMatch[] {\n\t\treturn this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t}\n\n\tpublic findMatches(searchString: string, rawSearchScope: boolean | IRange | IRange[] | null, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount: number = LIMIT_FIND_COUNT): model.FindMatch[] {\n\t\tthis._assertNotDisposed();\n\n\t\tlet searchRanges: Range[] | null = null;\n\n\t\tif (rawSearchScope !== null && typeof rawSearchScope !== 'boolean') {\n\t\t\tif (!Array.isArray(rawSearchScope)) {\n\t\t\t\trawSearchScope = [rawSearchScope];\n\t\t\t}\n\n\t\t\tif (rawSearchScope.every((searchScope: IRange) => Range.isIRange(searchScope))) {\n\t\t\t\tsearchRanges = rawSearchScope.map((searchScope: IRange) => this.validateRange(searchScope));\n\t\t\t}\n\t\t}\n\n\t\tif (searchRanges === null) {\n\t\t\tsearchRanges = [this.getFullModelRange()];\n\t\t}\n\n\t\tsearchRanges = searchRanges.sort((d1, d2) => d1.startLineNumber - d2.startLineNumber || d1.startColumn - d2.startColumn);\n\n\t\tconst uniqueSearchRanges: Range[] = [];\n\t\tuniqueSearchRanges.push(searchRanges.reduce((prev, curr) => {\n\t\t\tif (Range.areIntersecting(prev, curr)) {\n\t\t\t\treturn prev.plusRange(curr);\n\t\t\t}\n\n\t\t\tuniqueSearchRanges.push(prev);\n\t\t\treturn curr;\n\t\t}));\n\n\t\tlet matchMapper: (value: Range, index: number, array: Range[]) => model.FindMatch[];\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\t// not regex, not multi line\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\n\t\t\tif (!searchData) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tmatchMapper = (searchRange: Range) => this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);\n\t\t} else {\n\t\t\tmatchMapper = (searchRange: Range) => TextModelSearch.findMatches(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchRange, captureMatches, limitResultCount);\n\t\t}\n\n\t\treturn uniqueSearchRanges.map(matchMapper).reduce((arr, matches: model.FindMatch[]) => arr.concat(matches), []);\n\t}\n\n\tpublic findNextMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\n\t\tif (!isRegex && searchString.indexOf('\\n') < 0) {\n\t\t\tconst searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators);\n\t\t\tconst searchData = searchParams.parseSearchRequest();\n\t\t\tif (!searchData) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst lineCount = this.getLineCount();\n\t\t\tlet searchRange = new Range(searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));\n\t\t\tlet ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\t\t\tTextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\tsearchRange = new Range(1, 1, searchStart.lineNumber, this.getLineMaxColumn(searchStart.lineNumber));\n\t\t\tret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);\n\n\t\t\tif (ret.length > 0) {\n\t\t\t\treturn ret[0];\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\tpublic findPreviousMatch(searchString: string, rawSearchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string, captureMatches: boolean): model.FindMatch | null {\n\t\tthis._assertNotDisposed();\n\t\tconst searchStart = this.validatePosition(rawSearchStart);\n\t\treturn TextModelSearch.findPreviousMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);\n\t}\n\n\t//#endregion\n\n\t//#region Editing\n\n\tpublic pushStackElement(): void {\n\t\tthis._commandManager.pushStackElement();\n\t}\n\n\tpublic popStackElement(): void {\n\t\tthis._commandManager.popStackElement();\n\t}\n\n\tpublic pushEOL(eol: model.EndOfLineSequence): void {\n\t\tconst currentEOL = (this.getEOL() === '\\n' ? model.EndOfLineSequence.LF : model.EndOfLineSequence.CRLF);\n\t\tif (currentEOL === eol) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t\t}\n\t\t\tthis._commandManager.pushEOL(eol);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _validateEditOperation(rawOperation: model.IIdentifiedSingleEditOperation): model.ValidAnnotatedEditOperation {\n\t\tif (rawOperation instanceof model.ValidAnnotatedEditOperation) {\n\t\t\treturn rawOperation;\n\t\t}\n\n\t\tconst validatedRange = this.validateRange(rawOperation.range);\n\n\t\t// Normalize edit when replacement text ends with lone CR\n\t\t// and the range ends right before a CRLF in the buffer.\n\t\t// We strip the trailing CR from the replacement text.\n\t\tlet opText = rawOperation.text;\n\t\tif (opText) {\n\t\t\tconst endsWithLoneCR = (\n\t\t\t\topText.length > 0 && opText.charCodeAt(opText.length - 1) === CharCode.CarriageReturn\n\t\t\t);\n\t\t\tconst removeTrailingCR = (\n\t\t\t\tthis.getEOL() === '\\r\\n' && endsWithLoneCR && validatedRange.endColumn === this.getLineMaxColumn(validatedRange.endLineNumber)\n\t\t\t);\n\t\t\tif (removeTrailingCR) {\n\t\t\t\topText = opText.substring(0, opText.length - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn new model.ValidAnnotatedEditOperation(\n\t\t\trawOperation.identifier || null,\n\t\t\tvalidatedRange,\n\t\t\topText,\n\t\t\trawOperation.forceMoveMarkers || false,\n\t\t\trawOperation.isAutoWhitespaceEdit || false,\n\t\t\trawOperation._isTracked || false\n\t\t);\n\t}\n\n\tprivate _validateEditOperations(rawOperations: readonly model.IIdentifiedSingleEditOperation[]): model.ValidAnnotatedEditOperation[] {\n\t\tconst result: model.ValidAnnotatedEditOperation[] = [];\n\t\tfor (let i = 0, len = rawOperations.length; i < len; i++) {\n\t\t\tresult[i] = this._validateEditOperation(rawOperations[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic edit(edit: TextEdit, options?: { reason?: TextModelEditSource }): void {\n\t\tthis.pushEditOperations(null, edit.replacements.map(r => ({ range: r.range, text: r.text })), null);\n\t}\n\n\tpublic pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.IIdentifiedSingleEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\treturn this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer, group, reason);\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _pushEditOperations(beforeCursorState: Selection[] | null, editOperations: model.ValidAnnotatedEditOperation[], cursorStateComputer: model.ICursorStateComputer | null, group?: UndoRedoGroup, reason?: TextModelEditSource): Selection[] | null {\n\t\tif (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {\n\t\t\t// Go through each saved line number and insert a trim whitespace edit\n\t\t\t// if it is safe to do so (no conflicts with other edits).\n\n\t\t\tconst incomingEdits = editOperations.map((op) => {\n\t\t\t\treturn {\n\t\t\t\t\trange: this.validateRange(op.range),\n\t\t\t\t\ttext: op.text\n\t\t\t\t};\n\t\t\t});\n\n\t\t\t// Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor\n\t\t\t// We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace\n\t\t\tlet editsAreNearCursors = true;\n\t\t\tif (beforeCursorState) {\n\t\t\t\tfor (let i = 0, len = beforeCursorState.length; i < len; i++) {\n\t\t\t\t\tconst sel = beforeCursorState[i];\n\t\t\t\t\tlet foundEditNearSel = false;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst selIsAbove = editRange.startLineNumber > sel.endLineNumber;\n\t\t\t\t\t\tconst selIsBelow = sel.startLineNumber > editRange.endLineNumber;\n\t\t\t\t\t\tif (!selIsAbove && !selIsBelow) {\n\t\t\t\t\t\t\tfoundEditNearSel = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!foundEditNearSel) {\n\t\t\t\t\t\teditsAreNearCursors = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (editsAreNearCursors) {\n\t\t\t\tfor (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {\n\t\t\t\t\tconst trimLineNumber = this._trimAutoWhitespaceLines[i];\n\t\t\t\t\tconst maxLineColumn = this.getLineMaxColumn(trimLineNumber);\n\n\t\t\t\t\tlet allowTrimLine = true;\n\t\t\t\t\tfor (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {\n\t\t\t\t\t\tconst editRange = incomingEdits[j].range;\n\t\t\t\t\t\tconst editText = incomingEdits[j].text;\n\n\t\t\t\t\t\tif (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {\n\t\t\t\t\t\t\t// `trimLine` is completely outside this edit\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// At this point:\n\t\t\t\t\t\t// editRange.startLineNumber <= trimLine <= editRange.endLineNumber\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) after `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttrimLineNumber === editRange.startLineNumber && editRange.startColumn === 1\n\t\t\t\t\t\t\t&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === '\\n'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// This edit inserts a new line (and maybe other text) before `trimLine`\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Looks like we can't trim this line as it would interfere with an incoming edit\n\t\t\t\t\t\tallowTrimLine = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (allowTrimLine) {\n\t\t\t\t\t\tconst trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn);\n\t\t\t\t\t\teditOperations.push(new model.ValidAnnotatedEditOperation(null, trimRange, null, false, false, false));\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._trimAutoWhitespaceLines = null;\n\t\t}\n\t\tif (this._initialUndoRedoSnapshot === null) {\n\t\t\tthis._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);\n\t\t}\n\t\treturn this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group, reason);\n\t}\n\n\t_applyUndo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.newPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.newEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.oldText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\t_applyRedo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\tconst edits = changes.map<ISingleEditOperation>((change) => {\n\t\t\tconst rangeStart = this.getPositionAt(change.oldPosition);\n\t\t\tconst rangeEnd = this.getPositionAt(change.oldEnd);\n\t\t\treturn {\n\t\t\t\trange: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),\n\t\t\t\ttext: change.newText\n\t\t\t};\n\t\t});\n\t\tthis._applyUndoRedoEdits(edits, eol, false, true, resultingAlternativeVersionId, resultingSelection);\n\t}\n\n\tprivate _applyUndoRedoEdits(edits: ISingleEditOperation[], eol: model.EndOfLineSequence, isUndoing: boolean, isRedoing: boolean, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tthis._isUndoing = isUndoing;\n\t\t\tthis._isRedoing = isRedoing;\n\t\t\tthis.applyEdits(edits, false);\n\t\t\tthis.setEOL(eol);\n\t\t\tthis._overwriteAlternativeVersionId(resultingAlternativeVersionId);\n\t\t} finally {\n\t\t\tthis._isUndoing = false;\n\t\t\tthis._isRedoing = false;\n\t\t\tthis._eventEmitter.endDeferredEmit(resultingSelection);\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[]): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false): void;\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true): model.IValidEditOperation[];\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: false, reason: TextModelEditSource): void;\n\t/** @internal */\n\tpublic applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits: true, reason: TextModelEditSource): model.IValidEditOperation[];\n\tpublic applyEdits(rawOperations: readonly model.IIdentifiedSingleEditOperation[], computeUndoEdits?: boolean, reason?: TextModelEditSource): void | model.IValidEditOperation[] {\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\tthis._eventEmitter.beginDeferredEmit();\n\t\t\tconst operations = this._validateEditOperations(rawOperations);\n\n\t\t\treturn this._doApplyEdits(operations, computeUndoEdits ?? false, reason ?? EditSources.applyEdits());\n\t\t} finally {\n\t\t\tthis._eventEmitter.endDeferredEmit();\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _doApplyEdits(rawOperations: model.ValidAnnotatedEditOperation[], computeUndoEdits: boolean, reason: TextModelEditSource): void | model.IValidEditOperation[] {\n\n\t\tconst oldLineCount = this._buffer.getLineCount();\n\t\tconst result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace, computeUndoEdits);\n\t\tconst newLineCount = this._buffer.getLineCount();\n\n\t\tconst contentChanges = result.changes;\n\t\tthis._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;\n\n\t\tif (contentChanges.length !== 0) {\n\t\t\t// We do a first pass to update decorations\n\t\t\t// because we want to read decorations in the second pass\n\t\t\t// where we will emit content change events\n\t\t\t// and we want to read the final decorations\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tthis._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);\n\t\t\t}\n\n\t\t\tconst rawContentChanges: ModelRawChange[] = [];\n\n\t\t\tthis._increaseVersionId();\n\n\t\t\tlet lineCount = oldLineCount;\n\t\t\tfor (let i = 0, len = contentChanges.length; i < len; i++) {\n\t\t\t\tconst change = contentChanges[i];\n\t\t\t\tconst [eolCount] = countEOL(change.text);\n\t\t\t\tthis._onDidChangeDecorations.fire();\n\n\t\t\t\tconst startLineNumber = change.range.startLineNumber;\n\t\t\t\tconst endLineNumber = change.range.endLineNumber;\n\n\t\t\t\tconst deletingLinesCnt = endLineNumber - startLineNumber;\n\t\t\t\tconst insertingLinesCnt = eolCount;\n\t\t\t\tconst editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);\n\n\t\t\t\tconst changeLineCountDelta = (insertingLinesCnt - deletingLinesCnt);\n\n\t\t\t\tconst currentEditStartLineNumber = newLineCount - lineCount - changeLineCountDelta + startLineNumber;\n\t\t\t\tconst firstEditLineNumber = currentEditStartLineNumber;\n\t\t\t\tconst lastInsertedLineNumber = currentEditStartLineNumber + insertingLinesCnt;\n\n\t\t\t\tconst decorationsWithInjectedTextInEditedRange = this._decorationsTree.getInjectedTextInInterval(\n\t\t\t\t\tthis,\n\t\t\t\t\tthis.getOffsetAt(new Position(firstEditLineNumber, 1)),\n\t\t\t\t\tthis.getOffsetAt(new Position(lastInsertedLineNumber, this.getLineMaxColumn(lastInsertedLineNumber))),\n\t\t\t\t\t0\n\t\t\t\t);\n\n\n\t\t\t\tconst injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);\n\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\n\t\t\t\tfor (let j = editingLinesCnt; j >= 0; j--) {\n\t\t\t\t\tconst editLineNumber = startLineNumber + j;\n\t\t\t\t\tconst currentEditLineNumber = currentEditStartLineNumber + j;\n\n\t\t\t\t\tinjectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber > currentEditLineNumber);\n\t\t\t\t\tconst decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile(r => r.lineNumber === currentEditLineNumber);\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLineChanged(\n\t\t\t\t\t\t\teditLineNumber,\n\t\t\t\t\t\t\tthis.getLineContent(currentEditLineNumber),\n\t\t\t\t\t\t\tdecorationsInCurrentLine\n\t\t\t\t\t\t));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < deletingLinesCnt) {\n\t\t\t\t\t// Must delete some lines\n\t\t\t\t\tconst spliceStartLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\trawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));\n\t\t\t\t}\n\n\t\t\t\tif (editingLinesCnt < insertingLinesCnt) {\n\t\t\t\t\tconst injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);\n\t\t\t\t\t// Must insert some lines\n\t\t\t\t\tconst spliceLineNumber = startLineNumber + editingLinesCnt;\n\t\t\t\t\tconst cnt = insertingLinesCnt - editingLinesCnt;\n\t\t\t\t\tconst fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;\n\t\t\t\t\tconst injectedTexts: (LineInjectedText[] | null)[] = [];\n\t\t\t\t\tconst newLines: string[] = [];\n\t\t\t\t\tfor (let i = 0; i < cnt; i++) {\n\t\t\t\t\t\tconst lineNumber = fromLineNumber + i;\n\t\t\t\t\t\tnewLines[i] = this.getLineContent(lineNumber);\n\n\t\t\t\t\t\tinjectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber < lineNumber);\n\t\t\t\t\t\tinjectedTexts[i] = injectedTextInEditedRangeQueue.takeWhile(r => r.lineNumber === lineNumber);\n\t\t\t\t\t}\n\n\t\t\t\t\trawContentChanges.push(\n\t\t\t\t\t\tnew ModelRawLinesInserted(\n\t\t\t\t\t\t\tspliceLineNumber + 1,\n\t\t\t\t\t\t\tstartLineNumber + insertingLinesCnt,\n\t\t\t\t\t\t\tnewLines,\n\t\t\t\t\t\t\tinjectedTexts\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tlineCount += changeLineCountDelta;\n\t\t\t}\n\n\t\t\tthis._emitContentChangedEvent(\n\t\t\t\tnew ModelRawContentChangedEvent(\n\t\t\t\t\trawContentChanges,\n\t\t\t\t\tthis.getVersionId(),\n\t\t\t\t\tthis._isUndoing,\n\t\t\t\t\tthis._isRedoing\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tchanges: contentChanges,\n\t\t\t\t\teol: this._buffer.getEOL(),\n\t\t\t\t\tisEolChange: false,\n\t\t\t\t\tversionId: this.getVersionId(),\n\t\t\t\t\tisUndoing: this._isUndoing,\n\t\t\t\t\tisRedoing: this._isRedoing,\n\t\t\t\t\tisFlush: false,\n\t\t\t\t\tdetailedReasons: [reason],\n\t\t\t\t\tdetailedReasonsChangeLengths: [contentChanges.length],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn (result.reverseEdits === null ? undefined : result.reverseEdits);\n\t}\n\n\tpublic undo(): void | Promise<void> {\n\t\treturn this._undoRedoService.undo(this.uri);\n\t}\n\n\tpublic canUndo(): boolean {\n\t\treturn this._undoRedoService.canUndo(this.uri);\n\t}\n\n\tpublic redo(): void | Promise<void> {\n\t\treturn this._undoRedoService.redo(this.uri);\n\t}\n\n\tpublic canRedo(): boolean {\n\t\treturn this._undoRedoService.canRedo(this.uri);\n\t}\n\n\t//#endregion\n\n\t//#region Decorations\n\n\tprivate handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines: Set<number> | null, affectedLineHeights: Set<LineHeightChangingDecoration> | null, affectedFontLines: Set<LineFontChangingDecoration> | null): void {\n\t\t// This is called before the decoration changed event is fired.\n\n\t\tif (affectedInjectedTextLines && affectedInjectedTextLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedInjectedTextLines);\n\t\t\tconst lineChangeEvents = affectedLines.map(lineNumber => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));\n\t\t\tthis._onDidChangeInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));\n\t\t}\n\t\tthis._fireOnDidChangeLineHeight(affectedLineHeights);\n\t\tthis._fireOnDidChangeFont(affectedFontLines);\n\t}\n\n\tprivate _fireOnDidChangeLineHeight(affectedLineHeights: Set<LineHeightChangingDecoration> | null): void {\n\t\tif (affectedLineHeights && affectedLineHeights.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedLineHeights);\n\t\t\tconst lineHeightChangeEvent = affectedLines.map(specialLineHeightChange => new ModelLineHeightChanged(specialLineHeightChange.ownerId, specialLineHeightChange.decorationId, specialLineHeightChange.lineNumber, specialLineHeightChange.lineHeight));\n\t\t\tthis._onDidChangeLineHeight.fire(new ModelLineHeightChangedEvent(lineHeightChangeEvent));\n\t\t}\n\t}\n\n\tprivate _fireOnDidChangeFont(affectedFontLines: Set<LineFontChangingDecoration> | null): void {\n\t\tif (affectedFontLines && affectedFontLines.size > 0) {\n\t\t\tconst affectedLines = Array.from(affectedFontLines);\n\t\t\tconst fontChangeEvent = affectedLines.map(fontChange => new ModelFontChanged(fontChange.ownerId, fontChange.lineNumber));\n\t\t\tthis._onDidChangeFont.fire(new ModelFontChangedEvent(fontChangeEvent));\n\t\t}\n\t}\n\n\tpublic changeDecorations<T>(callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T, ownerId: number = 0): T | null {\n\t\tthis._assertNotDisposed();\n\n\t\ttry {\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._changeDecorations(ownerId, callback);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\tprivate _changeDecorations<T>(ownerId: number, callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T): T | null {\n\t\tconst changeAccessor: model.IModelDecorationsChangeAccessor = {\n\t\t\taddDecoration: (range: IRange, options: model.IModelDecorationOptions): string => {\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0];\n\t\t\t},\n\t\t\tchangeDecoration: (id: string, newRange: IRange): void => {\n\t\t\t\tthis._changeDecorationImpl(ownerId, id, newRange);\n\t\t\t},\n\t\t\tchangeDecorationOptions: (id: string, options: model.IModelDecorationOptions) => {\n\t\t\t\tthis._changeDecorationOptionsImpl(ownerId, id, _normalizeOptions(options));\n\t\t\t},\n\t\t\tremoveDecoration: (id: string): void => {\n\t\t\t\tthis._deltaDecorationsImpl(ownerId, [id], []);\n\t\t\t},\n\t\t\tdeltaDecorations: (oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[]): string[] => {\n\t\t\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t\t\t// nothing to do\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t\t}\n\t\t};\n\t\tlet result: T | null = null;\n\t\ttry {\n\t\t\tresult = callback(changeAccessor);\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t\t// Invalidate change accessor\n\t\tchangeAccessor.addDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecoration = invalidFunc;\n\t\tchangeAccessor.changeDecorationOptions = invalidFunc;\n\t\tchangeAccessor.removeDecoration = invalidFunc;\n\t\tchangeAccessor.deltaDecorations = invalidFunc;\n\t\treturn result;\n\t}\n\n\tpublic deltaDecorations(oldDecorations: string[], newDecorations: model.IModelDeltaDecoration[], ownerId: number = 0): string[] {\n\t\tthis._assertNotDisposed();\n\t\tif (!oldDecorations) {\n\t\t\toldDecorations = [];\n\t\t}\n\t\tif (oldDecorations.length === 0 && newDecorations.length === 0) {\n\t\t\t// nothing to do\n\t\t\treturn [];\n\t\t}\n\n\t\ttry {\n\t\t\tthis._deltaDecorationCallCnt++;\n\t\t\tif (this._deltaDecorationCallCnt > 1) {\n\t\t\t\tconsole.warn(`Invoking deltaDecorations recursively could lead to leaking decorations.`);\n\t\t\t\tonUnexpectedError(new Error(`Invoking deltaDecorations recursively could lead to leaking decorations.`));\n\t\t\t}\n\t\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\t\treturn this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t\tthis._deltaDecorationCallCnt--;\n\t\t}\n\t}\n\n\t_getTrackedRange(id: string): Range | null {\n\t\treturn this.getDecorationRange(id);\n\t}\n\n\t_setTrackedRange(id: string | null, newRange: null, newStickiness: model.TrackedRangeStickiness): null;\n\t_setTrackedRange(id: string | null, newRange: Range, newStickiness: model.TrackedRangeStickiness): string;\n\t_setTrackedRange(id: string | null, newRange: Range | null, newStickiness: model.TrackedRangeStickiness): string | null {\n\t\tconst node = (id ? this._decorations[id] : null);\n\n\t\tif (!node) {\n\t\t\tif (!newRange) {\n\t\t\t\t// node doesn't exist, the request is to delete => nothing to do\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// node doesn't exist, the request is to set => add the tracked range\n\t\t\treturn this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }], true)[0];\n\t\t}\n\n\t\tif (!newRange) {\n\t\t\t// node exists, the request is to delete => delete node\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t\treturn null;\n\t\t}\n\n\t\t// node exists, the request is to set => change the tracked range and its options\n\t\tconst range = this._validateRangeRelaxedNoAllocations(newRange);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tnode.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);\n\t\tthis._decorationsTree.insert(node);\n\t\treturn node.id;\n\t}\n\n\tpublic removeAllDecorationsWithOwnerId(ownerId: number): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tconst nodes = this._decorationsTree.collectNodesFromOwner(ownerId);\n\t\tfor (let i = 0, len = nodes.length; i < len; i++) {\n\t\t\tconst node = nodes[i];\n\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tdelete this._decorations[node.id];\n\t\t}\n\t}\n\n\tpublic getDecorationOptions(decorationId: string): model.IModelDecorationOptions | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn node.options;\n\t}\n\n\tpublic getDecorationRange(decorationId: string): Range | null {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this._decorationsTree.getNodeRange(this, node);\n\t}\n\n\tpublic getLineDecorations(lineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tif (lineNumber < 1 || lineNumber > this.getLineCount()) {\n\t\t\treturn [];\n\t\t}\n\t\treturn this.getLinesDecorations(lineNumber, lineNumber, ownerId, filterOutValidation, filterFontDecorations);\n\t}\n\n\tpublic getLinesDecorations(_startLineNumber: number, _endLineNumber: number, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst lineCount = this.getLineCount();\n\t\tconst startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));\n\t\tconst endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));\n\t\tconst endColumn = this.getLineMaxColumn(endLineNumber);\n\t\tconst range = new Range(startLineNumber, 1, endLineNumber, endColumn);\n\n\t\tconst decorations = this._getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation));\n\t\tpushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(range, ownerId, filterOutValidation));\n\t\treturn decorations;\n\t}\n\n\tpublic getDecorationsInRange(range: IRange, ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false, onlyMinimapDecorations: boolean = false, onlyMarginDecorations: boolean = false): model.IModelDecoration[] {\n\t\tconst validatedRange = this.validateRange(range);\n\n\t\tconst decorations = this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t\tpushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));\n\t\tpushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));\n\t\treturn decorations;\n\t}\n\n\tpublic getOverviewRulerDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, true, false);\n\t}\n\n\tpublic getInjectedTextDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllInjectedText(this, ownerId);\n\t}\n\n\tpublic getCustomLineHeightsDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAllCustomLineHeights(this, ownerId);\n\t}\n\n\tprivate _getInjectedTextInLine(lineNumber: number): LineInjectedText[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(lineNumber, 1);\n\t\tconst endOffset = startOffset + this._buffer.getLineLength(lineNumber);\n\n\t\tconst result = this._decorationsTree.getInjectedTextInInterval(this, startOffset, endOffset, 0);\n\t\treturn LineInjectedText.fromDecorations(result).filter(t => t.lineNumber === lineNumber);\n\t}\n\n\tpublic getFontDecorationsInRange(range: IRange, ownerId: number = 0): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\t\treturn this._decorationsTree.getFontDecorationsInInterval(this, startOffset, endOffset, ownerId);\n\t}\n\n\tpublic getAllDecorations(ownerId: number = 0, filterOutValidation: boolean = false, filterFontDecorations: boolean = false): model.IModelDecoration[] {\n\t\tlet result = this._decorationsTree.getAll(this, ownerId, filterOutValidation, filterFontDecorations, false, false);\n\t\tresult = result.concat(this._decorationProvider.getAllDecorations(ownerId, filterOutValidation));\n\t\tresult = result.concat(this._fontTokenDecorationsProvider.getAllDecorations(ownerId, filterOutValidation));\n\t\treturn result;\n\t}\n\n\tpublic getAllMarginDecorations(ownerId: number = 0): model.IModelDecoration[] {\n\t\treturn this._decorationsTree.getAll(this, ownerId, false, false, false, true);\n\t}\n\n\tprivate _getDecorationsInRange(filterRange: Range, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);\n\t\treturn this._decorationsTree.getAllInInterval(this, startOffset, endOffset, filterOwnerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);\n\t}\n\n\tpublic getRangeAt(start: number, end: number): Range {\n\t\treturn this._buffer.getRangeAt(start, end - start);\n\t}\n\n\tprivate _changeDecorationImpl(ownerId: number, decorationId: string, _range: IRange): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (node.options.after) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange!.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, oldRange!.startLineNumber, null);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tconst oldRange = this.getDecorationRange(decorationId);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, oldRange!.startLineNumber);\n\t\t}\n\n\t\tconst range = this._validateRangeRelaxedNoAllocations(_range);\n\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\tthis._decorationsTree.delete(node);\n\t\tnode.reset(this.getVersionId(), startOffset, endOffset, range);\n\t\tthis._decorationsTree.insert(node);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\n\t\tif (node.options.after) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t}\n\t\tif (node.options.before) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, range.startLineNumber, node.options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont) {\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t}\n\t}\n\n\tprivate _changeDecorationOptionsImpl(ownerId: number, decorationId: string, options: ModelDecorationOptions): void {\n\t\tconst node = this._decorations[decorationId];\n\t\tif (!node) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n\t\tconst nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);\n\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\n\t\tif (node.options.after || options.after) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t}\n\t\tif (node.options.before || options.before) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t}\n\t\tif (node.options.lineHeight !== null || options.lineHeight !== null) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, options.lineHeight);\n\t\t}\n\t\tif (node.options.affectsFont || options.affectsFont) {\n\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t}\n\n\t\tconst movedInOverviewRuler = nodeWasInOverviewRuler !== nodeIsInOverviewRuler;\n\t\tconst changedWhetherInjectedText = isOptionsInjectedText(options) !== isNodeInjectedText(node);\n\t\tif (movedInOverviewRuler || changedWhetherInjectedText) {\n\t\t\tthis._decorationsTree.delete(node);\n\t\t\tnode.setOptions(options);\n\t\t\tthis._decorationsTree.insert(node);\n\t\t} else {\n\t\t\tnode.setOptions(options);\n\t\t}\n\t}\n\n\tprivate _deltaDecorationsImpl(ownerId: number, oldDecorationsIds: string[], newDecorations: model.IModelDeltaDecoration[], suppressEvents: boolean = false): string[] {\n\t\tconst versionId = this.getVersionId();\n\n\t\tconst oldDecorationsLen = oldDecorationsIds.length;\n\t\tlet oldDecorationIndex = 0;\n\n\t\tconst newDecorationsLen = newDecorations.length;\n\t\tlet newDecorationIndex = 0;\n\n\t\tthis._onDidChangeDecorations.beginDeferredEmit();\n\t\ttry {\n\t\t\tconst result = new Array<string>(newDecorationsLen);\n\t\t\twhile (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {\n\n\t\t\t\tlet node: IntervalNode | null = null;\n\n\t\t\t\tif (oldDecorationIndex < oldDecorationsLen) {\n\t\t\t\t\t// (1) get ourselves an old node\n\t\t\t\t\tlet decorationId: string;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tdecorationId = oldDecorationsIds[oldDecorationIndex++];\n\t\t\t\t\t\tnode = this._decorations[decorationId];\n\t\t\t\t\t} while (!node && oldDecorationIndex < oldDecorationsLen);\n\n\t\t\t\t\t// (2) remove the node from the tree (if it exists)\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, decorationId, nodeRange.startLineNumber, null);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\t\tconst nodeRange = this._decorationsTree.getNodeRange(this, node);\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, decorationId, nodeRange.startLineNumber);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._decorationsTree.delete(node);\n\n\t\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(node.options);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newDecorationIndex < newDecorationsLen) {\n\t\t\t\t\t// (3) create a new node if necessary\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tconst internalDecorationId = (++this._lastDecorationId);\n\t\t\t\t\t\tconst decorationId = `${this._instanceId};${internalDecorationId}`;\n\t\t\t\t\t\tnode = new IntervalNode(decorationId, 0, 0);\n\t\t\t\t\t\tthis._decorations[decorationId] = node;\n\t\t\t\t\t}\n\n\t\t\t\t\t// (4) initialize node\n\t\t\t\t\tconst newDecoration = newDecorations[newDecorationIndex];\n\t\t\t\t\tconst range = this._validateRangeRelaxedNoAllocations(newDecoration.range);\n\t\t\t\t\tconst options = _normalizeOptions(newDecoration.options);\n\t\t\t\t\tconst startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);\n\t\t\t\t\tconst endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);\n\n\t\t\t\t\tnode.ownerId = ownerId;\n\t\t\t\t\tnode.reset(versionId, startOffset, endOffset, range);\n\t\t\t\t\tnode.setOptions(options);\n\n\t\t\t\t\tif (node.options.after) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.before) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.lineHeight !== null) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, node.id, range.startLineNumber, node.options.lineHeight);\n\t\t\t\t\t}\n\t\t\t\t\tif (node.options.affectsFont) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);\n\t\t\t\t\t}\n\t\t\t\t\tif (!suppressEvents) {\n\t\t\t\t\t\tthis._onDidChangeDecorations.checkAffectedAndFire(options);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._decorationsTree.insert(node);\n\n\t\t\t\t\tresult[newDecorationIndex] = node.id;\n\n\t\t\t\t\tnewDecorationIndex++;\n\t\t\t\t} else {\n\t\t\t\t\tif (node) {\n\t\t\t\t\t\tdelete this._decorations[node.id];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t} finally {\n\t\t\tthis._onDidChangeDecorations.endDeferredEmit();\n\t\t}\n\t}\n\n\t//#endregion\n\n\t//#region Tokenization\n\n\t// TODO move them to the tokenization part.\n\tpublic getLanguageId(): string {\n\t\treturn this.tokenization.getLanguageId();\n\t}\n\n\tpublic setLanguage(languageIdOrSelection: string | ILanguageSelection, source?: string): void {\n\t\tif (typeof languageIdOrSelection === 'string') {\n\t\t\tthis._languageSelectionListener.clear();\n\t\t\tthis._setLanguage(languageIdOrSelection, source);\n\t\t} else {\n\t\t\tthis._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId, source));\n\t\t\tthis._setLanguage(languageIdOrSelection.languageId, source);\n\t\t}\n\t}\n\n\tprivate _setLanguage(languageId: string, source?: string): void {\n\t\tthis.tokenization.setLanguageId(languageId, source);\n\t\tthis._languageService.requestRichLanguageFeatures(languageId);\n\t}\n\n\tpublic getLanguageIdAtPosition(lineNumber: number, column: number): string {\n\t\treturn this.tokenization.getLanguageIdAtPosition(lineNumber, column);\n\t}\n\n\tpublic getWordAtPosition(position: IPosition): IWordAtPosition | null {\n\t\treturn this._tokenizationTextModelPart.getWordAtPosition(position);\n\t}\n\n\tpublic getWordUntilPosition(position: IPosition): IWordAtPosition {\n\t\treturn this._tokenizationTextModelPart.getWordUntilPosition(position);\n\t}\n\n\t//#endregion\n\tnormalizePosition(position: Position, affinity: model.PositionAffinity): Position {\n\t\treturn position;\n\t}\n\n\t/**\n\t * Gets the column at which indentation stops at a given line.\n\t * @internal\n\t*/\n\tpublic getLineIndentColumn(lineNumber: number): number {\n\t\t// Columns start with 1.\n\t\treturn indentOfLine(this.getLineContent(lineNumber)) + 1;\n\t}\n\n\tpublic override toString(): string {\n\t\treturn `TextModel(${this.uri.toString()})`;\n\t}\n}\n\nexport function indentOfLine(line: string): number {\n\tlet indent = 0;\n\tfor (const c of line) {\n\t\tif (c === ' ' || c === '\\t') {\n\t\t\tindent++;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn indent;\n}\n\n//#region Decorations\n\nfunction isNodeInOverviewRuler(node: IntervalNode): boolean {\n\treturn (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);\n}\n\nfunction isOptionsInjectedText(options: ModelDecorationOptions): boolean {\n\treturn !!options.after || !!options.before;\n}\n\nfunction isNodeInjectedText(node: IntervalNode): boolean {\n\treturn !!node.options.after || !!node.options.before;\n}\n\nexport interface IDecorationsTreesHost {\n\tgetVersionId(): number;\n\tgetRangeAt(start: number, end: number): Range;\n}\n\nclass DecorationsTrees {\n\n\t/**\n\t * This tree holds decorations that do not show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree0: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that show up in the overview ruler.\n\t */\n\tprivate readonly _decorationsTree1: IntervalTree;\n\n\t/**\n\t * This tree holds decorations that contain injected text.\n\t */\n\tprivate readonly _injectedTextDecorationsTree: IntervalTree;\n\n\tconstructor() {\n\t\tthis._decorationsTree0 = new IntervalTree();\n\t\tthis._decorationsTree1 = new IntervalTree();\n\t\tthis._injectedTextDecorationsTree = new IntervalTree();\n\t}\n\n\tpublic ensureAllNodesHaveRanges(host: IDecorationsTreesHost): void {\n\t\tthis.getAll(host, 0, false, false, false, false);\n\t}\n\n\tprivate _ensureNodesHaveRanges(host: IDecorationsTreesHost, nodes: IntervalNode[]): model.IModelDecoration[] {\n\t\tfor (const node of nodes) {\n\t\t\tif (node.range === null) {\n\t\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t\t}\n\t\t}\n\t\treturn <model.IModelDecoration[]>nodes;\n\t}\n\n\tpublic getAllInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _intervalSearch(start: number, end: number, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\tconst r2 = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic getInjectedTextInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getFontDecorationsInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst decorations = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, decorations).filter((i) => i.options.affectsFont);\n\t}\n\n\tpublic getAllInjectedText(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._injectedTextDecorationsTree.search(filterOwnerId, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());\n\t}\n\n\tpublic getAllCustomLineHeights(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, false, false, false, versionId, false);\n\t\treturn this._ensureNodesHaveRanges(host, result).filter((i) => typeof i.options.lineHeight === 'number');\n\t}\n\n\tpublic getAll(host: IDecorationsTreesHost, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, onlyMarginDecorations: boolean): model.IModelDecoration[] {\n\t\tconst versionId = host.getVersionId();\n\t\tconst result = this._search(filterOwnerId, filterOutValidation, filterFontDecorations, overviewRulerOnly, versionId, onlyMarginDecorations);\n\t\treturn this._ensureNodesHaveRanges(host, result);\n\t}\n\n\tprivate _search(filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, overviewRulerOnly: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {\n\t\tif (overviewRulerOnly) {\n\t\t\treturn this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t} else {\n\t\t\tconst r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\tconst r2 = this._injectedTextDecorationsTree.search(filterOwnerId, filterOutValidation, filterFontDecorations, cachedVersionId, onlyMarginDecorations);\n\t\t\treturn r0.concat(r1).concat(r2);\n\t\t}\n\t}\n\n\tpublic collectNodesFromOwner(ownerId: number): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesFromOwner(ownerId);\n\t\tconst r1 = this._decorationsTree1.collectNodesFromOwner(ownerId);\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesFromOwner(ownerId);\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic collectNodesPostOrder(): IntervalNode[] {\n\t\tconst r0 = this._decorationsTree0.collectNodesPostOrder();\n\t\tconst r1 = this._decorationsTree1.collectNodesPostOrder();\n\t\tconst r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();\n\t\treturn r0.concat(r1).concat(r2);\n\t}\n\n\tpublic insert(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.insert(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.insert(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.insert(node);\n\t\t}\n\t}\n\n\tpublic delete(node: IntervalNode): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.delete(node);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.delete(node);\n\t\t} else {\n\t\t\tthis._decorationsTree0.delete(node);\n\t\t}\n\t}\n\n\tpublic getNodeRange(host: IDecorationsTreesHost, node: IntervalNode): Range {\n\t\tconst versionId = host.getVersionId();\n\t\tif (node.cachedVersionId !== versionId) {\n\t\t\tthis._resolveNode(node, versionId);\n\t\t}\n\t\tif (node.range === null) {\n\t\t\tnode.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);\n\t\t}\n\t\treturn node.range;\n\t}\n\n\tprivate _resolveNode(node: IntervalNode, cachedVersionId: number): void {\n\t\tif (isNodeInjectedText(node)) {\n\t\t\tthis._injectedTextDecorationsTree.resolveNode(node, cachedVersionId);\n\t\t} else if (isNodeInOverviewRuler(node)) {\n\t\t\tthis._decorationsTree1.resolveNode(node, cachedVersionId);\n\t\t} else {\n\t\t\tthis._decorationsTree0.resolveNode(node, cachedVersionId);\n\t\t}\n\t}\n\n\tpublic acceptReplace(offset: number, length: number, textLength: number, forceMoveMarkers: boolean): void {\n\t\tthis._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t\tthis._injectedTextDecorationsTree.acceptReplace(offset, length, textLength, forceMoveMarkers);\n\t}\n}\n\nfunction cleanClassName(className: string): string {\n\treturn className.replace(/[^a-z0-9\\-_]/gi, ' ');\n}\n\nclass DecorationOptions implements model.IDecorationOptions {\n\treadonly color: string | ThemeColor;\n\treadonly darkColor: string | ThemeColor;\n\n\tconstructor(options: model.IDecorationOptions) {\n\t\tthis.color = options.color || '';\n\t\tthis.darkColor = options.darkColor || '';\n\n\t}\n}\n\nexport class ModelDecorationOverviewRulerOptions extends DecorationOptions {\n\treadonly position: model.OverviewRulerLane;\n\tprivate _resolvedColor: string | null;\n\n\tconstructor(options: model.IModelDecorationOverviewRulerOptions) {\n\t\tsuper(options);\n\t\tthis._resolvedColor = null;\n\t\tthis.position = (typeof options.position === 'number' ? options.position : model.OverviewRulerLane.Center);\n\t}\n\n\tpublic getColor(theme: IColorTheme): string {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = null;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): string {\n\t\tif (typeof color === 'string') {\n\t\t\treturn color;\n\t\t}\n\t\tconst c = color ? theme.getColor(color.id) : null;\n\t\tif (!c) {\n\t\t\treturn '';\n\t\t}\n\t\treturn c.toString();\n\t}\n}\n\nexport class ModelDecorationGlyphMarginOptions {\n\treadonly position: model.GlyphMarginLane;\n\treadonly persistLane: boolean | undefined;\n\n\tconstructor(options: model.IModelDecorationGlyphMarginOptions | null | undefined) {\n\t\tthis.position = options?.position ?? model.GlyphMarginLane.Center;\n\t\tthis.persistLane = options?.persistLane;\n\t}\n}\n\nexport class ModelDecorationMinimapOptions extends DecorationOptions {\n\treadonly position: model.MinimapPosition;\n\treadonly sectionHeaderStyle: model.MinimapSectionHeaderStyle | null;\n\treadonly sectionHeaderText: string | null;\n\tprivate _resolvedColor: Color | undefined;\n\n\tconstructor(options: model.IModelDecorationMinimapOptions) {\n\t\tsuper(options);\n\t\tthis.position = options.position;\n\t\tthis.sectionHeaderStyle = options.sectionHeaderStyle ?? null;\n\t\tthis.sectionHeaderText = options.sectionHeaderText ?? null;\n\t}\n\n\tpublic getColor(theme: IColorTheme): Color | undefined {\n\t\tif (!this._resolvedColor) {\n\t\t\tif (isDark(theme.type) && this.darkColor) {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.darkColor, theme);\n\t\t\t} else {\n\t\t\t\tthis._resolvedColor = this._resolveColor(this.color, theme);\n\t\t\t}\n\t\t}\n\n\t\treturn this._resolvedColor;\n\t}\n\n\tpublic invalidateCachedColor(): void {\n\t\tthis._resolvedColor = undefined;\n\t}\n\n\tprivate _resolveColor(color: string | ThemeColor, theme: IColorTheme): Color | undefined {\n\t\tif (typeof color === 'string') {\n\t\t\treturn Color.fromHex(color);\n\t\t}\n\t\treturn theme.getColor(color.id);\n\t}\n}\n\nexport class ModelDecorationInjectedTextOptions implements model.InjectedTextOptions {\n\tpublic static from(options: model.InjectedTextOptions): ModelDecorationInjectedTextOptions {\n\t\tif (options instanceof ModelDecorationInjectedTextOptions) {\n\t\t\treturn options;\n\t\t}\n\t\treturn new ModelDecorationInjectedTextOptions(options);\n\t}\n\n\tpublic readonly content: string;\n\tpublic readonly tokens: TokenArray | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly attachedData: unknown | null;\n\treadonly cursorStops: model.InjectedTextCursorStops | null;\n\n\tprivate constructor(options: model.InjectedTextOptions) {\n\t\tthis.content = options.content || '';\n\t\tthis.tokens = options.tokens ?? null;\n\t\tthis.inlineClassName = options.inlineClassName || null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.attachedData = options.attachedData || null;\n\t\tthis.cursorStops = options.cursorStops || null;\n\t}\n}\n\nexport class ModelDecorationOptions implements model.IModelDecorationOptions {\n\n\tpublic static EMPTY: ModelDecorationOptions;\n\n\tpublic static register(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\n\tpublic static createDynamic(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\t\treturn new ModelDecorationOptions(options);\n\t}\n\treadonly description: string;\n\treadonly blockClassName: string | null;\n\treadonly blockIsAfterEnd: boolean | null;\n\treadonly blockDoesNotCollapse?: boolean | null;\n\treadonly blockPadding: [top: number, right: number, bottom: number, left: number] | null;\n\treadonly stickiness: model.TrackedRangeStickiness;\n\treadonly zIndex: number;\n\treadonly className: string | null;\n\treadonly shouldFillLineOnLineBreak: boolean | null;\n\treadonly hoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly glyphMarginHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly isWholeLine: boolean;\n\treadonly lineHeight: number | null;\n\treadonly fontSize: string | null;\n\treadonly showIfCollapsed: boolean;\n\treadonly collapseOnReplaceEdit: boolean;\n\treadonly overviewRuler: ModelDecorationOverviewRulerOptions | null;\n\treadonly minimap: ModelDecorationMinimapOptions | null;\n\treadonly glyphMargin?: model.IModelDecorationGlyphMarginOptions | null | undefined;\n\treadonly glyphMarginClassName: string | null;\n\treadonly linesDecorationsClassName: string | null;\n\treadonly lineNumberClassName: string | null;\n\treadonly lineNumberHoverMessage: IMarkdownString | IMarkdownString[] | null;\n\treadonly linesDecorationsTooltip: string | null;\n\treadonly firstLineDecorationClassName: string | null;\n\treadonly marginClassName: string | null;\n\treadonly inlineClassName: string | null;\n\treadonly inlineClassNameAffectsLetterSpacing: boolean;\n\treadonly beforeContentClassName: string | null;\n\treadonly afterContentClassName: string | null;\n\treadonly after: ModelDecorationInjectedTextOptions | null;\n\treadonly before: ModelDecorationInjectedTextOptions | null;\n\treadonly hideInCommentTokens: boolean | null;\n\treadonly hideInStringTokens: boolean | null;\n\treadonly affectsFont: boolean | null;\n\treadonly textDirection?: model.TextDirection | null | undefined;\n\n\tprivate constructor(options: model.IModelDecorationOptions) {\n\t\tthis.description = options.description;\n\t\tthis.blockClassName = options.blockClassName ? cleanClassName(options.blockClassName) : null;\n\t\tthis.blockDoesNotCollapse = options.blockDoesNotCollapse ?? null;\n\t\tthis.blockIsAfterEnd = options.blockIsAfterEnd ?? null;\n\t\tthis.blockPadding = options.blockPadding ?? null;\n\t\tthis.stickiness = options.stickiness || model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;\n\t\tthis.zIndex = options.zIndex || 0;\n\t\tthis.className = options.className ? cleanClassName(options.className) : null;\n\t\tthis.shouldFillLineOnLineBreak = options.shouldFillLineOnLineBreak ?? null;\n\t\tthis.hoverMessage = options.hoverMessage || null;\n\t\tthis.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;\n\t\tthis.lineNumberHoverMessage = options.lineNumberHoverMessage || null;\n\t\tthis.isWholeLine = options.isWholeLine || false;\n\t\tthis.lineHeight = options.lineHeight ? Math.min(options.lineHeight, LINE_HEIGHT_CEILING) : null;\n\t\tthis.fontSize = options.fontSize || null;\n\t\tthis.affectsFont = !!options.fontSize || !!options.fontFamily || !!options.fontWeight || !!options.fontStyle;\n\t\tthis.showIfCollapsed = options.showIfCollapsed || false;\n\t\tthis.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;\n\t\tthis.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;\n\t\tthis.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;\n\t\tthis.glyphMargin = options.glyphMarginClassName ? new ModelDecorationGlyphMarginOptions(options.glyphMargin) : null;\n\t\tthis.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;\n\t\tthis.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;\n\t\tthis.lineNumberClassName = options.lineNumberClassName ? cleanClassName(options.lineNumberClassName) : null;\n\t\tthis.linesDecorationsTooltip = options.linesDecorationsTooltip ? strings.htmlAttributeEncodeValue(options.linesDecorationsTooltip) : null;\n\t\tthis.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;\n\t\tthis.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;\n\t\tthis.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;\n\t\tthis.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;\n\t\tthis.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;\n\t\tthis.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;\n\t\tthis.after = options.after ? ModelDecorationInjectedTextOptions.from(options.after) : null;\n\t\tthis.before = options.before ? ModelDecorationInjectedTextOptions.from(options.before) : null;\n\t\tthis.hideInCommentTokens = options.hideInCommentTokens ?? false;\n\t\tthis.hideInStringTokens = options.hideInStringTokens ?? false;\n\t\tthis.textDirection = options.textDirection ?? null;\n\t}\n}\nModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: 'empty' });\n\n/**\n * The order carefully matches the values of the enum.\n */\nconst TRACKED_RANGE_OPTIONS = [\n\tModelDecorationOptions.register({ description: 'tracked-range-always-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-never-grows-when-typing-at-edges', stickiness: model.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-before', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore }),\n\tModelDecorationOptions.register({ description: 'tracked-range-grows-only-when-typing-after', stickiness: model.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter }),\n];\n\nfunction _normalizeOptions(options: model.IModelDecorationOptions): ModelDecorationOptions {\n\tif (options instanceof ModelDecorationOptions) {\n\t\treturn options;\n\t}\n\treturn ModelDecorationOptions.createDynamic(options);\n}\n\n\nclass DidChangeDecorationsEmitter extends Disposable {\n\n\tprivate readonly _actual: Emitter<IModelDecorationsChangedEvent> = this._register(new Emitter<IModelDecorationsChangedEvent>());\n\tpublic readonly event: Event<IModelDecorationsChangedEvent> = this._actual.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _shouldFireDeferred: boolean;\n\tprivate _affectsMinimap: boolean;\n\tprivate _affectsOverviewRuler: boolean;\n\tprivate _affectedInjectedTextLines: Set<number> | null = null;\n\tprivate _affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null = null;\n\tprivate _affectedFontLines: SetWithKey<LineFontChangingDecoration> | null = null;\n\tprivate _affectsGlyphMargin: boolean;\n\tprivate _affectsLineNumber: boolean;\n\n\tconstructor(private readonly handleBeforeFire: (affectedInjectedTextLines: Set<number> | null, affectedLineHeights: SetWithKey<LineHeightChangingDecoration> | null, affectedFontLines: SetWithKey<LineFontChangingDecoration> | null) => void) {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._affectsLineNumber = false;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._shouldFireDeferred) {\n\t\t\t\tthis.doFire();\n\t\t\t}\n\n\t\t\tthis._affectedInjectedTextLines?.clear();\n\t\t\tthis._affectedInjectedTextLines = null;\n\t\t\tthis._affectedLineHeights?.clear();\n\t\t\tthis._affectedLineHeights = null;\n\t\t\tthis._affectedFontLines?.clear();\n\t\t\tthis._affectedFontLines = null;\n\t\t}\n\t}\n\n\tpublic recordLineAffectedByInjectedText(lineNumber: number): void {\n\t\tif (!this._affectedInjectedTextLines) {\n\t\t\tthis._affectedInjectedTextLines = new Set();\n\t\t}\n\t\tthis._affectedInjectedTextLines.add(lineNumber);\n\t}\n\n\tpublic recordLineAffectedByLineHeightChange(ownerId: number, decorationId: string, lineNumber: number, lineHeight: number | null): void {\n\t\tif (!this._affectedLineHeights) {\n\t\t\tthis._affectedLineHeights = new SetWithKey<LineHeightChangingDecoration>([], LineHeightChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedLineHeights.add(new LineHeightChangingDecoration(ownerId, decorationId, lineNumber, lineHeight));\n\t}\n\n\tpublic recordLineAffectedByFontChange(ownerId: number, decorationId: string, lineNumber: number): void {\n\t\tif (!this._affectedFontLines) {\n\t\t\tthis._affectedFontLines = new SetWithKey<LineFontChangingDecoration>([], LineFontChangingDecoration.toKey);\n\t\t}\n\t\tthis._affectedFontLines.add(new LineFontChangingDecoration(ownerId, decorationId, lineNumber));\n\t}\n\n\tpublic checkAffectedAndFire(options: ModelDecorationOptions): void {\n\t\tthis._affectsMinimap ||= !!options.minimap?.position;\n\t\tthis._affectsOverviewRuler ||= !!options.overviewRuler?.color;\n\t\tthis._affectsGlyphMargin ||= !!options.glyphMarginClassName;\n\t\tthis._affectsLineNumber ||= !!options.lineNumberClassName;\n\t\tthis.tryFire();\n\t}\n\n\tpublic fire(): void {\n\t\tthis._affectsMinimap = true;\n\t\tthis._affectsOverviewRuler = true;\n\t\tthis._affectsGlyphMargin = true;\n\t\tthis.tryFire();\n\t}\n\n\tprivate tryFire() {\n\t\tif (this._deferredCnt === 0) {\n\t\t\tthis.doFire();\n\t\t} else {\n\t\t\tthis._shouldFireDeferred = true;\n\t\t}\n\t}\n\n\tprivate doFire() {\n\t\tthis.handleBeforeFire(this._affectedInjectedTextLines, this._affectedLineHeights, this._affectedFontLines);\n\n\t\tconst event: IModelDecorationsChangedEvent = {\n\t\t\taffectsMinimap: this._affectsMinimap,\n\t\t\taffectsOverviewRuler: this._affectsOverviewRuler,\n\t\t\taffectsGlyphMargin: this._affectsGlyphMargin,\n\t\t\taffectsLineNumber: this._affectsLineNumber,\n\t\t};\n\t\tthis._shouldFireDeferred = false;\n\t\tthis._affectsMinimap = false;\n\t\tthis._affectsOverviewRuler = false;\n\t\tthis._affectsGlyphMargin = false;\n\t\tthis._actual.fire(event);\n\t}\n}\n\n//#endregion\n\nclass DidChangeContentEmitter extends Disposable {\n\n\t/**\n\t * Both `fastEvent` and `slowEvent` work the same way and contain the same events, but first we invoke `fastEvent` and then `slowEvent`.\n\t */\n\tprivate readonly _fastEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly fastEvent: Event<InternalModelContentChangeEvent> = this._fastEmitter.event;\n\tprivate readonly _slowEmitter: Emitter<InternalModelContentChangeEvent> = this._register(new Emitter<InternalModelContentChangeEvent>());\n\tpublic readonly slowEvent: Event<InternalModelContentChangeEvent> = this._slowEmitter.event;\n\n\tprivate _deferredCnt: number;\n\tprivate _deferredEvent: InternalModelContentChangeEvent | null;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._deferredCnt = 0;\n\t\tthis._deferredEvent = null;\n\t}\n\n\tpublic beginDeferredEmit(): void {\n\t\tthis._deferredCnt++;\n\t}\n\n\tpublic endDeferredEmit(resultingSelection: Selection[] | null = null): void {\n\t\tthis._deferredCnt--;\n\t\tif (this._deferredCnt === 0) {\n\t\t\tif (this._deferredEvent !== null) {\n\t\t\t\tthis._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection;\n\t\t\t\tconst e = this._deferredEvent;\n\t\t\t\tthis._deferredEvent = null;\n\t\t\t\tthis._fastEmitter.fire(e);\n\t\t\t\tthis._slowEmitter.fire(e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic fire(e: InternalModelContentChangeEvent): void {\n\t\tif (this._deferredCnt > 0) {\n\t\t\tif (this._deferredEvent) {\n\t\t\t\tthis._deferredEvent = this._deferredEvent.merge(e);\n\t\t\t} else {\n\t\t\t\tthis._deferredEvent = e;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis._fastEmitter.fire(e);\n\t\tthis._slowEmitter.fire(e);\n\t}\n}\n"]}