textModelSync.impl.ts ×28

Frontier kind: Code frontier

unlabeled · c_72dcc325ddc3

16 tests · 18689 LOC · 91 files · introduces 0 tests · 1416 LOC · 7 files

Introduces — evidence that enters the hierarchy at this concept

Code
67 ranges1416 lines · 7 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2001 ranges18689 lines · 91 files · Browse complete extent
All tests (intent)
16 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

7 files ranked by introduced lines: 1416 introduced LOC across 67 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/standalone/standaloneEnums.ts 1017 introduced LOC · 1 range

Open complete file

1 > /*--------------------------------------------------------------------------------------------- standaloneEnums.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > // THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
7 >
8 >
9 > export enum AccessibilitySupport {
10 > /**
11 > * This should be the browser case where it is not known if a screen reader is attached or no.
12 > */
13 > Unknown = 0,
14 > Disabled = 1,
15 > Enabled = 2
16 > }
17 >
18 > export enum CodeActionTriggerType {
19 > Invoke = 1,
20 > Auto = 2
21 > }
22 >
23 > export enum CompletionItemInsertTextRule {
24 > None = 0,
25 > /**
26 > * Adjust whitespace/indentation of multiline insert texts to
27 > * match the current line indentation.
28 > */
29 > KeepWhitespace = 1,
30 > /**
31 > * `insertText` is a snippet.
32 > */
33 > InsertAsSnippet = 4
34 > }
35 >
36 > export enum CompletionItemKind {
37 > Method = 0,
38 > Function = 1,
39 > Constructor = 2,
40 > Field = 3,
41 > Variable = 4,
42 > Class = 5,
43 > Struct = 6,
44 > Interface = 7,
45 > Module = 8,
46 > Property = 9,
47 > Event = 10,
48 > Operator = 11,
49 > Unit = 12,
50 > Value = 13,
51 > Constant = 14,
52 > Enum = 15,
53 > EnumMember = 16,
54 > Keyword = 17,
55 > Text = 18,
56 > Color = 19,
57 > File = 20,
58 > Reference = 21,
59 > Customcolor = 22,
60 > Folder = 23,
61 > TypeParameter = 24,
62 > User = 25,
63 > Issue = 26,
64 > Tool = 27,
65 > Snippet = 28
66 > }
67 >
68 > export enum CompletionItemTag {
69 > Deprecated = 1
70 > }
71 >
72 > /**
73 > * How a suggest provider was triggered.
74 > */
75 > export enum CompletionTriggerKind {
76 > Invoke = 0,
77 > TriggerCharacter = 1,
78 > TriggerForIncompleteCompletions = 2
79 > }
80 >
81 > /**
82 > * A positioning preference for rendering content widgets.
83 > */
84 > export enum ContentWidgetPositionPreference {
85 > /**
86 > * Place the content widget exactly at a position
87 > */
88 > EXACT = 0,
89 > /**
90 > * Place the content widget above a position
91 > */
92 > ABOVE = 1,
93 > /**
94 > * Place the content widget below a position
95 > */
96 > BELOW = 2
97 > }
98 >
99 > /**
100 > * Describes the reason the cursor has changed its position.
101 > */
102 > export enum CursorChangeReason {
103 > /**
104 > * Unknown or not set.
105 > */
106 > NotSet = 0,
107 > /**
108 > * A `model.setValue()` was called.
109 > */
110 > ContentFlush = 1,
111 > /**
112 > * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.
113 > */
114 > RecoverFromMarkers = 2,
115 > /**
116 > * There was an explicit user gesture.
117 > */
118 > Explicit = 3,
119 > /**
120 > * There was a Paste.
121 > */
122 > Paste = 4,
123 > /**
124 > * There was an Undo.
125 > */
126 > Undo = 5,
127 > /**
128 > * There was a Redo.
129 > */
130 > Redo = 6
131 > }
132 >
133 > /**
134 > * The default end of line to use when instantiating models.
135 > */
136 > export enum DefaultEndOfLine {
137 > /**
138 > * Use line feed (\n) as the end of line character.
139 > */
140 > LF = 1,
141 > /**
142 > * Use carriage return and line feed (\r\n) as the end of line character.
143 > */
144 > CRLF = 2
145 > }
146 >
147 > /**
148 > * A document highlight kind.
149 > */
150 > export enum DocumentHighlightKind {
151 > /**
152 > * A textual occurrence.
153 > */
154 > Text = 0,
155 > /**
156 > * Read-access of a symbol, like reading a variable.
157 > */
158 > Read = 1,
159 > /**
160 > * Write-access of a symbol, like writing to a variable.
161 > */
162 > Write = 2
163 > }
164 >
165 > /**
166 > * Configuration options for auto indentation in the editor
167 > */
168 > export enum EditorAutoIndentStrategy {
169 > None = 0,
170 > Keep = 1,
171 > Brackets = 2,
172 > Advanced = 3,
173 > Full = 4
174 > }
175 >
176 > export enum EditorOption {
177 > acceptSuggestionOnCommitCharacter = 0,
178 > acceptSuggestionOnEnter = 1,
179 > accessibilitySupport = 2,
180 > accessibilityPageSize = 3,
181 > allowOverflow = 4,
182 > allowVariableLineHeights = 5,
183 > allowVariableFonts = 6,
184 > allowVariableFontsInAccessibilityMode = 7,
185 > ariaLabel = 8,
186 > ariaRequired = 9,
187 > autoClosingBrackets = 10,
188 > autoClosingComments = 11,
189 > screenReaderAnnounceInlineSuggestion = 12,
190 > autoClosingDelete = 13,
191 > autoClosingOvertype = 14,
192 > autoClosingQuotes = 15,
193 > autoIndent = 16,
194 > autoIndentOnPaste = 17,
195 > autoIndentOnPasteWithinString = 18,
196 > automaticLayout = 19,
197 > autoSurround = 20,
198 > bracketPairColorization = 21,
199 > guides = 22,
200 > codeLens = 23,
201 > codeLensFontFamily = 24,
202 > codeLensFontSize = 25,
203 > colorDecorators = 26,
204 > colorDecoratorsLimit = 27,
205 > columnSelection = 28,
206 > comments = 29,
207 > contextmenu = 30,
208 > copyWithSyntaxHighlighting = 31,
209 > cursorBlinking = 32,
210 > cursorSmoothCaretAnimation = 33,
211 > cursorStyle = 34,
212 > cursorSurroundingLines = 35,
213 > cursorSurroundingLinesStyle = 36,
214 > cursorWidth = 37,
215 > cursorHeight = 38,
216 > disableLayerHinting = 39,
217 > disableMonospaceOptimizations = 40,
218 > domReadOnly = 41,
219 > dragAndDrop = 42,
220 > dropIntoEditor = 43,
221 > editContext = 44,
222 > emptySelectionClipboard = 45,
223 > experimentalGpuAcceleration = 46,
224 > experimentalWhitespaceRendering = 47,
225 > extraEditorClassName = 48,
226 > fastScrollSensitivity = 49,
227 > find = 50,
228 > fixedOverflowWidgets = 51,
229 > folding = 52,
230 > foldingStrategy = 53,
231 > foldingHighlight = 54,
232 > foldingImportsByDefault = 55,
233 > foldingMaximumRegions = 56,
234 > unfoldOnClickAfterEndOfLine = 57,
235 > fontFamily = 58,
236 > fontInfo = 59,
237 > fontLigatures = 60,
238 > fontSize = 61,
239 > fontWeight = 62,
240 > fontVariations = 63,
241 > formatOnPaste = 64,
242 > formatOnType = 65,
243 > glyphMargin = 66,
244 > gotoLocation = 67,
245 > hideCursorInOverviewRuler = 68,
246 > hover = 69,
247 > inDiffEditor = 70,
248 > inlineSuggest = 71,
249 > letterSpacing = 72,
250 > lightbulb = 73,
251 > lineDecorationsWidth = 74,
252 > lineHeight = 75,
253 > lineNumbers = 76,
254 > lineNumbersMinChars = 77,
255 > linkedEditing = 78,
256 > links = 79,
257 > matchBrackets = 80,
258 > minimap = 81,
259 > mouseStyle = 82,
260 > mouseWheelScrollSensitivity = 83,
261 > mouseWheelZoom = 84,
262 > multiCursorMergeOverlapping = 85,
263 > multiCursorModifier = 86,
264 > mouseMiddleClickAction = 87,
265 > multiCursorPaste = 88,
266 > multiCursorLimit = 89,
267 > occurrencesHighlight = 90,
268 > occurrencesHighlightDelay = 91,
269 > overtypeCursorStyle = 92,
270 > overtypeOnPaste = 93,
271 > overviewRulerBorder = 94,
272 > overviewRulerLanes = 95,
273 > padding = 96,
274 > pasteAs = 97,
275 > parameterHints = 98,
276 > peekWidgetDefaultFocus = 99,
277 > placeholder = 100,
278 > definitionLinkOpensInPeek = 101,
279 > quickSuggestions = 102,
280 > quickSuggestionsDelay = 103,
281 > readOnly = 104,
282 > readOnlyMessage = 105,
283 > renameOnType = 106,
284 > renderRichScreenReaderContent = 107,
285 > renderControlCharacters = 108,
286 > renderFinalNewline = 109,
287 > renderLineHighlight = 110,
288 > renderLineHighlightOnlyWhenFocus = 111,
289 > renderValidationDecorations = 112,
290 > renderWhitespace = 113,
291 > revealHorizontalRightPadding = 114,
292 > roundedSelection = 115,
293 > rulers = 116,
294 > scrollbar = 117,
295 > scrollBeyondLastColumn = 118,
296 > scrollBeyondLastLine = 119,
297 > scrollPredominantAxis = 120,
298 > selectionClipboard = 121,
299 > selectionHighlight = 122,
300 > selectionHighlightMaxLength = 123,
301 > selectionHighlightMultiline = 124,
302 > selectOnLineNumbers = 125,
303 > showFoldingControls = 126,
304 > showUnused = 127,
305 > snippetSuggestions = 128,
306 > smartSelect = 129,
307 > smoothScrolling = 130,
308 > stickyScroll = 131,
309 > stickyTabStops = 132,
310 > stopRenderingLineAfter = 133,
311 > suggest = 134,
312 > suggestFontSize = 135,
313 > suggestLineHeight = 136,
314 > suggestOnTriggerCharacters = 137,
315 > suggestSelection = 138,
316 > tabCompletion = 139,
317 > tabIndex = 140,
318 > trimWhitespaceOnDelete = 141,
319 > unicodeHighlighting = 142,
320 > unusualLineTerminators = 143,
321 > useShadowDOM = 144,
322 > useTabStops = 145,
323 > wordBreak = 146,
324 > wordSegmenterLocales = 147,
325 > wordSeparators = 148,
326 > wordWrap = 149,
327 > wordWrapBreakAfterCharacters = 150,
328 > wordWrapBreakBeforeCharacters = 151,
329 > wordWrapColumn = 152,
330 > wordWrapOverride1 = 153,
331 > wordWrapOverride2 = 154,
332 > wrappingIndent = 155,
333 > wrappingStrategy = 156,
334 > showDeprecated = 157,
335 > inertialScroll = 158,
336 > inlayHints = 159,
337 > wrapOnEscapedLineFeeds = 160,
338 > effectiveCursorStyle = 161,
339 > editorClassName = 162,
340 > pixelRatio = 163,
341 > tabFocusMode = 164,
342 > layoutInfo = 165,
343 > wrappingInfo = 166,
344 > defaultColorDecorators = 167,
345 > colorDecoratorsActivatedOn = 168,
346 > inlineCompletionsAccessibilityVerbose = 169,
347 > effectiveEditContext = 170,
348 > scrollOnMiddleClick = 171,
349 > effectiveAllowVariableFonts = 172,
350 > doubleClickSelectsBlock = 173
351 > }
352 >
353 > /**
354 > * End of line character preference.
355 > */
356 > export enum EndOfLinePreference {
357 > /**
358 > * Use the end of line character identified in the text buffer.
359 > */
360 > TextDefined = 0,
361 > /**
362 > * Use line feed (\n) as the end of line character.
363 > */
364 > LF = 1,
365 > /**
366 > * Use carriage return and line feed (\r\n) as the end of line character.
367 > */
368 > CRLF = 2
369 > }
370 >
371 > /**
372 > * End of line character preference.
373 > */
374 > export enum EndOfLineSequence {
375 > /**
376 > * Use line feed (\n) as the end of line character.
377 > */
378 > LF = 0,
379 > /**
380 > * Use carriage return and line feed (\r\n) as the end of line character.
381 > */
382 > CRLF = 1
383 > }
384 >
385 > /**
386 > * Vertical Lane in the glyph margin of the editor.
387 > */
388 > export enum GlyphMarginLane {
389 > Left = 1,
390 > Center = 2,
391 > Right = 3
392 > }
393 >
394 > export enum HoverVerbosityAction {
395 > /**
396 > * Increase the verbosity of the hover
397 > */
398 > Increase = 0,
399 > /**
400 > * Decrease the verbosity of the hover
401 > */
402 > Decrease = 1
403 > }
404 >
405 > /**
406 > * Describes what to do with the indentation when pressing Enter.
407 > */
408 > export enum IndentAction {
409 > /**
410 > * Insert new line and copy the previous line's indentation.
411 > */
412 > None = 0,
413 > /**
414 > * Insert new line and indent once (relative to the previous line's indentation).
415 > */
416 > Indent = 1,
417 > /**
418 > * Insert two new lines:
419 > * - the first one indented which will hold the cursor
420 > * - the second one at the same indentation level
421 > */
422 > IndentOutdent = 2,
423 > /**
424 > * Insert new line and outdent once (relative to the previous line's indentation).
425 > */
426 > Outdent = 3
427 > }
428 >
429 > export enum InjectedTextCursorStops {
430 > Both = 0,
431 > Right = 1,
432 > Left = 2,
433 > None = 3
434 > }
435 >
436 > export enum InlayHintKind {
437 > Type = 1,
438 > Parameter = 2
439 > }
440 >
441 > export enum InlineCompletionEndOfLifeReasonKind {
442 > Accepted = 0,
443 > Rejected = 1,
444 > Ignored = 2
445 > }
446 >
447 > export enum InlineCompletionHintStyle {
448 > Code = 1,
449 > Label = 2
450 > }
451 >
452 > /**
453 > * How an {@link InlineCompletionsProvider inline completion provider} was triggered.
454 > */
455 > export enum InlineCompletionTriggerKind {
456 > /**
457 > * Completion was triggered automatically while editing.
458 > * It is sufficient to return a single completion item in this case.
459 > */
460 > Automatic = 0,
461 > /**
462 > * Completion was triggered explicitly by a user gesture.
463 > * Return multiple completion items to enable cycling through them.
464 > */
465 > Explicit = 1
466 > }
467 > /**
468 > * Virtual Key Codes, the value does not hold any inherent meaning.
469 > * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
470 > * But these are "more general", as they should work across browsers & OS`s.
471 > */
472 > export enum KeyCode {
473 > DependsOnKbLayout = -1,
474 > /**
475 > * Placed first to cover the 0 value of the enum.
476 > */
477 > Unknown = 0,
478 > Backspace = 1,
479 > Tab = 2,
480 > Enter = 3,
481 > Shift = 4,
482 > Ctrl = 5,
483 > Alt = 6,
484 > PauseBreak = 7,
485 > CapsLock = 8,
486 > Escape = 9,
487 > Space = 10,
488 > PageUp = 11,
489 > PageDown = 12,
490 > End = 13,
491 > Home = 14,
492 > LeftArrow = 15,
493 > UpArrow = 16,
494 > RightArrow = 17,
495 > DownArrow = 18,
496 > Insert = 19,
497 > Delete = 20,
498 > Digit0 = 21,
499 > Digit1 = 22,
500 > Digit2 = 23,
501 > Digit3 = 24,
502 > Digit4 = 25,
503 > Digit5 = 26,
504 > Digit6 = 27,
505 > Digit7 = 28,
506 > Digit8 = 29,
507 > Digit9 = 30,
508 > KeyA = 31,
509 > KeyB = 32,
510 > KeyC = 33,
511 > KeyD = 34,
512 > KeyE = 35,
513 > KeyF = 36,
514 > KeyG = 37,
515 > KeyH = 38,
516 > KeyI = 39,
517 > KeyJ = 40,
518 > KeyK = 41,
519 > KeyL = 42,
520 > KeyM = 43,
521 > KeyN = 44,
522 > KeyO = 45,
523 > KeyP = 46,
524 > KeyQ = 47,
525 > KeyR = 48,
526 > KeyS = 49,
527 > KeyT = 50,
528 > KeyU = 51,
529 > KeyV = 52,
530 > KeyW = 53,
531 > KeyX = 54,
532 > KeyY = 55,
533 > KeyZ = 56,
534 > Meta = 57,
535 > ContextMenu = 58,
536 > F1 = 59,
537 > F2 = 60,
538 > F3 = 61,
539 > F4 = 62,
540 > F5 = 63,
541 > F6 = 64,
542 > F7 = 65,
543 > F8 = 66,
544 > F9 = 67,
545 > F10 = 68,
546 > F11 = 69,
547 > F12 = 70,
548 > F13 = 71,
549 > F14 = 72,
550 > F15 = 73,
551 > F16 = 74,
552 > F17 = 75,
553 > F18 = 76,
554 > F19 = 77,
555 > F20 = 78,
556 > F21 = 79,
557 > F22 = 80,
558 > F23 = 81,
559 > F24 = 82,
560 > NumLock = 83,
561 > ScrollLock = 84,
562 > /**
563 > * Used for miscellaneous characters; it can vary by keyboard.
564 > * For the US standard keyboard, the ';:' key
565 > */
566 > Semicolon = 85,
567 > /**
568 > * For any country/region, the '+' key
569 > * For the US standard keyboard, the '=+' key
570 > */
571 > Equal = 86,
572 > /**
573 > * For any country/region, the ',' key
574 > * For the US standard keyboard, the ',<' key
575 > */
576 > Comma = 87,
577 > /**
578 > * For any country/region, the '-' key
579 > * For the US standard keyboard, the '-_' key
580 > */
581 > Minus = 88,
582 > /**
583 > * For any country/region, the '.' key
584 > * For the US standard keyboard, the '.>' key
585 > */
586 > Period = 89,
587 > /**
588 > * Used for miscellaneous characters; it can vary by keyboard.
589 > * For the US standard keyboard, the '/?' key
590 > */
591 > Slash = 90,
592 > /**
593 > * Used for miscellaneous characters; it can vary by keyboard.
594 > * For the US standard keyboard, the '`~' key
595 > */
596 > Backquote = 91,
597 > /**
598 > * Used for miscellaneous characters; it can vary by keyboard.
599 > * For the US standard keyboard, the '[{' key
600 > */
601 > BracketLeft = 92,
602 > /**
603 > * Used for miscellaneous characters; it can vary by keyboard.
604 > * For the US standard keyboard, the '\|' key
605 > */
606 > Backslash = 93,
607 > /**
608 > * Used for miscellaneous characters; it can vary by keyboard.
609 > * For the US standard keyboard, the ']}' key
610 > */
611 > BracketRight = 94,
612 > /**
613 > * Used for miscellaneous characters; it can vary by keyboard.
614 > * For the US standard keyboard, the ''"' key
615 > */
616 > Quote = 95,
617 > /**
618 > * Used for miscellaneous characters; it can vary by keyboard.
619 > */
620 > OEM_8 = 96,
621 > /**
622 > * Either the angle bracket key or the backslash key on the RT 102-key keyboard.
623 > */
624 > IntlBackslash = 97,
625 > Numpad0 = 98,// VK_NUMPAD0, 0x60, Numeric keypad 0 key
626 > Numpad1 = 99,// VK_NUMPAD1, 0x61, Numeric keypad 1 key
627 > Numpad2 = 100,// VK_NUMPAD2, 0x62, Numeric keypad 2 key
628 > Numpad3 = 101,// VK_NUMPAD3, 0x63, Numeric keypad 3 key
629 > Numpad4 = 102,// VK_NUMPAD4, 0x64, Numeric keypad 4 key
630 > Numpad5 = 103,// VK_NUMPAD5, 0x65, Numeric keypad 5 key
631 > Numpad6 = 104,// VK_NUMPAD6, 0x66, Numeric keypad 6 key
632 > Numpad7 = 105,// VK_NUMPAD7, 0x67, Numeric keypad 7 key
633 > Numpad8 = 106,// VK_NUMPAD8, 0x68, Numeric keypad 8 key
634 > Numpad9 = 107,// VK_NUMPAD9, 0x69, Numeric keypad 9 key
635 > NumpadMultiply = 108,// VK_MULTIPLY, 0x6A, Multiply key
636 > NumpadAdd = 109,// VK_ADD, 0x6B, Add key
637 > NUMPAD_SEPARATOR = 110,// VK_SEPARATOR, 0x6C, Separator key
638 > NumpadSubtract = 111,// VK_SUBTRACT, 0x6D, Subtract key
639 > NumpadDecimal = 112,// VK_DECIMAL, 0x6E, Decimal key
640 > NumpadDivide = 113,// VK_DIVIDE, 0x6F,
641 > /**
642 > * Cover all key codes when IME is processing input.
643 > */
644 > KEY_IN_COMPOSITION = 114,
645 > ABNT_C1 = 115,// Brazilian (ABNT) Keyboard
646 > ABNT_C2 = 116,// Brazilian (ABNT) Keyboard
647 > AudioVolumeMute = 117,
648 > AudioVolumeUp = 118,
649 > AudioVolumeDown = 119,
650 > BrowserSearch = 120,
651 > BrowserHome = 121,
652 > BrowserBack = 122,
653 > BrowserForward = 123,
654 > MediaTrackNext = 124,
655 > MediaTrackPrevious = 125,
656 > MediaStop = 126,
657 > MediaPlayPause = 127,
658 > LaunchMediaPlayer = 128,
659 > LaunchMail = 129,
660 > LaunchApp2 = 130,
661 > /**
662 > * VK_CLEAR, 0x0C, CLEAR key
663 > */
664 > Clear = 131,
665 > /**
666 > * Placed last to cover the length of the enum.
667 > * Please do not depend on this value!
668 > */
669 > MAX_VALUE = 132
670 > }
671 >
672 > export enum MarkerSeverity {
673 > Hint = 1,
674 > Info = 2,
675 > Warning = 4,
676 > Error = 8
677 > }
678 >
679 > export enum MarkerTag {
680 > Unnecessary = 1,
681 > Deprecated = 2
682 > }
683 >
684 > /**
685 > * Position in the minimap to render the decoration.
686 > */
687 > export enum MinimapPosition {
688 > Inline = 1,
689 > Gutter = 2
690 > }
691 >
692 > /**
693 > * Section header style.
694 > */
695 > export enum MinimapSectionHeaderStyle {
696 > Normal = 1,
697 > Underlined = 2
698 > }
699 >
700 > /**
701 > * Type of hit element with the mouse in the editor.
702 > */
703 > export enum MouseTargetType {
704 > /**
705 > * Mouse is on top of an unknown element.
706 > */
707 > UNKNOWN = 0,
708 > /**
709 > * Mouse is on top of the textarea used for input.
710 > */
711 > TEXTAREA = 1,
712 > /**
713 > * Mouse is on top of the glyph margin
714 > */
715 > GUTTER_GLYPH_MARGIN = 2,
716 > /**
717 > * Mouse is on top of the line numbers
718 > */
719 > GUTTER_LINE_NUMBERS = 3,
720 > /**
721 > * Mouse is on top of the line decorations
722 > */
723 > GUTTER_LINE_DECORATIONS = 4,
724 > /**
725 > * Mouse is on top of the whitespace left in the gutter by a view zone.
726 > */
727 > GUTTER_VIEW_ZONE = 5,
728 > /**
729 > * Mouse is on top of text in the content.
730 > */
731 > CONTENT_TEXT = 6,
732 > /**
733 > * Mouse is on top of empty space in the content (e.g. after line text or below last line)
734 > */
735 > CONTENT_EMPTY = 7,
736 > /**
737 > * Mouse is on top of a view zone in the content.
738 > */
739 > CONTENT_VIEW_ZONE = 8,
740 > /**
741 > * Mouse is on top of a content widget.
742 > */
743 > CONTENT_WIDGET = 9,
744 > /**
745 > * Mouse is on top of the decorations overview ruler.
746 > */
747 > OVERVIEW_RULER = 10,
748 > /**
749 > * Mouse is on top of a scrollbar.
750 > */
751 > SCROLLBAR = 11,
752 > /**
753 > * Mouse is on top of an overlay widget.
754 > */
755 > OVERLAY_WIDGET = 12,
756 > /**
757 > * Mouse is outside of the editor.
758 > */
759 > OUTSIDE_EDITOR = 13
760 > }
761 >
762 > export enum NewSymbolNameTag {
763 > AIGenerated = 1
764 > }
765 >
766 > export enum NewSymbolNameTriggerKind {
767 > Invoke = 0,
768 > Automatic = 1
769 > }
770 >
771 > /**
772 > * A positioning preference for rendering overlay widgets.
773 > */
774 > export enum OverlayWidgetPositionPreference {
775 > /**
776 > * Position the overlay widget in the top right corner
777 > */
778 > TOP_RIGHT_CORNER = 0,
779 > /**
780 > * Position the overlay widget in the bottom right corner
781 > */
782 > BOTTOM_RIGHT_CORNER = 1,
783 > /**
784 > * Position the overlay widget in the top center
785 > */
786 > TOP_CENTER = 2
787 > }
788 >
789 > /**
790 > * Vertical Lane in the overview ruler of the editor.
791 > */
792 > export enum OverviewRulerLane {
793 > Left = 1,
794 > Center = 2,
795 > Right = 4,
796 > Full = 7
797 > }
798 >
799 > /**
800 > * How a partial acceptance was triggered.
801 > */
802 > export enum PartialAcceptTriggerKind {
803 > Word = 0,
804 > Line = 1,
805 > Suggest = 2
806 > }
807 >
808 > export enum PositionAffinity {
809 > /**
810 > * Prefers the left most position.
811 > */
812 > Left = 0,
813 > /**
814 > * Prefers the right most position.
815 > */
816 > Right = 1,
817 > /**
818 > * No preference.
819 > */
820 > None = 2,
821 > /**
822 > * If the given position is on injected text, prefers the position left of it.
823 > */
824 > LeftOfInjectedText = 3,
825 > /**
826 > * If the given position is on injected text, prefers the position right of it.
827 > */
828 > RightOfInjectedText = 4
829 > }
830 >
831 > export enum RenderLineNumbersType {
832 > Off = 0,
833 > On = 1,
834 > Relative = 2,
835 > Interval = 3,
836 > Custom = 4
837 > }
838 >
839 > export enum RenderMinimap {
840 > None = 0,
841 > Text = 1,
842 > Blocks = 2
843 > }
844 >
845 > export enum ScrollType {
846 > Smooth = 0,
847 > Immediate = 1
848 > }
849 >
850 > export enum ScrollbarVisibility {
851 > Auto = 1,
852 > Hidden = 2,
853 > Visible = 3
854 > }
855 >
856 > /**
857 > * The direction of a selection.
858 > */
859 > export enum SelectionDirection {
860 > /**
861 > * The selection starts above where it ends.
862 > */
863 > LTR = 0,
864 > /**
865 > * The selection starts below where it ends.
866 > */
867 > RTL = 1
868 > }
869 >
870 > export enum ShowLightbulbIconMode {
871 > Off = 'off',
872 > OnCode = 'onCode',
873 > On = 'on'
874 > }
875 >
876 > export enum SignatureHelpTriggerKind {
877 > Invoke = 1,
878 > TriggerCharacter = 2,
879 > ContentChange = 3
880 > }
881 >
882 > /**
883 > * A symbol kind.
884 > */
885 > export enum SymbolKind {
886 > File = 0,
887 > Module = 1,
888 > Namespace = 2,
889 > Package = 3,
890 > Class = 4,
891 > Method = 5,
892 > Property = 6,
893 > Field = 7,
894 > Constructor = 8,
895 > Enum = 9,
896 > Interface = 10,
897 > Function = 11,
898 > Variable = 12,
899 > Constant = 13,
900 > String = 14,
901 > Number = 15,
902 > Boolean = 16,
903 > Array = 17,
904 > Object = 18,
905 > Key = 19,
906 > Null = 20,
907 > EnumMember = 21,
908 > Struct = 22,
909 > Event = 23,
910 > Operator = 24,
911 > TypeParameter = 25
912 > }
913 >
914 > export enum SymbolTag {
915 > Deprecated = 1
916 > }
917 >
918 > /**
919 > * Text Direction for a decoration.
920 > */
921 > export enum TextDirection {
922 > LTR = 0,
923 > RTL = 1
924 > }
925 >
926 > /**
927 > * The kind of animation in which the editor's cursor should be rendered.
928 > */
929 > export enum TextEditorCursorBlinkingStyle {
930 > /**
931 > * Hidden
932 > */
933 > Hidden = 0,
934 > /**
935 > * Blinking
936 > */
937 > Blink = 1,
938 > /**
939 > * Blinking with smooth fading
940 > */
941 > Smooth = 2,
942 > /**
943 > * Blinking with prolonged filled state and smooth fading
944 > */
945 > Phase = 3,
946 > /**
947 > * Expand collapse animation on the y axis
948 > */
949 > Expand = 4,
950 > /**
951 > * No-Blinking
952 > */
953 > Solid = 5
954 > }
955 >
956 > /**
957 > * The style in which the editor's cursor should be rendered.
958 > */
959 > export enum TextEditorCursorStyle {
960 > /**
961 > * As a vertical line (sitting between two characters).
962 > */
963 > Line = 1,
964 > /**
965 > * As a block (sitting on top of a character).
966 > */
967 > Block = 2,
968 > /**
969 > * As a horizontal line (sitting under a character).
970 > */
971 > Underline = 3,
972 > /**
973 > * As a thin vertical line (sitting between two characters).
974 > */
975 > LineThin = 4,
976 > /**
977 > * As an outlined block (sitting on top of a character).
978 > */
979 > BlockOutline = 5,
980 > /**
981 > * As a thin horizontal line (sitting under a character).
982 > */
983 > UnderlineThin = 6
984 > }
985 >
986 > /**
987 > * Describes the behavior of decorations when typing/editing near their edges.
988 > * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
989 > */
990 > export enum TrackedRangeStickiness {
991 > AlwaysGrowsWhenTypingAtEdges = 0,
992 > NeverGrowsWhenTypingAtEdges = 1,
993 > GrowsOnlyWhenTypingBefore = 2,
994 > GrowsOnlyWhenTypingAfter = 3
995 > }
996 >
997 > /**
998 > * Describes how to indent wrapped lines.
999 > */
1000 > export enum WrappingIndent {
1001 > /**
1002 > * No indentation => wrapped lines begin at column 1.
1003 > */
1004 > None = 0,
1005 > /**
1006 > * Same => wrapped lines get the same indentation as the parent.
1007 > */
1008 > Same = 1,
1009 > /**
1010 > * Indent => wrapped lines get +1 indentation toward the parent.
1011 > */
1012 > Indent = 2,
1013 > /**
1014 > * DeepIndent => wrapped lines get +2 indentation toward the parent.
1015 > */
1016 > DeepIndent = 3
1017 > }
src/vs/editor/common/services/editorWebWorker.ts 165 introduced LOC · 23 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- editorWebWorker.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { stringDiff } from '../../../base/common/diff/diff.js';
7 > import { IDisposable } from '../../../base/common/lifecycle.js';
8 > import { URI } from '../../../base/common/uri.js';
9 > import { IWebWorkerServerRequestHandler } from '../../../base/common/worker/webWorker.js';
10 > import { Position } from '../core/position.js';
11 > import { IRange, Range } from '../core/range.js';
12 > import { EndOfLineSequence, ITextModel } from '../model.js';
13 > import { IMirrorTextModel, IModelChangedEvent } from '../model/mirrorTextModel.js';
14 > import { IColorInformation, IInplaceReplaceSupportResult, ILink, TextEdit } from '../languages.js';
15 > import { computeLinks } from '../languages/linkComputer.js';
16 > import { BasicInplaceReplace } from '../languages/supports/inplaceReplaceSupport.js';
17 > import { DiffAlgorithmName, IDiffComputationResult, ILineChange, IUnicodeHighlightsResult } from './editorWorker.js';
18 > import { createMonacoBaseAPI } from './editorBaseApi.js';
19 > import { StopWatch } from '../../../base/common/stopwatch.js';
20 > import { UnicodeTextModelHighlighter, UnicodeHighlighterOptions } from './unicodeTextModelHighlighter.js';
21 > import { DiffComputer, IChange } from '../diff/legacyLinesDiffComputer.js';
22 > import { ILinesDiffComputer, ILinesDiffComputerOptions } from '../diff/linesDiffComputer.js';
23 > import { DetailedLineRangeMapping } from '../diff/rangeMapping.js';
24 > import { linesDiffComputers } from '../diff/linesDiffComputers.js';
25 > import { IDocumentDiffProviderOptions } from '../diff/documentDiffProvider.js';
26 > import { BugIndicatingError } from '../../../base/common/errors.js';
27 > import { computeDefaultDocumentColors } from '../languages/defaultDocumentColorsComputer.js';
28 > import { FindSectionHeaderOptions, SectionHeader, findSectionHeaders } from './findSectionHeaders.js';
29 > import { IRawModelData, IWorkerTextModelSyncChannelServer } from './textModelSync/textModelSync.protocol.js';
30 > import { ICommonModel, WorkerTextModelSyncServer } from './textModelSync/textModelSync.impl.js';
31 > import { ISerializedStringEdit, StringEdit } from '../core/edits/stringEdit.js';
32 > import { StringText } from '../core/text/abstractText.js';
33 > import { ensureDependenciesAreSet } from '../core/text/positionToOffset.js';
34 >
35 > export interface IMirrorModel extends IMirrorTextModel {
36 > readonly uri: URI;
37 > readonly version: number;
38 > getValue(): string;
39 > }
40 >
41 > export interface IWorkerContext<H = {}> {
42 > /**
43 > * A proxy to the main thread host object.
44 > */
45 > host: H;
46 > /**
47 > * Get all available mirror models in this worker.
48 > */
49 > getMirrorModels(): IMirrorModel[];
50 > }
51 >
52 > /**
53 > * Range of a word inside a model.
54 > * @internal
55 > */
56 > export interface IWordRange {
57 > /**
58 > * The index where the word starts.
59 > */
60 > readonly start: number;
61 > /**
62 > * The index where the word ends.
63 > */
64 > readonly end: number;
65 > }
66 >
67 > /**
68 > * @internal
69 > */
70 > export class EditorWorker implements IDisposable, IWorkerTextModelSyncChannelServer, IWebWorkerServerRequestHandler {
71 > _requestHandlerBrand: void = undefined;
72 >
73 > private readonly _workerTextModelSyncServer = new WorkerTextModelSyncServer();
74 >
75 > constructor(
76 > private readonly _foreignModule: unknown | null = null
77 > ) { }
78 >
79 > dispose(): void {
80 }
82 > public async $ping() {
83 return 'pong';
84 }
86 > protected _getModel(uri: string): ICommonModel | undefined {
87 > return this._workerTextModelSyncServer.getModel(uri);
88 > }
89 >
90 > public getModels(): ICommonModel[] {
91 return this._workerTextModelSyncServer.getModels();
92 }
94 > public $acceptNewModel(data: IRawModelData): void {
95 > this._workerTextModelSyncServer.$acceptNewModel(data);
96 > }
97 >
98 > public $acceptModelChanged(uri: string, e: IModelChangedEvent): void {
99 this._workerTextModelSyncServer.$acceptModelChanged(uri, e);
100 }
102 > public $acceptRemovedModel(uri: string): void {
103 this._workerTextModelSyncServer.$acceptRemovedModel(uri);
104 }
106 > public async $computeUnicodeHighlights(url: string, options: UnicodeHighlighterOptions, range?: IRange): Promise<IUnicodeHighlightsResult> {
107 const model = this._getModel(url);
108 if (!model) {
111 return UnicodeTextModelHighlighter.computeUnicodeHighlights(model, options, range);
112 }
114 > public async $findSectionHeaders(url: string, options: FindSectionHeaderOptions): Promise<SectionHeader[]> {
115 const model = this._getModel(url);
116 if (!model) {
119 return findSectionHeaders(model, options);
120 }
122 > // ---- BEGIN diff --------------------------------------------------------------------------
123 >
124 > public async $computeDiff(originalUrl: string, modifiedUrl: string, options: IDocumentDiffProviderOptions, algorithm: DiffAlgorithmName): Promise<IDiffComputationResult | null> {
125 const original = this._getModel(originalUrl);
126 const modified = this._getModel(modifiedUrl);
133 return result;
134 }
136 > private static computeDiff(originalTextModel: ICommonModel | ITextModel, modifiedTextModel: ICommonModel | ITextModel, options: IDocumentDiffProviderOptions, diffAlgorithm: ILinesDiffComputer): IDiffComputationResult {
137
138 const originalLines = originalTextModel.getLinesContent();
169 };
170 }
172 > private static _modelsAreIdentical(original: ICommonModel | ITextModel, modified: ICommonModel | ITextModel): boolean {
173 const originalLineCount = original.getLineCount();
174 const modifiedLineCount = modified.getLineCount();
185 return true;
186 }
188 > public async $computeDirtyDiff(originalUrl: string, modifiedUrl: string, ignoreTrimWhitespace: boolean): Promise<IChange[] | null> {
189 const original = this._getModel(originalUrl);
190 const modified = this._getModel(modifiedUrl);
204 return diffComputer.computeDiff().changes;
205 }
207 > public async $computeStringDiff(original: string, modified: string, options: { maxComputationTimeMs: number }, algorithm: DiffAlgorithmName): Promise<ISerializedStringEdit> {
208 return (await computeStringDiff(original, modified, options, algorithm)).toJson();
209 }
211 > // ---- END diff --------------------------------------------------------------------------
212 >
213 >
214 > // ---- BEGIN minimal edits ---------------------------------------------------------------
215 >
216 > private static readonly _diffLimit = 100000;
217 >
218 > public async $computeMoreMinimalEdits(modelUrl: string, edits: TextEdit[], pretty: boolean): Promise<TextEdit[]> {
219 const model = this._getModel(modelUrl);
220 if (!model) {
297 return result;
298 }
300 > public $computeHumanReadableDiff(modelUrl: string, edits: TextEdit[], options: ILinesDiffComputerOptions): TextEdit[] {
301 const model = this._getModel(modelUrl);
302 if (!model) {
395 return result;
396 }
398 > // ---- END minimal edits ---------------------------------------------------------------
399 >
400 > public async $computeLinks(modelUrl: string): Promise<ILink[] | null> {
401 const model = this._getModel(modelUrl);
402 if (!model) {
406 return computeLinks(model);
407 }
409 > // --- BEGIN default document colors -----------------------------------------------------------
410 >
411 > public async $computeDefaultDocumentColors(modelUrl: string): Promise<IColorInformation[] | null> {
412 const model = this._getModel(modelUrl);
413 if (!model) {
416 return computeDefaultDocumentColors(model);
417 }
419 > // ---- BEGIN suggest --------------------------------------------------------------------------
420 >
421 > private static readonly _suggestionsLimit = 10000;
422 >
423 > public async $textualSuggest(modelUrls: string[], leadingWord: string | undefined, wordDef: string, wordDefFlags: string): Promise<{ words: string[]; duration: number } | null> {
424
425 const sw = new StopWatch();
446 return { words: Array.from(seen), duration: sw.elapsed() };
447 }
449 >
450 > // ---- END suggest --------------------------------------------------------------------------
451 >
452 > //#region -- word ranges --
453 >
454 > public async $computeWordRanges(modelUrl: string, range: IRange, wordDef: string, wordDefFlags: string): Promise<{ [word: string]: IRange[] }> {
455 const model = this._getModel(modelUrl);
456 if (!model) {
480 return result;
481 }
483 > //#endregion
484 >
485 > public async $navigateValueSet(modelUrl: string, range: IRange, up: boolean, wordDef: string, wordDefFlags: string): Promise<IInplaceReplaceSupportResult | null> {
486 const model = this._getModel(modelUrl);
487 if (!model) {
510 return result;
511 }
513 > // ---- BEGIN foreign module support --------------------------------------------------------------------------
514 >
515 > // foreign method request
516 > public $fmr(method: string, args: unknown[]): Promise<unknown> {
517 if (!this._foreignModule || typeof (this._foreignModule as Record<string, unknown>)[method] !== 'function') {
518 return Promise.reject(new Error('Missing requestHandler or method: ' + method));
525 }
526 }
528 > // ---- END foreign module support --------------------------------------------------------------------------
529 > }
530 >
531 > // This is only available in a Web Worker
532 > declare function importScripts(...urls: string[]): void;
533 >
534 > if (typeof importScripts === 'function') {
535 // Running in a web worker
536 globalThis.monaco = createMonacoBaseAPI();
537 }
539 function resolveLinesDiffComputer(algorithm: DiffAlgorithmName): ILinesDiffComputer | Promise<ILinesDiffComputer> {
540 switch (algorithm) {
545 }
546 }
548 > /**
549 > * @internal
550 > */
551 export async function computeStringDiff(original: string, modified: string, options: { maxComputationTimeMs: number }, algorithm: DiffAlgorithmName): Promise<StringEdit> {
552 const diffAlgorithm = await resolveLinesDiffComputer(algorithm);
src/vs/editor/common/services/textModelSync/textModelSync.impl.ts 134 introduced LOC · 28 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- textModelSync.impl.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { IntervalTimer } from '../../../../base/common/async.js';
7 > import { Disposable, DisposableStore, dispose, IDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
8 > import { URI } from '../../../../base/common/uri.js';
9 > import { IWebWorkerClient, IWebWorkerServer } from '../../../../base/common/worker/webWorker.js';
10 > import { IPosition, Position } from '../../core/position.js';
11 > import { IRange, Range } from '../../core/range.js';
12 > import { ensureValidWordDefinition, getWordAtText, IWordAtPosition } from '../../core/wordHelper.js';
13 > import { IDocumentColorComputerTarget } from '../../languages/defaultDocumentColorsComputer.js';
14 > import { ILinkComputerTarget } from '../../languages/linkComputer.js';
15 > import { MirrorTextModel as BaseMirrorModel, IModelChangedEvent } from '../../model/mirrorTextModel.js';
16 > import { IMirrorModel, IWordRange } from '../editorWebWorker.js';
17 > import { IModelService } from '../model.js';
18 > import { IRawModelData, IWorkerTextModelSyncChannelServer } from './textModelSync.protocol.js';
19 >
20 > /**
21 > * Stop syncing a model to the worker if it was not needed for 1 min.
22 > */
23 > export const STOP_SYNC_MODEL_DELTA_TIME_MS = 60 * 1000;
24 >
25 > export const WORKER_TEXT_MODEL_SYNC_CHANNEL = 'workerTextModelSync';
26 >
27 > export class WorkerTextModelSyncClient extends Disposable {
28 >
29 > public static create(workerClient: IWebWorkerClient<unknown>, modelService: IModelService): WorkerTextModelSyncClient {
30 > return new WorkerTextModelSyncClient(
31 > workerClient.getChannel<IWorkerTextModelSyncChannelServer>(WORKER_TEXT_MODEL_SYNC_CHANNEL),
32 > modelService
33 > );
34 > }
35 >
36 > private readonly _proxy: IWorkerTextModelSyncChannelServer;
37 > private readonly _modelService: IModelService;
38 > private _syncedModels: { [modelUrl: string]: IDisposable } = Object.create(null);
39 > private _syncedModelsLastUsedTime: { [modelUrl: string]: number } = Object.create(null);
40 >
41 > constructor(proxy: IWorkerTextModelSyncChannelServer, modelService: IModelService, keepIdleModels: boolean = false) {
42 super();
43 this._proxy = proxy;
50 }
51 }
53 > public override dispose(): void {
54 for (const modelUrl in this._syncedModels) {
55 dispose(this._syncedModels[modelUrl]);
59 super.dispose();
60 }
62 > public ensureSyncedResources(resources: URI[], forceLargeModels: boolean = false): void {
63 for (const resource of resources) {
64 const resourceStr = resource.toString();
72 }
73 }
75 > private _checkStopModelSync(): void {
76 const currentTime = (new Date()).getTime();
77
88 }
89 }
91 > private _beginModelSync(resource: URI, forceLargeModels: boolean): void {
92 const model = this._modelService.getModel(resource);
93 if (!model) {
120 this._syncedModels[modelUrl] = toDispose;
121 }
123 > private _stopModelSync(modelUrl: string): void {
124 const toDispose = this._syncedModels[modelUrl];
125 delete this._syncedModels[modelUrl];
127 dispose(toDispose);
128 }
130 >
131 > export class WorkerTextModelSyncServer implements IWorkerTextModelSyncChannelServer {
132 >
133 > private readonly _models: { [uri: string]: MirrorModel };
134 >
135 > constructor() {
136 > this._models = Object.create(null);
137 > }
138 >
139 > public bindToServer(workerServer: IWebWorkerServer): void {
140 workerServer.setChannel(WORKER_TEXT_MODEL_SYNC_CHANNEL, this);
141 }
143 > public getModel(uri: string): ICommonModel | undefined {
144 > return this._models[uri];
145 > }
146 >
147 > public getModels(): ICommonModel[] {
148 const all: MirrorModel[] = [];
149 Object.keys(this._models).forEach((key) => all.push(this._models[key]));
150 return all;
151 }
153 > $acceptNewModel(data: IRawModelData): void {
154 > this._models[data.url] = new MirrorModel(URI.parse(data.url), data.lines, data.EOL, data.versionId);
155 > }
156 >
157 > $acceptModelChanged(uri: string, e: IModelChangedEvent): void {
158 if (!this._models[uri]) {
159 return;
162 model.onEvents(e);
163 }
165 > $acceptRemovedModel(uri: string): void {
166 if (!this._models[uri]) {
167 return;
169 delete this._models[uri];
170 }
172 >
173 > export class MirrorModel extends BaseMirrorModel implements ICommonModel {
174 >
175 > public get uri(): URI {
176 return this._uri;
177 }
179 > public get eol(): string {
180 return this._eol;
181 }
183 > public getValue(): string {
184 return this.getText();
185 }
187 > public findMatches(regex: RegExp): RegExpMatchArray[] {
188 const matches = [];
189 for (let i = 0; i < this._lines.length; i++) {
200 return matches;
201 }
203 > public getLinesContent(): string[] {
204 return this._lines.slice(0);
205 }
207 > public getLineCount(): number {
208 return this._lines.length;
209 }
211 > public getLineContent(lineNumber: number): string {
212 return this._lines[lineNumber - 1];
213 }
215 > public getWordAtPosition(position: IPosition, wordDefinition: RegExp): Range | null {
216
217 const wordAtText = getWordAtText(
228 return null;
229 }
231 > public getWordUntilPosition(position: IPosition, wordDefinition: RegExp): IWordAtPosition {
232 const wordAtPosition = this.getWordAtPosition(position, wordDefinition);
233 if (!wordAtPosition) {
244 };
245 }
247 >
248 > public words(wordDefinition: RegExp): Iterable<string> {
249
250 const lines = this._lines;
277 };
278 }
280 > public getLineWords(lineNumber: number, wordDefinition: RegExp): IWordAtPosition[] {
281 const content = this._lines[lineNumber - 1];
282 const ranges = this._wordenize(content, wordDefinition);
291 return words;
292 }
294 > private _wordenize(content: string, wordDefinition: RegExp): IWordRange[] {
295 const result: IWordRange[] = [];
296 let match: RegExpExecArray | null;
307 return result;
308 }
310 > public getValueInRange(range: IRange): string {
311 range = this._validateRange(range);
312
328 return resultLines.join(lineEnding);
329 }
331 > public offsetAt(position: IPosition): number {
332 position = this._validatePosition(position);
333 this._ensureLineStarts();
334 return this._lineStarts!.getPrefixSum(position.lineNumber - 2) + (position.column - 1);
335 }
337 > public positionAt(offset: number): IPosition {
338 offset = Math.floor(offset);
339 offset = Math.max(0, offset);
349 };
350 }
352 > private _validateRange(range: IRange): IRange {
353
354 const start = this._validatePosition({ lineNumber: range.startLineNumber, column: range.startColumn });
370 return range;
371 }
373 > private _validatePosition(position: IPosition): IPosition {
374 if (!Position.isIPosition(position)) {
375 throw new Error('bad position');
406 }
407 }
409 >
410 > export interface ICommonModel extends ILinkComputerTarget, IDocumentColorComputerTarget, IMirrorModel {
411 > uri: URI;
412 > version: number;
413 > eol: string;
414 > getValue(): string;
415 >
416 > getLinesContent(): string[];
417 > getLineCount(): number;
418 > getLineContent(lineNumber: number): string;
419 > getLineWords(lineNumber: number, wordDefinition: RegExp): IWordAtPosition[];
420 > words(wordDefinition: RegExp): Iterable<string>;
421 > getWordUntilPosition(position: IPosition, wordDefinition: RegExp): IWordAtPosition;
422 > getValueInRange(range: IRange): string;
423 > getWordAtPosition(position: IPosition, wordDefinition: RegExp): Range | null;
424 > offsetAt(position: IPosition): number;
425 > positionAt(offset: number): IPosition;
426 > findMatches(regex: RegExp): RegExpMatchArray[];
427 > }
src/vs/editor/common/languages/supports/inplaceReplaceSupport.ts 31 introduced LOC · 7 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- inplaceReplaceSupport.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { IRange } from '../../core/range.js';
7 > import { IInplaceReplaceSupportResult } from '../../languages.js';
8 >
9 > export class BasicInplaceReplace {
10 >
11 > public static readonly INSTANCE = new BasicInplaceReplace();
12 >
13 > public navigateValueSet(range1: IRange, text1: string, range2: IRange, text2: string | null, up: boolean): IInplaceReplaceSupportResult | null {
14
15 if (range1 && text1) {
35 return null;
36 }
38 > private doNavigateValueSet(text: string, up: boolean): string | null {
39 const numberResult = this.numberReplace(text, up);
40 if (numberResult !== null) {
43 return this.textReplace(text, up);
44 }
46 > private numberReplace(value: string, up: boolean): string | null {
47 const precision = Math.pow(10, value.length - (value.lastIndexOf('.') + 1));
48 let n1 = Number(value);
64 return null;
65 }
67 > private readonly _defaultValueSet: string[][] = [
68 > ['true', 'false'],
69 > ['True', 'False'],
70 > ['Private', 'Public', 'Friend', 'ReadOnly', 'Partial', 'Protected', 'WriteOnly'],
71 > ['public', 'protected', 'private'],
72 > ];
73 >
74 > private textReplace(value: string, up: boolean): string | null {
75 return this.valueSetsReplace(this._defaultValueSet, value, up);
76 }
78 > private valueSetsReplace(valueSets: string[][], value: string, up: boolean): string | null {
79 let result: string | null = null;
80 for (let i = 0, len = valueSets.length; result === null && i < len; i++) {
83 return result;
84 }
86 > private valueSetReplace(valueSet: string[], value: string, up: boolean): string | null {
87 let idx = valueSet.indexOf(value);
88 if (idx >= 0) {
src/vs/editor/common/diff/externalLinesDiffComputer.ts 28 introduced LOC · 5 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- externalLinesDiffComputer.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import type { IDiffComputer as IExternalDiffComputer, createDiffComputer as createExternalDiffComputer } from '@vscode/diff';
7 > import { resolveAmdNodeModulePath } from '../../../amdX.js';
8 > import { LineRange } from '../core/ranges/lineRange.js';
9 > import { OffsetRange } from '../core/ranges/offsetRange.js';
10 > import { StringText } from '../core/text/abstractText.js';
11 > import { ensureDependenciesAreSet } from '../core/text/positionToOffset.js';
12 > import { ILinesDiffComputer, ILinesDiffComputerOptions, LinesDiff, MovedText } from './linesDiffComputer.js';
13 > import { lineRangeMappingFromRangeMappings, LineRangeMapping, RangeMapping } from './rangeMapping.js';
14 >
15 > type ExternalDiffModule = { createDiffComputer: typeof createExternalDiffComputer };
16 >
17 > let externalModulePromise: Promise<ExternalDiffModule> | undefined;
18 > let externalDiffComputerPromise: Promise<IExternalDiffComputer> | undefined;
19 > let externalWasmDiffComputerPromise: Promise<IExternalDiffComputer> | undefined;
20 >
21 function loadExternalModule(): Promise<ExternalDiffModule> {
22 if (!externalModulePromise) {
27 return externalModulePromise;
28 }
30 function loadExternalComputer(useWasm: boolean): Promise<IExternalDiffComputer> {
31 if (useWasm) {
40 return externalDiffComputerPromise;
41 }
43 export async function getExternalLinesDiffComputer(useWasm: boolean): Promise<ILinesDiffComputer> {
44 const computer = await loadExternalComputer(useWasm);
45 return new ExternalLinesDiffComputer(computer);
46 }
48 > class ExternalLinesDiffComputer implements ILinesDiffComputer {
49 > constructor(private readonly _computer: IExternalDiffComputer) { }
50 >
51 > computeDiff(originalLines: string[], modifiedLines: string[], options: ILinesDiffComputerOptions): LinesDiff {
52 ensureDependenciesAreSet();
53
src/vs/editor/common/services/editorBaseApi.ts 25 introduced LOC · 2 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- editorBaseApi.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { CancellationTokenSource } from '../../../base/common/cancellation.js';
7 > import { Emitter } from '../../../base/common/event.js';
8 > import { KeyChord, KeyMod as ConstKeyMod } from '../../../base/common/keyCodes.js';
9 > import { URI } from '../../../base/common/uri.js';
10 > import { Position } from '../core/position.js';
11 > import { Range } from '../core/range.js';
12 > import { Selection } from '../core/selection.js';
13 > import { Token } from '../languages.js';
14 > import * as standaloneEnums from '../standalone/standaloneEnums.js';
15 >
16 > export class KeyMod {
17 > public static readonly CtrlCmd: number = ConstKeyMod.CtrlCmd;
18 > public static readonly Shift: number = ConstKeyMod.Shift;
19 > public static readonly Alt: number = ConstKeyMod.Alt;
20 > public static readonly WinCtrl: number = ConstKeyMod.WinCtrl;
21 >
22 > public static chord(firstPart: number, secondPart: number): number {
23 return KeyChord(firstPart, secondPart);
24 }
26 >
27 > export function createMonacoBaseAPI(): typeof monaco {
28 return {
29 editor: undefined!, // undefined override expected here
src/vs/editor/common/diff/linesDiffComputers.ts 16 introduced LOC · 1 range

Open complete file

1 > /*--------------------------------------------------------------------------------------------- linesDiffComputers.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { LegacyLinesDiffComputer } from './legacyLinesDiffComputer.js';
7 > import { DefaultLinesDiffComputer } from './defaultLinesDiffComputer/defaultLinesDiffComputer.js';
8 > import { getExternalLinesDiffComputer } from './externalLinesDiffComputer.js';
9 > import { ILinesDiffComputer } from './linesDiffComputer.js';
10 >
11 > export const linesDiffComputers = {
12 > getLegacy: () => new LegacyLinesDiffComputer(),
13 > getDefault: () => new DefaultLinesDiffComputer(),
14 > getAdvancedExternal: () => getExternalLinesDiffComputer(false),
15 > getAdvancedWasm: () => getExternalLinesDiffComputer(true),
16 > } satisfies Record<string, () => ILinesDiffComputer | Promise<ILinesDiffComputer>>;