model.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { equals } from '../../base/common/objects.js';
  2. /**
  3. * Vertical Lane in the overview ruler of the editor.
  4. */
  5. export var OverviewRulerLane;
  6. (function (OverviewRulerLane) {
  7. OverviewRulerLane[OverviewRulerLane["Left"] = 1] = "Left";
  8. OverviewRulerLane[OverviewRulerLane["Center"] = 2] = "Center";
  9. OverviewRulerLane[OverviewRulerLane["Right"] = 4] = "Right";
  10. OverviewRulerLane[OverviewRulerLane["Full"] = 7] = "Full";
  11. })(OverviewRulerLane || (OverviewRulerLane = {}));
  12. /**
  13. * Position in the minimap to render the decoration.
  14. */
  15. export var MinimapPosition;
  16. (function (MinimapPosition) {
  17. MinimapPosition[MinimapPosition["Inline"] = 1] = "Inline";
  18. MinimapPosition[MinimapPosition["Gutter"] = 2] = "Gutter";
  19. })(MinimapPosition || (MinimapPosition = {}));
  20. export class TextModelResolvedOptions {
  21. /**
  22. * @internal
  23. */
  24. constructor(src) {
  25. this._textModelResolvedOptionsBrand = undefined;
  26. this.tabSize = Math.max(1, src.tabSize | 0);
  27. this.indentSize = src.tabSize | 0;
  28. this.insertSpaces = Boolean(src.insertSpaces);
  29. this.defaultEOL = src.defaultEOL | 0;
  30. this.trimAutoWhitespace = Boolean(src.trimAutoWhitespace);
  31. this.bracketPairColorizationOptions = src.bracketPairColorizationOptions;
  32. }
  33. /**
  34. * @internal
  35. */
  36. equals(other) {
  37. return (this.tabSize === other.tabSize
  38. && this.indentSize === other.indentSize
  39. && this.insertSpaces === other.insertSpaces
  40. && this.defaultEOL === other.defaultEOL
  41. && this.trimAutoWhitespace === other.trimAutoWhitespace
  42. && equals(this.bracketPairColorizationOptions, other.bracketPairColorizationOptions));
  43. }
  44. /**
  45. * @internal
  46. */
  47. createChangeEvent(newOpts) {
  48. return {
  49. tabSize: this.tabSize !== newOpts.tabSize,
  50. indentSize: this.indentSize !== newOpts.indentSize,
  51. insertSpaces: this.insertSpaces !== newOpts.insertSpaces,
  52. trimAutoWhitespace: this.trimAutoWhitespace !== newOpts.trimAutoWhitespace,
  53. };
  54. }
  55. }
  56. export class FindMatch {
  57. /**
  58. * @internal
  59. */
  60. constructor(range, matches) {
  61. this._findMatchBrand = undefined;
  62. this.range = range;
  63. this.matches = matches;
  64. }
  65. }
  66. /**
  67. * @internal
  68. */
  69. export class ValidAnnotatedEditOperation {
  70. constructor(identifier, range, text, forceMoveMarkers, isAutoWhitespaceEdit, _isTracked) {
  71. this.identifier = identifier;
  72. this.range = range;
  73. this.text = text;
  74. this.forceMoveMarkers = forceMoveMarkers;
  75. this.isAutoWhitespaceEdit = isAutoWhitespaceEdit;
  76. this._isTracked = _isTracked;
  77. }
  78. }
  79. /**
  80. * @internal
  81. */
  82. export class ApplyEditsResult {
  83. constructor(reverseEdits, changes, trimAutoWhitespaceLineNumbers) {
  84. this.reverseEdits = reverseEdits;
  85. this.changes = changes;
  86. this.trimAutoWhitespaceLineNumbers = trimAutoWhitespaceLineNumbers;
  87. }
  88. }