monaco-editor-core 0.55.0 → 0.56.0-dev-20251121

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 (416) 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 +27 -8
  18. package/esm/vs/base/browser/dom.js +31 -34
  19. package/esm/vs/base/browser/dom.js.map +1 -1
  20. package/esm/vs/base/browser/dompurify/dompurify.js +0 -1
  21. package/esm/vs/base/browser/keyboardEvent.js +3 -3
  22. package/esm/vs/base/browser/keyboardEvent.js.map +1 -1
  23. package/esm/vs/base/browser/markdownRenderer.js +5 -2
  24. package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
  25. package/esm/vs/base/browser/pixelRatio.js +5 -5
  26. package/esm/vs/base/browser/pixelRatio.js.map +1 -1
  27. package/esm/vs/base/browser/trustedTypes.js +1 -1
  28. package/esm/vs/base/browser/trustedTypes.js.map +1 -1
  29. package/esm/vs/base/browser/ui/actionbar/actionbar.js +3 -0
  30. package/esm/vs/base/browser/ui/actionbar/actionbar.js.map +1 -1
  31. package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
  32. package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +7 -0
  33. package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js.map +1 -1
  34. package/esm/vs/base/browser/ui/hover/hoverWidget.css +0 -13
  35. package/esm/vs/base/browser/ui/inputbox/inputBox.js +7 -0
  36. package/esm/vs/base/browser/ui/inputbox/inputBox.js.map +1 -1
  37. package/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css +4 -2
  38. package/esm/vs/base/browser/ui/list/listView.js +7 -2
  39. package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
  40. package/esm/vs/base/browser/ui/selectBox/selectBox.js +4 -0
  41. package/esm/vs/base/browser/ui/selectBox/selectBox.js.map +1 -1
  42. package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.css +12 -32
  43. package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js +8 -18
  44. package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js.map +1 -1
  45. package/esm/vs/base/browser/ui/toolbar/toolbar.js +41 -14
  46. package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
  47. package/esm/vs/base/browser/ui/tree/abstractTree.js +11 -0
  48. package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
  49. package/esm/vs/base/browser/ui/tree/asyncDataTree.js +1 -0
  50. package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
  51. package/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js.map +1 -1
  52. package/esm/vs/base/browser/ui/tree/dataTree.js.map +1 -1
  53. package/esm/vs/base/browser/ui/tree/indexTreeModel.js.map +1 -1
  54. package/esm/vs/base/browser/ui/tree/objectTree.js.map +1 -1
  55. package/esm/vs/base/browser/ui/tree/objectTreeModel.js.map +1 -1
  56. package/esm/vs/base/browser/ui/tree/tree.js.map +1 -1
  57. package/esm/vs/base/common/arrays.js +10 -0
  58. package/esm/vs/base/common/arrays.js.map +1 -1
  59. package/esm/vs/base/common/async.js +34 -0
  60. package/esm/vs/base/common/async.js.map +1 -1
  61. package/esm/vs/base/common/buffer.js +1 -1
  62. package/esm/vs/base/common/buffer.js.map +1 -1
  63. package/esm/vs/base/common/cancellation.js.map +1 -1
  64. package/esm/vs/base/common/codiconsLibrary.js +3 -0
  65. package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
  66. package/esm/vs/base/common/collections.js.map +1 -1
  67. package/esm/vs/base/common/equals.js.map +1 -1
  68. package/esm/vs/base/common/event.js +32 -15
  69. package/esm/vs/base/common/event.js.map +1 -1
  70. package/esm/vs/base/common/filters.js +22 -3
  71. package/esm/vs/base/common/filters.js.map +1 -1
  72. package/esm/vs/base/common/hotReload.js +2 -2
  73. package/esm/vs/base/common/hotReload.js.map +1 -1
  74. package/esm/vs/base/common/iterator.js +1 -1
  75. package/esm/vs/base/common/iterator.js.map +1 -1
  76. package/esm/vs/base/common/keyCodes.js +7 -6
  77. package/esm/vs/base/common/keyCodes.js.map +1 -1
  78. package/esm/vs/base/common/linkedList.js.map +1 -1
  79. package/esm/vs/base/common/map.js.map +1 -1
  80. package/esm/vs/base/common/marked/marked.js +0 -1
  81. package/esm/vs/base/common/network.js +26 -1
  82. package/esm/vs/base/common/network.js.map +1 -1
  83. package/esm/vs/base/common/normalization.js +19 -6
  84. package/esm/vs/base/common/normalization.js.map +1 -1
  85. package/esm/vs/base/common/observableInternal/debugLocation.js +1 -2
  86. package/esm/vs/base/common/observableInternal/debugLocation.js.map +1 -1
  87. package/esm/vs/base/common/observableInternal/debugName.js +0 -1
  88. package/esm/vs/base/common/observableInternal/debugName.js.map +1 -1
  89. package/esm/vs/base/common/observableInternal/index.js +4 -4
  90. package/esm/vs/base/common/observableInternal/index.js.map +1 -1
  91. package/esm/vs/base/common/observableInternal/logging/debugGetDependencyGraph.js +38 -10
  92. package/esm/vs/base/common/observableInternal/logging/debugGetDependencyGraph.js.map +1 -1
  93. package/esm/vs/base/common/observableInternal/observables/baseObservable.js +3 -3
  94. package/esm/vs/base/common/observableInternal/observables/baseObservable.js.map +1 -1
  95. package/esm/vs/base/common/observableInternal/utils/utils.js +46 -5
  96. package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
  97. package/esm/vs/base/common/path.js +1 -0
  98. package/esm/vs/base/common/path.js.map +1 -1
  99. package/esm/vs/base/common/strings.js +27 -19
  100. package/esm/vs/base/common/strings.js.map +1 -1
  101. package/esm/vs/editor/browser/config/elementSizeObserver.js +5 -5
  102. package/esm/vs/editor/browser/config/elementSizeObserver.js.map +1 -1
  103. package/esm/vs/editor/browser/config/fontMeasurements.js.map +1 -1
  104. package/esm/vs/editor/browser/config/migrateOptions.js +6 -0
  105. package/esm/vs/editor/browser/config/migrateOptions.js.map +1 -1
  106. package/esm/vs/editor/browser/config/tabFocus.js +4 -2
  107. package/esm/vs/editor/browser/config/tabFocus.js.map +1 -1
  108. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +8 -0
  109. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
  110. package/esm/vs/editor/browser/coreCommands.js +1 -2
  111. package/esm/vs/editor/browser/coreCommands.js.map +1 -1
  112. package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
  113. package/esm/vs/editor/browser/observableCodeEditor.js +32 -1
  114. package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
  115. package/esm/vs/editor/browser/services/contribution.js +9 -0
  116. package/esm/vs/editor/browser/services/contribution.js.map +1 -0
  117. package/esm/vs/editor/browser/services/editorWorkerService.js +27 -14
  118. package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
  119. package/esm/vs/editor/browser/services/openerService.js +5 -1
  120. package/esm/vs/editor/browser/services/openerService.js.map +1 -1
  121. package/esm/vs/editor/browser/view/domLineBreaksComputer.js +1 -1
  122. package/esm/vs/editor/browser/view/domLineBreaksComputer.js.map +1 -1
  123. package/esm/vs/editor/browser/view/renderingContext.js +1 -1
  124. package/esm/vs/editor/browser/view/renderingContext.js.map +1 -1
  125. package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js +10 -3
  126. package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js.map +1 -1
  127. package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +3 -4
  128. package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js.map +1 -1
  129. package/esm/vs/editor/browser/viewParts/minimap/minimap.js +1 -1
  130. package/esm/vs/editor/browser/viewParts/minimap/minimap.js.map +1 -1
  131. package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +1 -1
  132. package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js.map +1 -1
  133. package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js +4 -2
  134. package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js.map +1 -1
  135. package/esm/vs/editor/browser/viewParts/rulers/rulers.js +1 -3
  136. package/esm/vs/editor/browser/viewParts/rulers/rulers.js.map +1 -1
  137. package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js +1 -1
  138. package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js.map +1 -1
  139. package/esm/vs/editor/browser/viewParts/viewLines/domReadingContext.js +2 -1
  140. package/esm/vs/editor/browser/viewParts/viewLines/domReadingContext.js.map +1 -1
  141. package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js +6 -18
  142. package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js.map +1 -1
  143. package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js +0 -7
  144. package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js.map +1 -1
  145. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +7 -2
  146. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
  147. package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js +1 -0
  148. package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js.map +1 -1
  149. package/esm/vs/editor/common/commands/replaceCommand.js +2 -2
  150. package/esm/vs/editor/common/commands/replaceCommand.js.map +1 -1
  151. package/esm/vs/editor/common/config/editorOptions.js +374 -360
  152. package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
  153. package/esm/vs/editor/common/core/2d/rect.js +7 -0
  154. package/esm/vs/editor/common/core/2d/rect.js.map +1 -1
  155. package/esm/vs/editor/common/core/2d/size.js +20 -0
  156. package/esm/vs/editor/common/core/2d/size.js.map +1 -0
  157. package/esm/vs/editor/common/core/editorColorRegistry.js +69 -68
  158. package/esm/vs/editor/common/core/editorColorRegistry.js.map +1 -1
  159. package/esm/vs/editor/common/core/ranges/offsetRange.js +9 -0
  160. package/esm/vs/editor/common/core/ranges/offsetRange.js.map +1 -1
  161. package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
  162. package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
  163. package/esm/vs/editor/common/editorContextKeys.js +47 -47
  164. package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
  165. package/esm/vs/editor/common/languages.js +56 -56
  166. package/esm/vs/editor/common/languages.js.map +1 -1
  167. package/esm/vs/editor/common/model/editStack.js +1 -1
  168. package/esm/vs/editor/common/services/languagesAssociations.js +6 -8
  169. package/esm/vs/editor/common/services/languagesAssociations.js.map +1 -1
  170. package/esm/vs/editor/common/standaloneStrings.js +11 -10
  171. package/esm/vs/editor/common/standaloneStrings.js.map +1 -1
  172. package/esm/vs/editor/common/textModelEditSource.js +1 -1
  173. package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
  174. package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
  175. package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
  176. package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
  177. package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
  178. package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
  179. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +17 -17
  180. package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
  181. package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
  182. package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
  183. package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
  184. package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
  185. package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
  186. package/esm/vs/editor/contrib/codelens/browser/codelens.js.map +1 -1
  187. package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
  188. package/esm/vs/editor/contrib/codelens/browser/codelensController.js.map +1 -1
  189. package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
  190. package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
  191. package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +1 -1
  192. package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
  193. package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
  194. package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +10 -10
  195. package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
  196. package/esm/vs/editor/contrib/diffEditorBreadcrumbs/browser/contribution.js +14 -0
  197. package/esm/vs/editor/contrib/diffEditorBreadcrumbs/browser/contribution.js.map +1 -1
  198. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
  199. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +9 -9
  200. package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
  201. package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
  202. package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
  203. package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
  204. package/esm/vs/editor/contrib/find/browser/findController.js +17 -17
  205. package/esm/vs/editor/contrib/find/browser/findController.js.map +1 -1
  206. package/esm/vs/editor/contrib/find/browser/findWidget.js +26 -26
  207. package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
  208. package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
  209. package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
  210. package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
  211. package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
  212. package/esm/vs/editor/contrib/format/browser/format.js +21 -6
  213. package/esm/vs/editor/contrib/format/browser/format.js.map +1 -1
  214. package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
  215. package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
  216. package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
  217. package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
  218. package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
  219. package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
  220. package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
  221. package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
  222. package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
  223. package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
  224. package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
  225. package/esm/vs/editor/contrib/hover/browser/contentHoverController.js +5 -10
  226. package/esm/vs/editor/contrib/hover/browser/contentHoverController.js.map +1 -1
  227. package/esm/vs/editor/contrib/hover/browser/glyphHoverController.js +11 -6
  228. package/esm/vs/editor/contrib/hover/browser/glyphHoverController.js.map +1 -1
  229. package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
  230. package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
  231. package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
  232. package/esm/vs/editor/contrib/hover/browser/hoverUtils.js +24 -0
  233. package/esm/vs/editor/contrib/hover/browser/hoverUtils.js.map +1 -1
  234. package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +9 -9
  235. package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +5 -5
  236. package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
  237. package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
  238. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
  239. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +20 -20
  240. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +12 -12
  241. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +18 -16
  242. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
  243. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
  244. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
  245. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +42 -37
  246. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
  247. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +3 -3
  248. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +1 -1
  249. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +8 -8
  250. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
  251. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +54 -43
  252. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
  253. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +12 -12
  254. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
  255. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +74 -48
  256. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
  257. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +8 -36
  258. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
  259. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsNewUsers.js +10 -11
  260. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsNewUsers.js.map +1 -1
  261. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +105 -119
  262. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
  263. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
  264. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +8 -36
  265. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
  266. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/debugVisualization.js +95 -0
  267. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/debugVisualization.js.map +1 -0
  268. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +17 -9
  269. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
  270. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +415 -0
  271. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -0
  272. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +253 -0
  273. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -0
  274. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
  275. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.js +103 -0
  276. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.js.map +1 -0
  277. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.js +32 -0
  278. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.js.map +1 -0
  279. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +44 -11
  280. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
  281. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +181 -0
  282. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -0
  283. package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
  284. package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
  285. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -31
  286. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
  287. package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
  288. package/esm/vs/editor/contrib/links/browser/links.js +10 -10
  289. package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
  290. package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
  291. package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
  292. package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
  293. package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
  294. package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
  295. package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +2 -2
  296. package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js.map +1 -1
  297. package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +18 -13
  298. package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js.map +1 -1
  299. package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
  300. package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
  301. package/esm/vs/editor/contrib/rename/browser/rename.js +12 -12
  302. package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
  303. package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
  304. package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
  305. package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
  306. package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
  307. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
  308. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +1 -1
  309. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
  310. package/esm/vs/editor/contrib/suggest/browser/suggest.js +8 -8
  311. package/esm/vs/editor/contrib/suggest/browser/suggestController.js +10 -10
  312. package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +17 -17
  313. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +2 -2
  314. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
  315. package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
  316. package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
  317. package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
  318. package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
  319. package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
  320. package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +29 -29
  321. package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js.map +1 -1
  322. package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
  323. package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
  324. package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +4 -4
  325. package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js.map +1 -1
  326. package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
  327. package/esm/vs/editor/editor.all.js +1 -0
  328. package/esm/vs/editor/editor.all.js.map +1 -1
  329. package/esm/vs/editor/editor.api.d.ts +9 -5
  330. package/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js +22 -2
  331. package/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js.map +1 -1
  332. package/esm/vs/editor/standalone/browser/services/standaloneWebWorkerService.js +39 -0
  333. package/esm/vs/editor/standalone/browser/services/standaloneWebWorkerService.js.map +1 -0
  334. package/esm/vs/editor/standalone/browser/standaloneEditor.js +2 -1
  335. package/esm/vs/editor/standalone/browser/standaloneEditor.js.map +1 -1
  336. package/esm/vs/editor/standalone/browser/standaloneServices.js +3 -21
  337. package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
  338. package/esm/vs/editor/standalone/browser/standaloneWebWorker.js +4 -4
  339. package/esm/vs/editor/standalone/browser/standaloneWebWorker.js.map +1 -1
  340. package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
  341. package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
  342. package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
  343. package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
  344. package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +7 -9
  345. package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js.map +1 -1
  346. package/esm/vs/platform/actions/browser/toolbar.js +2 -2
  347. package/esm/vs/platform/actions/common/actions.js +2 -0
  348. package/esm/vs/platform/actions/common/actions.js.map +1 -1
  349. package/esm/vs/platform/actions/common/menuService.js +2 -2
  350. package/esm/vs/platform/configuration/common/configuration.js +5 -4
  351. package/esm/vs/platform/configuration/common/configuration.js.map +1 -1
  352. package/esm/vs/platform/configuration/common/configurationModels.js +21 -10
  353. package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
  354. package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
  355. package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
  356. package/esm/vs/platform/configuration/common/configurations.js.map +1 -1
  357. package/esm/vs/platform/contextkey/browser/contextKeyService.js +3 -3
  358. package/esm/vs/platform/contextkey/browser/contextKeyService.js.map +1 -1
  359. package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
  360. package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
  361. package/esm/vs/platform/contextkey/common/scanner.js +5 -5
  362. package/esm/vs/platform/contextview/browser/contextViewService.js.map +1 -1
  363. package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
  364. package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
  365. package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
  366. package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
  367. package/esm/vs/platform/list/browser/listService.js +27 -27
  368. package/esm/vs/platform/list/browser/listService.js.map +1 -1
  369. package/esm/vs/platform/markers/common/markerService.js +2 -2
  370. package/esm/vs/platform/markers/common/markers.js +6 -6
  371. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +11 -32
  372. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js.map +1 -1
  373. package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
  374. package/esm/vs/platform/quickinput/browser/media/quickInput.css +9 -3
  375. package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
  376. package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
  377. package/esm/vs/platform/quickinput/browser/quickInputController.js +35 -14
  378. package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
  379. package/esm/vs/platform/quickinput/browser/quickInputList.js +4 -1
  380. package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
  381. package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
  382. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
  383. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js +71 -40
  384. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js.map +1 -1
  385. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js +21 -8
  386. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js.map +1 -1
  387. package/esm/vs/platform/telemetry/common/gdprTypings.js.map +1 -1
  388. package/esm/vs/platform/telemetry/common/telemetry.js.map +1 -1
  389. package/esm/vs/platform/theme/common/colorUtils.js +2 -2
  390. package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
  391. package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
  392. package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
  393. package/esm/vs/platform/theme/common/colors/editorColors.js.map +1 -1
  394. package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
  395. package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
  396. package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
  397. package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
  398. package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
  399. package/esm/vs/platform/theme/common/colors/miscColors.js.map +1 -1
  400. package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
  401. package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
  402. package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
  403. package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
  404. package/esm/vs/platform/webWorker/browser/webWorkerDescriptor.js +12 -0
  405. package/esm/vs/platform/webWorker/browser/webWorkerDescriptor.js.map +1 -0
  406. package/esm/vs/platform/webWorker/browser/webWorkerService.js +7 -0
  407. package/esm/vs/platform/webWorker/browser/webWorkerService.js.map +1 -0
  408. package/esm/vs/{base/browser/webWorkerFactory.js → platform/webWorker/browser/webWorkerServiceImpl.js} +47 -66
  409. package/esm/vs/platform/webWorker/browser/webWorkerServiceImpl.js.map +1 -0
  410. package/esm/vs/platform/workspace/common/workspace.js +1 -1
  411. package/monaco.d.ts +9 -5
  412. package/package.json +2 -2
  413. package/version.txt +1 -1
  414. package/esm/vs/base/browser/webWorkerFactory.js.map +0 -1
  415. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineCompletionsView.js +0 -82
  416. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineCompletionsView.js.map +0 -1
@@ -15,7 +15,6 @@ import { createTrustedTypesPolicy } from '../../../../../../base/browser/trusted
15
15
  import { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';
16
16
  import { Codicon } from '../../../../../../base/common/codicons.js';
17
17
  import { Emitter, Event } from '../../../../../../base/common/event.js';
18
- import { createHotClass } from '../../../../../../base/common/hotReloadHelpers.js';
19
18
  import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';
20
19
  import { autorun, autorunWithStore, constObservable, derived, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';
21
20
  import * as strings from '../../../../../../base/common/strings.js';
@@ -40,36 +39,39 @@ import { StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js
40
39
  import { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';
41
40
  import { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';
42
41
  import { sum } from '../../../../../../base/common/arrays.js';
42
+ export class GhostTextWidgetWarning {
43
+ static from(warning) {
44
+ if (!warning) {
45
+ return undefined;
46
+ }
47
+ return new GhostTextWidgetWarning(warning.icon);
48
+ }
49
+ constructor(icon = Codicon.warning) {
50
+ this.icon = icon;
51
+ }
52
+ }
43
53
  const USE_SQUIGGLES_FOR_WARNING = true;
44
54
  const GHOST_TEXT_CLASS_NAME = 'ghost-text';
45
55
  let GhostTextView = class GhostTextView extends Disposable {
46
- static { this.hot = createHotClass(this); }
47
- constructor(_editor, _model, _options, _shouldKeepCursorStable, _isClickable, _languageService) {
56
+ constructor(_editor, _data, options, _languageService) {
48
57
  super();
49
58
  this._editor = _editor;
50
- this._model = _model;
51
- this._options = _options;
52
- this._shouldKeepCursorStable = _shouldKeepCursorStable;
53
- this._isClickable = _isClickable;
59
+ this._data = _data;
54
60
  this._languageService = _languageService;
55
61
  this._isDisposed = observableValue(this, false);
56
- this._editorObs = observableCodeEditor(this._editor);
57
62
  this._warningState = derived(reader => {
58
- const gt = this._model.ghostText.read(reader);
59
- if (!gt) {
60
- return undefined;
61
- }
62
- const warning = this._model.warning.read(reader);
63
- if (!warning) {
63
+ const model = this._data.read(reader);
64
+ const warning = model?.warning;
65
+ if (!model || !warning) {
64
66
  return undefined;
65
67
  }
68
+ const gt = model.ghostText;
66
69
  return { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };
67
70
  });
68
71
  this._onDidClick = this._register(new Emitter());
69
72
  this.onDidClick = this._onDidClick.event;
70
- this._useSyntaxHighlighting = this._options.map(o => o.syntaxHighlightingEnabled);
71
73
  this._extraClassNames = derived(this, reader => {
72
- const extraClasses = [...this._options.read(reader).extraClasses ?? []];
74
+ const extraClasses = this._extraClasses.slice();
73
75
  if (this._useSyntaxHighlighting.read(reader)) {
74
76
  extraClasses.push('syntax-highlighted');
75
77
  }
@@ -79,18 +81,19 @@ let GhostTextView = class GhostTextView extends Disposable {
79
81
  const extraClassNames = extraClasses.map(c => ` ${c}`).join('');
80
82
  return extraClassNames;
81
83
  });
82
- this.uiState = derived(this, reader => {
84
+ this._state = derived(this, reader => {
83
85
  if (this._isDisposed.read(reader)) {
84
86
  return undefined;
85
87
  }
86
- const textModel = this._editorObs.model.read(reader);
87
- if (textModel !== this._model.targetTextModel.read(reader)) {
88
+ const props = this._data.read(reader);
89
+ if (!props) {
88
90
  return undefined;
89
91
  }
90
- const ghostText = this._model.ghostText.read(reader);
91
- if (!ghostText) {
92
+ const textModel = this._editorObs.model.read(reader);
93
+ if (!textModel) {
92
94
  return undefined;
93
95
  }
96
+ const ghostText = props.ghostText;
94
97
  const replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;
95
98
  const syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);
96
99
  const extraClassNames = this._extraClassNames.read(reader);
@@ -115,7 +118,7 @@ let GhostTextView = class GhostTextView extends Disposable {
115
118
  const cursorColumn = this._editor.getSelection()?.getStartPosition().column;
116
119
  const disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');
117
120
  const hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;
118
- const renderData = {
121
+ const telemetryViewData = {
119
122
  cursorColumnDistance: (hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,
120
123
  cursorLineDistance: hasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),
121
124
  lineCountOriginal: hasInsertionOnCurrentLine ? 1 : 0,
@@ -125,20 +128,21 @@ let GhostTextView = class GhostTextView extends Disposable {
125
128
  disjointReplacements: disjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),
126
129
  sameShapeReplacements: disjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined,
127
130
  };
128
- this._model.handleInlineCompletionShown.read(reader)?.(renderData);
129
131
  return {
130
132
  replacedRange,
131
133
  inlineTexts: inlineTextsWithTokens,
132
134
  additionalLines: tokenizedAdditionalLines,
133
135
  hiddenRange,
134
136
  lineNumber: ghostText.lineNumber,
135
- additionalReservedLineCount: this._model.minReservedLineCount.read(reader),
137
+ additionalReservedLineCount: this._minReservedLineCount.read(reader),
136
138
  targetTextModel: textModel,
137
139
  syntaxHighlightingEnabled,
140
+ telemetryViewData,
141
+ handleInlineCompletionShown: props.handleInlineCompletionShown,
138
142
  };
139
143
  });
140
- this.decorations = derived(this, reader => {
141
- const uiState = this.uiState.read(reader);
144
+ this._decorations = derived(this, reader => {
145
+ const uiState = this._state.read(reader);
142
146
  if (!uiState) {
143
147
  return [];
144
148
  }
@@ -177,31 +181,36 @@ let GhostTextView = class GhostTextView extends Disposable {
177
181
  }
178
182
  return decorations;
179
183
  });
184
+ this.isHovered = derived(this, reader => {
185
+ if (this._isDisposed.read(reader)) {
186
+ return false;
187
+ }
188
+ return this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);
189
+ });
190
+ this.height = derived(this, reader => {
191
+ const lineHeight = this._editorObs.getOption(75 /* EditorOption.lineHeight */).read(reader);
192
+ return lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);
193
+ });
194
+ this._extraClasses = options.extraClasses ?? [];
195
+ this._isClickable = options.isClickable ?? false;
196
+ this._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;
197
+ this._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);
198
+ this._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);
199
+ this._editorObs = observableCodeEditor(this._editor);
180
200
  this._additionalLinesWidget = this._register(new AdditionalLinesWidget(this._editor, derived(reader => {
181
201
  /** @description lines */
182
- const uiState = this.uiState.read(reader);
202
+ const uiState = this._state.read(reader);
183
203
  return uiState ? {
184
204
  lineNumber: uiState.lineNumber,
185
205
  additionalLines: uiState.additionalLines,
186
206
  minReservedLineCount: uiState.additionalReservedLineCount,
187
- targetTextModel: uiState.targetTextModel,
188
207
  } : undefined;
189
208
  }), this._shouldKeepCursorStable, this._isClickable));
190
209
  this._isInlineTextHovered = this._editorObs.isTargetHovered(p => p.target.type === 6 /* MouseTargetType.CONTENT_TEXT */ &&
191
210
  p.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&
192
211
  p.target.detail.injectedText.options.attachedData.owner === this, this._store);
193
- this.isHovered = derived(this, reader => {
194
- if (this._isDisposed.read(reader)) {
195
- return false;
196
- }
197
- return this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);
198
- });
199
- this.height = derived(this, reader => {
200
- const lineHeight = this._editorObs.getOption(75 /* EditorOption.lineHeight */).read(reader);
201
- return lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);
202
- });
203
212
  this._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));
204
- this._register(this._editorObs.setDecorations(this.decorations));
213
+ this._register(this._editorObs.setDecorations(this._decorations));
205
214
  if (this._isClickable) {
206
215
  this._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));
207
216
  this._register(this._editor.onMouseUp(e => {
@@ -214,6 +223,10 @@ let GhostTextView = class GhostTextView extends Disposable {
214
223
  }
215
224
  }));
216
225
  }
226
+ this._register(autorun(reader => {
227
+ const state = this._state.read(reader);
228
+ state?.handleInlineCompletionShown(state.telemetryViewData);
229
+ }));
217
230
  this._register(autorunWithStore((reader, store) => {
218
231
  if (USE_SQUIGGLES_FOR_WARNING) {
219
232
  return;
@@ -252,9 +265,7 @@ let GhostTextView = class GhostTextView extends Disposable {
252
265
  alignContent: 'center',
253
266
  alignItems: 'center',
254
267
  }
255
- }, [
256
- renderIcon((state.icon && 'id' in state.icon) ? state.icon : Codicon.warning),
257
- ])
268
+ }, [renderIcon(state.icon)])
258
269
  ]).keepUpdated(store).element,
259
270
  }));
260
271
  }));
@@ -275,7 +286,7 @@ let GhostTextView = class GhostTextView extends Disposable {
275
286
  }
276
287
  };
277
288
  GhostTextView = __decorate([
278
- __param(5, ILanguageService)
289
+ __param(3, ILanguageService)
279
290
  ], GhostTextView);
280
291
  export { GhostTextView };
281
292
  class GhostTextAttachedData {
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts","vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1H,OAAO,EAAe,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC3K,OAAO,KAAK,OAAO,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD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AChE,OAAO,CAAC,SAAS,GAAG,WAAqB,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,iBAAiB,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC","file":"ghostTextView.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 { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { createHotClass } from '../../../../../../base/common/hotReloadHelpers.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { sum } from '../../../../../../base/common/arrays.js';\n\nexport interface IGhostTextWidgetModel {\n\treadonly targetTextModel: IObservable<ITextModel | undefined>;\n\treadonly ghostText: IObservable<GhostText | GhostTextReplacement | undefined>;\n\treadonly warning: IObservable<{ icon: IconPath | undefined } | undefined>;\n\treadonly minReservedLineCount: IObservable<number>;\n\n\treadonly handleInlineCompletionShown: IObservable<(viewData: InlineCompletionViewData) => void>;\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed;\n\tprivate readonly _editorObs;\n\tpublic static hot = createHotClass(this);\n\n\tprivate _warningState;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IGhostTextWidgetModel,\n\t\tprivate readonly _options: IObservable<{\n\t\t\textraClasses?: string[];\n\t\t\tsyntaxHighlightingEnabled: boolean;\n\t\t}>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\t\tthis._isDisposed = observableValue(this, false);\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._warningState = derived(reader => {\n\t\t\tconst gt = this._model.ghostText.read(reader);\n\t\t\tif (!gt) { return undefined; }\n\t\t\tconst warning = this._model.warning.read(reader);\n\t\t\tif (!warning) { return undefined; }\n\t\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t\t});\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._useSyntaxHighlighting = this._options.map(o => o.syntaxHighlightingEnabled);\n\t\tthis._extraClassNames = derived(this, reader => {\n\t\t\tconst extraClasses = [...this._options.read(reader).extraClasses ?? []];\n\t\t\tif (this._useSyntaxHighlighting.read(reader)) {\n\t\t\t\textraClasses.push('syntax-highlighted');\n\t\t\t}\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\t\textraClasses.push('warning');\n\t\t\t}\n\t\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\t\treturn extraClassNames;\n\t\t});\n\t\tthis.uiState = derived(this, reader => {\n\t\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\t\t\tconst textModel = this._editorObs.model.read(reader);\n\t\t\tif (textModel !== this._model.targetTextModel.read(reader)) { return undefined; }\n\t\t\tconst ghostText = this._model.ghostText.read(reader);\n\t\t\tif (!ghostText) { return undefined; }\n\n\t\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\t\tconst newRanges = edit.getNewRanges();\n\t\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent,\n\t\t\t\t\tdecorations: l.decorations,\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\t\tconst renderData: InlineCompletionViewData = {\n\t\t\t\tcursorColumnDistance: (hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\t\tcursorLineDistance: hasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\t\tlineCountOriginal: hasInsertionOnCurrentLine ? 1 : 0,\n\t\t\t\tlineCountModified: additionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\t\tcharacterCountOriginal: 0,\n\t\t\t\tcharacterCountModified: sum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\t\tdisjointReplacements: disjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\t\tsameShapeReplacements: disjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined,\n\t\t\t};\n\t\t\tthis._model.handleInlineCompletionShown.read(reader)?.(renderData);\n\n\t\t\treturn {\n\t\t\t\treplacedRange,\n\t\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\t\thiddenRange,\n\t\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\t\tadditionalReservedLineCount: this._model.minReservedLineCount.read(reader),\n\t\t\t\ttargetTextModel: textModel,\n\t\t\t\tsyntaxHighlightingEnabled,\n\t\t\t};\n\t\t});\n\t\tthis.decorations = derived(this, reader => {\n\t\t\tconst uiState = this.uiState.read(reader);\n\t\t\tif (!uiState) { return []; }\n\n\t\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\t\tif (uiState.replacedRange) {\n\t\t\t\tdecorations.push({\n\t\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (uiState.hiddenRange) {\n\t\t\t\tdecorations.push({\n\t\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfor (const p of uiState.inlineTexts) {\n\t\t\t\tdecorations.push({\n\t\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\t\tafter: {\n\t\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn decorations;\n\t\t});\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderived(reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this.uiState.read(reader);\n\t\t\t\t\treturn uiState ? {\n\t\t\t\t\t\tlineNumber: uiState.lineNumber,\n\t\t\t\t\t\tadditionalLines: uiState.additionalLines,\n\t\t\t\t\t\tminReservedLineCount: uiState.additionalReservedLineCount,\n\t\t\t\t\t\ttargetTextModel: uiState.targetTextModel,\n\t\t\t\t\t} : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\t\tthis.isHovered = derived(this, reader => {\n\t\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t\t});\n\t\tthis.height = derived(this, reader => {\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t\t});\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this.decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\trenderIcon((state.icon && 'id' in state.icon) ? state.icon : Codicon.warning),\n\t\t\t\t\t])\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _useSyntaxHighlighting;\n\n\tprivate readonly _extraClassNames;\n\n\tprivate readonly uiState;\n\n\tprivate readonly decorations;\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered;\n\n\tpublic readonly height;\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<{\n\t\t\ttargetTextModel: ITextModel;\n\t\t\tlineNumber: number;\n\t\t\tadditionalLines: LineData[];\n\t\t\tminReservedLineCount: number;\n\t\t} | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\tif (heightInLines > 0) {\n\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\tif (this._isClickable) {\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t}));\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t}\n\n\t\t\tthis._viewZoneListener.value = store;\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport interface LineData {\n\tcontent: LineTokens; // Must not contain a linebreak!\n\tdecorations: LineDecoration[];\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations,\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\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 { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { createHotClass } from '../../../../../../base/common/hotReloadHelpers.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { sum } from '../../../../../../base/common/arrays.js';\n\nexport interface IGhostTextWidgetModel {\n\treadonly targetTextModel: IObservable<ITextModel | undefined>;\n\treadonly ghostText: IObservable<GhostText | GhostTextReplacement | undefined>;\n\treadonly warning: IObservable<{ icon: IconPath | undefined } | undefined>;\n\treadonly minReservedLineCount: IObservable<number>;\n\n\treadonly handleInlineCompletionShown: IObservable<(viewData: InlineCompletionViewData) => void>;\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed;\n\tprivate readonly _editorObs;\n\tpublic static hot = createHotClass(this);\n\n\tprivate _warningState;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IGhostTextWidgetModel,\n\t\tprivate readonly _options: IObservable<{\n\t\t\textraClasses?: string[];\n\t\t\tsyntaxHighlightingEnabled: boolean;\n\t\t}>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\t\tthis._isDisposed = observableValue(this, false);\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._warningState = derived(reader => {\n\t\t\tconst gt = this._model.ghostText.read(reader);\n\t\t\tif (!gt) { return undefined; }\n\t\t\tconst warning = this._model.warning.read(reader);\n\t\t\tif (!warning) { return undefined; }\n\t\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t\t});\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._useSyntaxHighlighting = this._options.map(o => o.syntaxHighlightingEnabled);\n\t\tthis._extraClassNames = derived(this, reader => {\n\t\t\tconst extraClasses = [...this._options.read(reader).extraClasses ?? []];\n\t\t\tif (this._useSyntaxHighlighting.read(reader)) {\n\t\t\t\textraClasses.push('syntax-highlighted');\n\t\t\t}\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\t\textraClasses.push('warning');\n\t\t\t}\n\t\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\t\treturn extraClassNames;\n\t\t});\n\t\tthis.uiState = derived(this, reader => {\n\t\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\t\t\tconst textModel = this._editorObs.model.read(reader);\n\t\t\tif (textModel !== this._model.targetTextModel.read(reader)) { return undefined; }\n\t\t\tconst ghostText = this._model.ghostText.read(reader);\n\t\t\tif (!ghostText) { return undefined; }\n\n\t\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\t\tconst newRanges = edit.getNewRanges();\n\t\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent,\n\t\t\t\t\tdecorations: l.decorations,\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\t\tconst renderData: InlineCompletionViewData = {\n\t\t\t\tcursorColumnDistance: (hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\t\tcursorLineDistance: hasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\t\tlineCountOriginal: hasInsertionOnCurrentLine ? 1 : 0,\n\t\t\t\tlineCountModified: additionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\t\tcharacterCountOriginal: 0,\n\t\t\t\tcharacterCountModified: sum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\t\tdisjointReplacements: disjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\t\tsameShapeReplacements: disjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined,\n\t\t\t};\n\t\t\tthis._model.handleInlineCompletionShown.read(reader)?.(renderData);\n\n\t\t\treturn {\n\t\t\t\treplacedRange,\n\t\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\t\thiddenRange,\n\t\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\t\tadditionalReservedLineCount: this._model.minReservedLineCount.read(reader),\n\t\t\t\ttargetTextModel: textModel,\n\t\t\t\tsyntaxHighlightingEnabled,\n\t\t\t};\n\t\t});\n\t\tthis.decorations = derived(this, reader => {\n\t\t\tconst uiState = this.uiState.read(reader);\n\t\t\tif (!uiState) { return []; }\n\n\t\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\t\tif (uiState.replacedRange) {\n\t\t\t\tdecorations.push({\n\t\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (uiState.hiddenRange) {\n\t\t\t\tdecorations.push({\n\t\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfor (const p of uiState.inlineTexts) {\n\t\t\t\tdecorations.push({\n\t\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\t\tafter: {\n\t\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn decorations;\n\t\t});\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderived(reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this.uiState.read(reader);\n\t\t\t\t\treturn uiState ? {\n\t\t\t\t\t\tlineNumber: uiState.lineNumber,\n\t\t\t\t\t\tadditionalLines: uiState.additionalLines,\n\t\t\t\t\t\tminReservedLineCount: uiState.additionalReservedLineCount,\n\t\t\t\t\t\ttargetTextModel: uiState.targetTextModel,\n\t\t\t\t\t} : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\t\tthis.isHovered = derived(this, reader => {\n\t\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t\t});\n\t\tthis.height = derived(this, reader => {\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t\t});\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this.decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\trenderIcon((state.icon && 'id' in state.icon) ? state.icon : Codicon.warning),\n\t\t\t\t\t])\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _useSyntaxHighlighting;\n\n\tprivate readonly _extraClassNames;\n\n\tprivate readonly uiState;\n\n\tprivate readonly decorations;\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered;\n\n\tpublic readonly height;\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<{\n\t\t\ttargetTextModel: ITextModel;\n\t\t\tlineNumber: number;\n\t\t\tadditionalLines: LineData[];\n\t\t\tminReservedLineCount: number;\n\t\t} | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\tif (heightInLines > 0) {\n\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\tif (this._isClickable) {\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t}));\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t}\n\n\t\t\tthis._viewZoneListener.value = store;\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport interface LineData {\n\tcontent: LineTokens; // Must not contain a linebreak!\n\tdecorations: LineDecoration[];\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations,\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts","vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts"],"names":[],"mappings":"AAAA;;;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e,CACjC,CAAC,QAAQ,CAAC,WAAW,IAAI,CAAC,6BAA6B,CAAC,EACxD,QAAQ,CAAC,8BAA8B,EACvC,IAAI,EACJ,KAAK,EACL,YAAY,EACZ,WAAW,EACX,CAAC,EACD,UAAU,EACV,QAAQ,CAAC,WAAW,EACpB,OAAO,EACP,CAAC,EACD,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,WAAW,EACpB,QAAQ,CAAC,aAAa,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,KAAK,mBAAmB,CAAC,GAAG,EACzC,IAAI,EACJ,IAAI,EACJ,CAAC,CACD,EAAE,EAAE,CAAC,CAAC;QAEP,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IACD,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAE1B,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;IACxB,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChE,OAAO,CAAC,SAAS,GAAG,WAAqB,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,iBAAiB,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC","file":"ghostTextView.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 { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath, InlineCompletionWarning } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { sum } from '../../../../../../base/common/arrays.js';\n\nexport interface IGhostTextWidgetData {\n\treadonly ghostText: GhostText | GhostTextReplacement;\n\treadonly warning: GhostTextWidgetWarning | undefined;\n\thandleInlineCompletionShown(viewData: InlineCompletionViewData): void;\n}\n\nexport class GhostTextWidgetWarning {\n\tpublic static from(warning: InlineCompletionWarning | undefined): GhostTextWidgetWarning | undefined {\n\t\tif (!warning) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new GhostTextWidgetWarning(warning.icon);\n\t}\n\n\tconstructor(\n\t\tpublic readonly icon: IconPath = Codicon.warning,\n\t) { }\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed = observableValue(this, false);\n\tprivate readonly _editorObs;\n\tprivate readonly _warningState = derived(reader => {\n\t\tconst model = this._data.read(reader);\n\t\tconst warning = model?.warning;\n\t\tif (!model || !warning) { return undefined; }\n\t\tconst gt = model.ghostText;\n\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t});\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\tpublic readonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _extraClasses: readonly string[];\n\tprivate readonly _isClickable: boolean;\n\tprivate readonly _shouldKeepCursorStable: boolean;\n\tprivate readonly _minReservedLineCount: IObservable<number>;\n\tprivate readonly _useSyntaxHighlighting: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _data: IObservable<IGhostTextWidgetData | undefined>,\n\t\toptions: {\n\t\t\textraClasses?: readonly string[]; // TODO@benibenj improve\n\t\t\tisClickable?: boolean;\n\t\t\tshouldKeepCursorStable?: boolean;\n\t\t\tminReservedLineCount?: IObservable<number>;\n\t\t\tuseSyntaxHighlighting?: IObservable<boolean>;\n\t\t},\n\t\t@ILanguageService private readonly _languageService: ILanguageService\n\t) {\n\t\tsuper();\n\n\t\tthis._extraClasses = options.extraClasses ?? [];\n\t\tthis._isClickable = options.isClickable ?? false;\n\t\tthis._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;\n\t\tthis._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);\n\t\tthis._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderived(reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this._state.read(reader);\n\t\t\t\t\treturn uiState ? {\n\t\t\t\t\t\tlineNumber: uiState.lineNumber,\n\t\t\t\t\t\tadditionalLines: uiState.additionalLines,\n\t\t\t\t\t\tminReservedLineCount: uiState.additionalReservedLineCount,\n\t\t\t\t\t} : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this._decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tstate?.handleInlineCompletionShown(state.telemetryViewData);\n\t\t}));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\t[renderIcon(state.icon)]\n\t\t\t\t\t)\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _extraClassNames = derived(this, reader => {\n\t\tconst extraClasses = this._extraClasses.slice();\n\t\tif (this._useSyntaxHighlighting.read(reader)) {\n\t\t\textraClasses.push('syntax-highlighted');\n\t\t}\n\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\textraClasses.push('warning');\n\t\t}\n\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\treturn extraClassNames;\n\t});\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\n\t\tconst props = this._data.read(reader);\n\t\tif (!props) { return undefined; }\n\n\t\tconst textModel = this._editorObs.model.read(reader);\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst ghostText = props.ghostText;\n\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\tconst newRanges = edit.getNewRanges();\n\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent,\n\t\t\t\tdecorations: l.decorations,\n\t\t\t};\n\t\t});\n\n\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\tconst telemetryViewData: InlineCompletionViewData = {\n\t\t\tcursorColumnDistance: (hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\tcursorLineDistance: hasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\tlineCountOriginal: hasInsertionOnCurrentLine ? 1 : 0,\n\t\t\tlineCountModified: additionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\tcharacterCountOriginal: 0,\n\t\t\tcharacterCountModified: sum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\tdisjointReplacements: disjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\tsameShapeReplacements: disjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined,\n\t\t};\n\n\t\treturn {\n\t\t\treplacedRange,\n\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\thiddenRange,\n\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\tadditionalReservedLineCount: this._minReservedLineCount.read(reader),\n\t\t\ttargetTextModel: textModel,\n\t\t\tsyntaxHighlightingEnabled,\n\t\t\ttelemetryViewData,\n\t\t\thandleInlineCompletionShown: props.handleInlineCompletionShown,\n\t\t};\n\t});\n\n\tprivate readonly _decorations = derived(this, reader => {\n\t\tconst uiState = this._state.read(reader);\n\t\tif (!uiState) { return []; }\n\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\tif (uiState.replacedRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t});\n\t\t}\n\n\t\tif (uiState.hiddenRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t});\n\t\t}\n\n\t\tfor (const p of uiState.inlineTexts) {\n\t\t\tdecorations.push({\n\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\tafter: {\n\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t},\n\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn decorations;\n\t});\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t});\n\n\tpublic readonly height = derived(this, reader => {\n\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t});\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<{\n\t\t\tlineNumber: number;\n\t\t\tadditionalLines: LineData[];\n\t\t\tminReservedLineCount: number;\n\t\t} | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\tif (heightInLines > 0) {\n\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\tif (this._isClickable) {\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t}));\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t}\n\n\t\t\tthis._viewZoneListener.value = store;\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport interface LineData {\n\tcontent: LineTokens; // Must not contain a linebreak!\n\tdecorations: LineDecoration[];\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations,\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\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 { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath, InlineCompletionWarning } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { sum } from '../../../../../../base/common/arrays.js';\n\nexport interface IGhostTextWidgetData {\n\treadonly ghostText: GhostText | GhostTextReplacement;\n\treadonly warning: GhostTextWidgetWarning | undefined;\n\thandleInlineCompletionShown(viewData: InlineCompletionViewData): void;\n}\n\nexport class GhostTextWidgetWarning {\n\tpublic static from(warning: InlineCompletionWarning | undefined): GhostTextWidgetWarning | undefined {\n\t\tif (!warning) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new GhostTextWidgetWarning(warning.icon);\n\t}\n\n\tconstructor(\n\t\tpublic readonly icon: IconPath = Codicon.warning,\n\t) { }\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed = observableValue(this, false);\n\tprivate readonly _editorObs;\n\tprivate readonly _warningState = derived(reader => {\n\t\tconst model = this._data.read(reader);\n\t\tconst warning = model?.warning;\n\t\tif (!model || !warning) { return undefined; }\n\t\tconst gt = model.ghostText;\n\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t});\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\tpublic readonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _extraClasses: readonly string[];\n\tprivate readonly _isClickable: boolean;\n\tprivate readonly _shouldKeepCursorStable: boolean;\n\tprivate readonly _minReservedLineCount: IObservable<number>;\n\tprivate readonly _useSyntaxHighlighting: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _data: IObservable<IGhostTextWidgetData | undefined>,\n\t\toptions: {\n\t\t\textraClasses?: readonly string[]; // TODO@benibenj improve\n\t\t\tisClickable?: boolean;\n\t\t\tshouldKeepCursorStable?: boolean;\n\t\t\tminReservedLineCount?: IObservable<number>;\n\t\t\tuseSyntaxHighlighting?: IObservable<boolean>;\n\t\t},\n\t\t@ILanguageService private readonly _languageService: ILanguageService\n\t) {\n\t\tsuper();\n\n\t\tthis._extraClasses = options.extraClasses ?? [];\n\t\tthis._isClickable = options.isClickable ?? false;\n\t\tthis._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;\n\t\tthis._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);\n\t\tthis._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderived(reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this._state.read(reader);\n\t\t\t\t\treturn uiState ? {\n\t\t\t\t\t\tlineNumber: uiState.lineNumber,\n\t\t\t\t\t\tadditionalLines: uiState.additionalLines,\n\t\t\t\t\t\tminReservedLineCount: uiState.additionalReservedLineCount,\n\t\t\t\t\t} : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this._decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tstate?.handleInlineCompletionShown(state.telemetryViewData);\n\t\t}));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\t[renderIcon(state.icon)]\n\t\t\t\t\t)\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _extraClassNames = derived(this, reader => {\n\t\tconst extraClasses = this._extraClasses.slice();\n\t\tif (this._useSyntaxHighlighting.read(reader)) {\n\t\t\textraClasses.push('syntax-highlighted');\n\t\t}\n\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\textraClasses.push('warning');\n\t\t}\n\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\treturn extraClassNames;\n\t});\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\n\t\tconst props = this._data.read(reader);\n\t\tif (!props) { return undefined; }\n\n\t\tconst textModel = this._editorObs.model.read(reader);\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst ghostText = props.ghostText;\n\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\tconst newRanges = edit.getNewRanges();\n\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent,\n\t\t\t\tdecorations: l.decorations,\n\t\t\t};\n\t\t});\n\n\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\tconst telemetryViewData: InlineCompletionViewData = {\n\t\t\tcursorColumnDistance: (hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\tcursorLineDistance: hasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\tlineCountOriginal: hasInsertionOnCurrentLine ? 1 : 0,\n\t\t\tlineCountModified: additionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\tcharacterCountOriginal: 0,\n\t\t\tcharacterCountModified: sum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\tdisjointReplacements: disjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\tsameShapeReplacements: disjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined,\n\t\t};\n\n\t\treturn {\n\t\t\treplacedRange,\n\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\thiddenRange,\n\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\tadditionalReservedLineCount: this._minReservedLineCount.read(reader),\n\t\t\ttargetTextModel: textModel,\n\t\t\tsyntaxHighlightingEnabled,\n\t\t\ttelemetryViewData,\n\t\t\thandleInlineCompletionShown: props.handleInlineCompletionShown,\n\t\t};\n\t});\n\n\tprivate readonly _decorations = derived(this, reader => {\n\t\tconst uiState = this._state.read(reader);\n\t\tif (!uiState) { return []; }\n\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\tif (uiState.replacedRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t});\n\t\t}\n\n\t\tif (uiState.hiddenRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t});\n\t\t}\n\n\t\tfor (const p of uiState.inlineTexts) {\n\t\t\tdecorations.push({\n\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\tafter: {\n\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t},\n\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn decorations;\n\t});\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t});\n\n\tpublic readonly height = derived(this, reader => {\n\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t});\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<{\n\t\t\tlineNumber: number;\n\t\t\tadditionalLines: LineData[];\n\t\t\tminReservedLineCount: number;\n\t\t} | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\tif (heightInLines > 0) {\n\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\tif (this._isClickable) {\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t}));\n\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t}\n\t\t\t\t\t}));\n\t\t\t\t}\n\n\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t}\n\n\t\t\tthis._viewZoneListener.value = store;\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport interface LineData {\n\tcontent: LineTokens; // Must not contain a linebreak!\n\tdecorations: LineDecoration[];\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations,\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\n"]}