@theia/editor 1.45.0 → 1.46.0-next.72

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 (112) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/decorations/editor-decoration-style.d.ts +8 -8
  3. package/lib/browser/decorations/editor-decoration-style.js +36 -36
  4. package/lib/browser/decorations/editor-decoration.d.ts +106 -106
  5. package/lib/browser/decorations/editor-decoration.js +37 -37
  6. package/lib/browser/decorations/editor-decorator.d.ts +6 -6
  7. package/lib/browser/decorations/editor-decorator.js +43 -43
  8. package/lib/browser/decorations/index.d.ts +3 -3
  9. package/lib/browser/decorations/index.js +30 -30
  10. package/lib/browser/diff-navigator.d.ts +9 -10
  11. package/lib/browser/diff-navigator.d.ts.map +1 -1
  12. package/lib/browser/diff-navigator.js +19 -19
  13. package/lib/browser/diff-navigator.js.map +1 -1
  14. package/lib/browser/editor-command.d.ts +102 -102
  15. package/lib/browser/editor-command.js +426 -426
  16. package/lib/browser/editor-contribution.d.ts +26 -26
  17. package/lib/browser/editor-contribution.js +198 -198
  18. package/lib/browser/editor-frontend-module.d.ts +5 -5
  19. package/lib/browser/editor-frontend-module.js +74 -74
  20. package/lib/browser/editor-generated-preference-schema.d.ts +282 -249
  21. package/lib/browser/editor-generated-preference-schema.d.ts.map +1 -1
  22. package/lib/browser/editor-generated-preference-schema.js +2451 -2316
  23. package/lib/browser/editor-generated-preference-schema.js.map +1 -1
  24. package/lib/browser/editor-keybinding.d.ts +5 -5
  25. package/lib/browser/editor-keybinding.js +55 -55
  26. package/lib/browser/editor-linenumber-contribution.d.ts +15 -15
  27. package/lib/browser/editor-linenumber-contribution.d.ts.map +1 -1
  28. package/lib/browser/editor-linenumber-contribution.js +95 -96
  29. package/lib/browser/editor-linenumber-contribution.js.map +1 -1
  30. package/lib/browser/editor-manager.d.ts +115 -115
  31. package/lib/browser/editor-manager.js +428 -428
  32. package/lib/browser/editor-menu.d.ts +48 -48
  33. package/lib/browser/editor-menu.js +210 -210
  34. package/lib/browser/editor-navigation-contribution.d.ts +67 -67
  35. package/lib/browser/editor-navigation-contribution.js +343 -343
  36. package/lib/browser/editor-preferences.d.ts +41 -41
  37. package/lib/browser/editor-preferences.js +176 -176
  38. package/lib/browser/editor-variable-contribution.d.ts +8 -8
  39. package/lib/browser/editor-variable-contribution.js +64 -64
  40. package/lib/browser/editor-widget-factory.d.ts +17 -17
  41. package/lib/browser/editor-widget-factory.js +91 -91
  42. package/lib/browser/editor-widget.d.ts +24 -24
  43. package/lib/browser/editor-widget.d.ts.map +1 -1
  44. package/lib/browser/editor-widget.js +122 -114
  45. package/lib/browser/editor-widget.js.map +1 -1
  46. package/lib/browser/editor.d.ts +295 -293
  47. package/lib/browser/editor.d.ts.map +1 -1
  48. package/lib/browser/editor.js +103 -103
  49. package/lib/browser/editor.js.map +1 -1
  50. package/lib/browser/index.d.ts +10 -10
  51. package/lib/browser/index.js +37 -37
  52. package/lib/browser/language-status/editor-language-status-service.d.ts +77 -77
  53. package/lib/browser/language-status/editor-language-status-service.js +251 -251
  54. package/lib/browser/navigation/navigation-location-service.d.ts +103 -103
  55. package/lib/browser/navigation/navigation-location-service.js +281 -281
  56. package/lib/browser/navigation/navigation-location-service.spec.d.ts +1 -1
  57. package/lib/browser/navigation/navigation-location-service.spec.js +184 -184
  58. package/lib/browser/navigation/navigation-location-similarity.d.ts +15 -15
  59. package/lib/browser/navigation/navigation-location-similarity.js +62 -62
  60. package/lib/browser/navigation/navigation-location-similarity.spec.d.ts +1 -1
  61. package/lib/browser/navigation/navigation-location-similarity.spec.js +32 -32
  62. package/lib/browser/navigation/navigation-location-updater.d.ts +35 -35
  63. package/lib/browser/navigation/navigation-location-updater.js +210 -210
  64. package/lib/browser/navigation/navigation-location-updater.spec.d.ts +1 -1
  65. package/lib/browser/navigation/navigation-location-updater.spec.js +177 -177
  66. package/lib/browser/navigation/navigation-location.d.ts +191 -191
  67. package/lib/browser/navigation/navigation-location.js +300 -300
  68. package/lib/browser/navigation/test/mock-navigation-location-updater.d.ts +15 -15
  69. package/lib/browser/navigation/test/mock-navigation-location-updater.js +38 -38
  70. package/lib/browser/quick-editor-service.d.ts +16 -16
  71. package/lib/browser/quick-editor-service.js +109 -109
  72. package/lib/browser/undo-redo-service.d.ts +23 -23
  73. package/lib/browser/undo-redo-service.js +110 -110
  74. package/lib/common/language-selector.d.ts +13 -13
  75. package/lib/common/language-selector.js +90 -90
  76. package/lib/package.spec.js +25 -25
  77. package/package.json +5 -5
  78. package/src/browser/decorations/editor-decoration-style.ts +41 -41
  79. package/src/browser/decorations/editor-decoration.ts +127 -127
  80. package/src/browser/decorations/editor-decorator.ts +36 -36
  81. package/src/browser/decorations/index.ts +19 -19
  82. package/src/browser/diff-navigator.ts +27 -28
  83. package/src/browser/editor-command.ts +414 -414
  84. package/src/browser/editor-contribution.ts +185 -185
  85. package/src/browser/editor-frontend-module.ts +87 -87
  86. package/src/browser/editor-generated-preference-schema.ts +2707 -2539
  87. package/src/browser/editor-keybinding.ts +55 -55
  88. package/src/browser/editor-linenumber-contribution.ts +88 -89
  89. package/src/browser/editor-manager.ts +442 -442
  90. package/src/browser/editor-menu.ts +224 -224
  91. package/src/browser/editor-navigation-contribution.ts +343 -343
  92. package/src/browser/editor-preferences.ts +226 -226
  93. package/src/browser/editor-variable-contribution.ts +54 -54
  94. package/src/browser/editor-widget-factory.ts +82 -82
  95. package/src/browser/editor-widget.ts +137 -130
  96. package/src/browser/editor.ts +360 -358
  97. package/src/browser/index.ts +26 -26
  98. package/src/browser/language-status/editor-language-status-service.ts +271 -271
  99. package/src/browser/language-status/editor-language-status.css +101 -101
  100. package/src/browser/navigation/navigation-location-service.spec.ts +245 -245
  101. package/src/browser/navigation/navigation-location-service.ts +284 -284
  102. package/src/browser/navigation/navigation-location-similarity.spec.ts +46 -46
  103. package/src/browser/navigation/navigation-location-similarity.ts +58 -58
  104. package/src/browser/navigation/navigation-location-updater.spec.ts +197 -197
  105. package/src/browser/navigation/navigation-location-updater.ts +220 -220
  106. package/src/browser/navigation/navigation-location.ts +418 -418
  107. package/src/browser/navigation/test/mock-navigation-location-updater.ts +41 -41
  108. package/src/browser/quick-editor-service.ts +94 -94
  109. package/src/browser/style/index.css +19 -19
  110. package/src/browser/undo-redo-service.ts +120 -120
  111. package/src/common/language-selector.ts +104 -104
  112. package/src/package.spec.ts +28 -28
@@ -1,301 +1,301 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.ContentChangeLocation = exports.SelectionLocation = exports.CursorLocation = exports.RecentlyClosedEditor = exports.NavigationLocation = exports.Range = exports.Position = void 0;
19
- const uri_1 = require("@theia/core/lib/common/uri");
20
- const editor_1 = require("../editor");
21
- Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return editor_1.Position; } });
22
- Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return editor_1.Range; } });
23
- var NavigationLocation;
24
- (function (NavigationLocation) {
25
- /**
26
- * The navigation location type.
27
- */
28
- let Type;
29
- (function (Type) {
30
- /**
31
- * Cursor position change type.
32
- */
33
- Type[Type["CURSOR"] = 0] = "CURSOR";
34
- /**
35
- * Text selection change type.
36
- */
37
- Type[Type["SELECTION"] = 1] = "SELECTION";
38
- /**
39
- * Content change type.
40
- */
41
- Type[Type["CONTENT_CHANGE"] = 2] = "CONTENT_CHANGE";
42
- })(Type = NavigationLocation.Type || (NavigationLocation.Type = {}));
43
- let Context;
44
- (function (Context) {
45
- /**
46
- * Returns with the type for the context.
47
- */
48
- function getType(context) {
49
- if (editor_1.Position.is(context)) {
50
- return Type.CURSOR;
51
- }
52
- if (editor_1.Range.is(context)) {
53
- return Type.SELECTION;
54
- }
55
- if (editor_1.TextDocumentContentChangeDelta.is(context)) {
56
- return Type.CONTENT_CHANGE;
57
- }
58
- throw new Error(`Unexpected context for type: ${context}.`);
59
- }
60
- Context.getType = getType;
61
- })(Context = NavigationLocation.Context || (NavigationLocation.Context = {}));
62
- })(NavigationLocation = exports.NavigationLocation || (exports.NavigationLocation = {}));
63
- (function (NavigationLocation) {
64
- /**
65
- * Transforms the location into an object that can be safely serialized.
66
- */
67
- function toObject(location) {
68
- const { uri, type } = location;
69
- const context = (() => {
70
- if (CursorLocation.is(location)) {
71
- return CursorLocation.toObject(location.context);
72
- }
73
- if (SelectionLocation.is(location)) {
74
- return SelectionLocation.toObject(location.context);
75
- }
76
- if (ContentChangeLocation.is(location)) {
77
- return ContentChangeLocation.toObject(location.context);
78
- }
79
- })();
80
- return {
81
- uri: uri.toString(),
82
- type,
83
- context
84
- };
85
- }
86
- NavigationLocation.toObject = toObject;
87
- /**
88
- * Returns with the navigation location object from its serialized counterpart.
89
- */
90
- function fromObject(object) {
91
- const { uri, type } = object;
92
- if (uri !== undefined && type !== undefined && object.context !== undefined) {
93
- const context = (() => {
94
- switch (type) {
95
- case NavigationLocation.Type.CURSOR: return CursorLocation.fromObject(object.context);
96
- case NavigationLocation.Type.SELECTION: return SelectionLocation.fromObject(object.context);
97
- case NavigationLocation.Type.CONTENT_CHANGE: return ContentChangeLocation.fromObject(object.context);
98
- }
99
- })();
100
- if (context) {
101
- return {
102
- uri: toUri(uri),
103
- context,
104
- type
105
- };
106
- }
107
- }
108
- return undefined;
109
- }
110
- NavigationLocation.fromObject = fromObject;
111
- /**
112
- * Returns with the context of the location as a `Range`.
113
- */
114
- function range(location) {
115
- if (CursorLocation.is(location)) {
116
- return editor_1.Range.create(location.context, location.context);
117
- }
118
- if (SelectionLocation.is(location)) {
119
- return location.context;
120
- }
121
- if (ContentChangeLocation.is(location)) {
122
- return location.context.range;
123
- }
124
- throw new Error(`Unexpected navigation location: ${location}.`);
125
- }
126
- NavigationLocation.range = range;
127
- /**
128
- * Creates a new navigation location object.
129
- */
130
- function create(uri, context) {
131
- const type = NavigationLocation.Context.getType(context);
132
- return {
133
- uri: toUri(uri),
134
- type,
135
- context
136
- };
137
- }
138
- NavigationLocation.create = create;
139
- /**
140
- * Returns with the human-consumable (JSON) string representation of the location argument.
141
- */
142
- function toString(location) {
143
- return JSON.stringify(toObject(location));
144
- }
145
- NavigationLocation.toString = toString;
146
- })(NavigationLocation = exports.NavigationLocation || (exports.NavigationLocation = {}));
147
- function toUri(arg) {
148
- if (arg instanceof uri_1.default) {
149
- return arg;
150
- }
151
- if (typeof arg === 'string') {
152
- return new uri_1.default(arg);
153
- }
154
- return arg.uri;
155
- }
156
- var RecentlyClosedEditor;
157
- (function (RecentlyClosedEditor) {
158
- /**
159
- * Transform a RecentlyClosedEditor into an object for storing.
160
- *
161
- * @param closedEditor the editor needs to be transformed.
162
- */
163
- function toObject(closedEditor) {
164
- const { uri, viewState } = closedEditor;
165
- return {
166
- uri: uri.toString(),
167
- viewState: viewState
168
- };
169
- }
170
- RecentlyClosedEditor.toObject = toObject;
171
- /**
172
- * Transform the given object to a RecentlyClosedEditor object if possible.
173
- */
174
- function fromObject(object) {
175
- const { uri, viewState } = object;
176
- if (uri !== undefined && viewState !== undefined) {
177
- return {
178
- uri: toUri(uri),
179
- viewState: viewState
180
- };
181
- }
182
- return undefined;
183
- }
184
- RecentlyClosedEditor.fromObject = fromObject;
185
- })(RecentlyClosedEditor = exports.RecentlyClosedEditor || (exports.RecentlyClosedEditor = {}));
186
- var CursorLocation;
187
- (function (CursorLocation) {
188
- /**
189
- * `true` if the argument is a cursor location. Otherwise, `false`.
190
- */
191
- function is(location) {
192
- return location.type === NavigationLocation.Type.CURSOR;
193
- }
194
- CursorLocation.is = is;
195
- /**
196
- * Returns with the serialized format of the position argument.
197
- */
198
- function toObject(context) {
199
- const { line, character } = context;
200
- return {
201
- line,
202
- character
203
- };
204
- }
205
- CursorLocation.toObject = toObject;
206
- /**
207
- * Returns with the position from its serializable counterpart, or `undefined`.
208
- */
209
- function fromObject(object) {
210
- if (object.line !== undefined && object.character !== undefined) {
211
- const { line, character } = object;
212
- return {
213
- line,
214
- character
215
- };
216
- }
217
- return undefined;
218
- }
219
- CursorLocation.fromObject = fromObject;
220
- })(CursorLocation = exports.CursorLocation || (exports.CursorLocation = {}));
221
- var SelectionLocation;
222
- (function (SelectionLocation) {
223
- /**
224
- * `true` if the argument is a selection location.
225
- */
226
- function is(location) {
227
- return location.type === NavigationLocation.Type.SELECTION;
228
- }
229
- SelectionLocation.is = is;
230
- /**
231
- * Converts the range argument into a serializable object.
232
- */
233
- function toObject(context) {
234
- const { start, end } = context;
235
- return {
236
- start: CursorLocation.toObject(start),
237
- end: CursorLocation.toObject(end)
238
- };
239
- }
240
- SelectionLocation.toObject = toObject;
241
- /**
242
- * Creates a range object from its serializable counterpart. Returns with `undefined` if the argument cannot be converted into a range.
243
- */
244
- function fromObject(object) {
245
- if (!!object.start && !!object.end) {
246
- const start = CursorLocation.fromObject(object.start);
247
- const end = CursorLocation.fromObject(object.end);
248
- if (start && end) {
249
- return {
250
- start,
251
- end
252
- };
253
- }
254
- }
255
- return undefined;
256
- }
257
- SelectionLocation.fromObject = fromObject;
258
- })(SelectionLocation = exports.SelectionLocation || (exports.SelectionLocation = {}));
259
- var ContentChangeLocation;
260
- (function (ContentChangeLocation) {
261
- /**
262
- * `true` if the argument is a content change location. Otherwise, `false`.
263
- */
264
- function is(location) {
265
- return location.type === NavigationLocation.Type.CONTENT_CHANGE;
266
- }
267
- ContentChangeLocation.is = is;
268
- /**
269
- * Returns with a serializable object representing the arguments.
270
- */
271
- function toObject(context) {
272
- return {
273
- range: SelectionLocation.toObject(context.range),
274
- rangeLength: context.rangeLength,
275
- text: context.text
276
- };
277
- }
278
- ContentChangeLocation.toObject = toObject;
279
- /**
280
- * Returns with a text document change delta for the argument. `undefined` if the argument cannot be mapped to a content change delta.
281
- */
282
- function fromObject(object) {
283
- if (!!object.range && object.rangeLength !== undefined && object.text !== undefined) {
284
- const range = SelectionLocation.fromObject(object.range);
285
- const rangeLength = object.rangeLength;
286
- const text = object.text;
287
- if (!!range) {
288
- return {
289
- range,
290
- rangeLength: rangeLength,
291
- text: text
292
- };
293
- }
294
- }
295
- else {
296
- return undefined;
297
- }
298
- }
299
- ContentChangeLocation.fromObject = fromObject;
300
- })(ContentChangeLocation = exports.ContentChangeLocation || (exports.ContentChangeLocation = {}));
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ContentChangeLocation = exports.SelectionLocation = exports.CursorLocation = exports.RecentlyClosedEditor = exports.NavigationLocation = exports.Range = exports.Position = void 0;
19
+ const uri_1 = require("@theia/core/lib/common/uri");
20
+ const editor_1 = require("../editor");
21
+ Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return editor_1.Position; } });
22
+ Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return editor_1.Range; } });
23
+ var NavigationLocation;
24
+ (function (NavigationLocation) {
25
+ /**
26
+ * The navigation location type.
27
+ */
28
+ let Type;
29
+ (function (Type) {
30
+ /**
31
+ * Cursor position change type.
32
+ */
33
+ Type[Type["CURSOR"] = 0] = "CURSOR";
34
+ /**
35
+ * Text selection change type.
36
+ */
37
+ Type[Type["SELECTION"] = 1] = "SELECTION";
38
+ /**
39
+ * Content change type.
40
+ */
41
+ Type[Type["CONTENT_CHANGE"] = 2] = "CONTENT_CHANGE";
42
+ })(Type = NavigationLocation.Type || (NavigationLocation.Type = {}));
43
+ let Context;
44
+ (function (Context) {
45
+ /**
46
+ * Returns with the type for the context.
47
+ */
48
+ function getType(context) {
49
+ if (editor_1.Position.is(context)) {
50
+ return Type.CURSOR;
51
+ }
52
+ if (editor_1.Range.is(context)) {
53
+ return Type.SELECTION;
54
+ }
55
+ if (editor_1.TextDocumentContentChangeDelta.is(context)) {
56
+ return Type.CONTENT_CHANGE;
57
+ }
58
+ throw new Error(`Unexpected context for type: ${context}.`);
59
+ }
60
+ Context.getType = getType;
61
+ })(Context = NavigationLocation.Context || (NavigationLocation.Context = {}));
62
+ })(NavigationLocation = exports.NavigationLocation || (exports.NavigationLocation = {}));
63
+ (function (NavigationLocation) {
64
+ /**
65
+ * Transforms the location into an object that can be safely serialized.
66
+ */
67
+ function toObject(location) {
68
+ const { uri, type } = location;
69
+ const context = (() => {
70
+ if (CursorLocation.is(location)) {
71
+ return CursorLocation.toObject(location.context);
72
+ }
73
+ if (SelectionLocation.is(location)) {
74
+ return SelectionLocation.toObject(location.context);
75
+ }
76
+ if (ContentChangeLocation.is(location)) {
77
+ return ContentChangeLocation.toObject(location.context);
78
+ }
79
+ })();
80
+ return {
81
+ uri: uri.toString(),
82
+ type,
83
+ context
84
+ };
85
+ }
86
+ NavigationLocation.toObject = toObject;
87
+ /**
88
+ * Returns with the navigation location object from its serialized counterpart.
89
+ */
90
+ function fromObject(object) {
91
+ const { uri, type } = object;
92
+ if (uri !== undefined && type !== undefined && object.context !== undefined) {
93
+ const context = (() => {
94
+ switch (type) {
95
+ case NavigationLocation.Type.CURSOR: return CursorLocation.fromObject(object.context);
96
+ case NavigationLocation.Type.SELECTION: return SelectionLocation.fromObject(object.context);
97
+ case NavigationLocation.Type.CONTENT_CHANGE: return ContentChangeLocation.fromObject(object.context);
98
+ }
99
+ })();
100
+ if (context) {
101
+ return {
102
+ uri: toUri(uri),
103
+ context,
104
+ type
105
+ };
106
+ }
107
+ }
108
+ return undefined;
109
+ }
110
+ NavigationLocation.fromObject = fromObject;
111
+ /**
112
+ * Returns with the context of the location as a `Range`.
113
+ */
114
+ function range(location) {
115
+ if (CursorLocation.is(location)) {
116
+ return editor_1.Range.create(location.context, location.context);
117
+ }
118
+ if (SelectionLocation.is(location)) {
119
+ return location.context;
120
+ }
121
+ if (ContentChangeLocation.is(location)) {
122
+ return location.context.range;
123
+ }
124
+ throw new Error(`Unexpected navigation location: ${location}.`);
125
+ }
126
+ NavigationLocation.range = range;
127
+ /**
128
+ * Creates a new navigation location object.
129
+ */
130
+ function create(uri, context) {
131
+ const type = NavigationLocation.Context.getType(context);
132
+ return {
133
+ uri: toUri(uri),
134
+ type,
135
+ context
136
+ };
137
+ }
138
+ NavigationLocation.create = create;
139
+ /**
140
+ * Returns with the human-consumable (JSON) string representation of the location argument.
141
+ */
142
+ function toString(location) {
143
+ return JSON.stringify(toObject(location));
144
+ }
145
+ NavigationLocation.toString = toString;
146
+ })(NavigationLocation = exports.NavigationLocation || (exports.NavigationLocation = {}));
147
+ function toUri(arg) {
148
+ if (arg instanceof uri_1.default) {
149
+ return arg;
150
+ }
151
+ if (typeof arg === 'string') {
152
+ return new uri_1.default(arg);
153
+ }
154
+ return arg.uri;
155
+ }
156
+ var RecentlyClosedEditor;
157
+ (function (RecentlyClosedEditor) {
158
+ /**
159
+ * Transform a RecentlyClosedEditor into an object for storing.
160
+ *
161
+ * @param closedEditor the editor needs to be transformed.
162
+ */
163
+ function toObject(closedEditor) {
164
+ const { uri, viewState } = closedEditor;
165
+ return {
166
+ uri: uri.toString(),
167
+ viewState: viewState
168
+ };
169
+ }
170
+ RecentlyClosedEditor.toObject = toObject;
171
+ /**
172
+ * Transform the given object to a RecentlyClosedEditor object if possible.
173
+ */
174
+ function fromObject(object) {
175
+ const { uri, viewState } = object;
176
+ if (uri !== undefined && viewState !== undefined) {
177
+ return {
178
+ uri: toUri(uri),
179
+ viewState: viewState
180
+ };
181
+ }
182
+ return undefined;
183
+ }
184
+ RecentlyClosedEditor.fromObject = fromObject;
185
+ })(RecentlyClosedEditor = exports.RecentlyClosedEditor || (exports.RecentlyClosedEditor = {}));
186
+ var CursorLocation;
187
+ (function (CursorLocation) {
188
+ /**
189
+ * `true` if the argument is a cursor location. Otherwise, `false`.
190
+ */
191
+ function is(location) {
192
+ return location.type === NavigationLocation.Type.CURSOR;
193
+ }
194
+ CursorLocation.is = is;
195
+ /**
196
+ * Returns with the serialized format of the position argument.
197
+ */
198
+ function toObject(context) {
199
+ const { line, character } = context;
200
+ return {
201
+ line,
202
+ character
203
+ };
204
+ }
205
+ CursorLocation.toObject = toObject;
206
+ /**
207
+ * Returns with the position from its serializable counterpart, or `undefined`.
208
+ */
209
+ function fromObject(object) {
210
+ if (object.line !== undefined && object.character !== undefined) {
211
+ const { line, character } = object;
212
+ return {
213
+ line,
214
+ character
215
+ };
216
+ }
217
+ return undefined;
218
+ }
219
+ CursorLocation.fromObject = fromObject;
220
+ })(CursorLocation = exports.CursorLocation || (exports.CursorLocation = {}));
221
+ var SelectionLocation;
222
+ (function (SelectionLocation) {
223
+ /**
224
+ * `true` if the argument is a selection location.
225
+ */
226
+ function is(location) {
227
+ return location.type === NavigationLocation.Type.SELECTION;
228
+ }
229
+ SelectionLocation.is = is;
230
+ /**
231
+ * Converts the range argument into a serializable object.
232
+ */
233
+ function toObject(context) {
234
+ const { start, end } = context;
235
+ return {
236
+ start: CursorLocation.toObject(start),
237
+ end: CursorLocation.toObject(end)
238
+ };
239
+ }
240
+ SelectionLocation.toObject = toObject;
241
+ /**
242
+ * Creates a range object from its serializable counterpart. Returns with `undefined` if the argument cannot be converted into a range.
243
+ */
244
+ function fromObject(object) {
245
+ if (!!object.start && !!object.end) {
246
+ const start = CursorLocation.fromObject(object.start);
247
+ const end = CursorLocation.fromObject(object.end);
248
+ if (start && end) {
249
+ return {
250
+ start,
251
+ end
252
+ };
253
+ }
254
+ }
255
+ return undefined;
256
+ }
257
+ SelectionLocation.fromObject = fromObject;
258
+ })(SelectionLocation = exports.SelectionLocation || (exports.SelectionLocation = {}));
259
+ var ContentChangeLocation;
260
+ (function (ContentChangeLocation) {
261
+ /**
262
+ * `true` if the argument is a content change location. Otherwise, `false`.
263
+ */
264
+ function is(location) {
265
+ return location.type === NavigationLocation.Type.CONTENT_CHANGE;
266
+ }
267
+ ContentChangeLocation.is = is;
268
+ /**
269
+ * Returns with a serializable object representing the arguments.
270
+ */
271
+ function toObject(context) {
272
+ return {
273
+ range: SelectionLocation.toObject(context.range),
274
+ rangeLength: context.rangeLength,
275
+ text: context.text
276
+ };
277
+ }
278
+ ContentChangeLocation.toObject = toObject;
279
+ /**
280
+ * Returns with a text document change delta for the argument. `undefined` if the argument cannot be mapped to a content change delta.
281
+ */
282
+ function fromObject(object) {
283
+ if (!!object.range && object.rangeLength !== undefined && object.text !== undefined) {
284
+ const range = SelectionLocation.fromObject(object.range);
285
+ const rangeLength = object.rangeLength;
286
+ const text = object.text;
287
+ if (!!range) {
288
+ return {
289
+ range,
290
+ rangeLength: rangeLength,
291
+ text: text
292
+ };
293
+ }
294
+ }
295
+ else {
296
+ return undefined;
297
+ }
298
+ }
299
+ ContentChangeLocation.fromObject = fromObject;
300
+ })(ContentChangeLocation = exports.ContentChangeLocation || (exports.ContentChangeLocation = {}));
301
301
  //# sourceMappingURL=navigation-location.js.map
@@ -1,16 +1,16 @@
1
- import { Range } from '../navigation-location';
2
- import { NavigationLocationUpdater } from '../navigation-location-updater';
3
- /**
4
- * Navigation location updater with increased method visibility for testing.
5
- */
6
- export declare class MockNavigationLocationUpdater extends NavigationLocationUpdater {
7
- contained(subRange: Range, range: Range): boolean;
8
- }
9
- /**
10
- * NOOP navigation location updater for testing. Use this, if you want to avoid any
11
- * location updates during the tests.
12
- */
13
- export declare class NoopNavigationLocationUpdater extends NavigationLocationUpdater {
14
- affects(): false;
15
- }
1
+ import { Range } from '../navigation-location';
2
+ import { NavigationLocationUpdater } from '../navigation-location-updater';
3
+ /**
4
+ * Navigation location updater with increased method visibility for testing.
5
+ */
6
+ export declare class MockNavigationLocationUpdater extends NavigationLocationUpdater {
7
+ contained(subRange: Range, range: Range): boolean;
8
+ }
9
+ /**
10
+ * NOOP navigation location updater for testing. Use this, if you want to avoid any
11
+ * location updates during the tests.
12
+ */
13
+ export declare class NoopNavigationLocationUpdater extends NavigationLocationUpdater {
14
+ affects(): false;
15
+ }
16
16
  //# sourceMappingURL=mock-navigation-location-updater.d.ts.map