@adecore/editor-react 0.22.1 → 0.23.0
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.
- package/dist/CallHierarchyPanel.d.ts +6 -0
- package/dist/CallHierarchyPanel.js +88 -0
- package/dist/CompletionPopup.js +11 -3
- package/dist/DiffView.d.ts +22 -0
- package/dist/DiffView.js +203 -0
- package/dist/EditorContextMenu.js +1 -0
- package/dist/EditorView.js +18 -1
- package/dist/FindReplace.d.ts +1 -1
- package/dist/FindReplace.js +41 -11
- package/dist/HoverCard.js +2 -2
- package/dist/LanguagePopups.js +4 -1
- package/dist/Markdown.d.ts +2 -1
- package/dist/Markdown.js +8 -4
- package/dist/PeekPanel.d.ts +3 -0
- package/dist/PeekPanel.js +2 -3
- package/dist/PickPopup.js +15 -2
- package/dist/RenameCard.js +10 -5
- package/dist/RenderedDocs.d.ts +9 -0
- package/dist/RenderedDocs.js +84 -0
- package/dist/SplitDiffView.d.ts +9 -0
- package/dist/SplitDiffView.js +276 -0
- package/dist/SymbolPicker.d.ts +3 -0
- package/dist/SymbolPicker.js +4 -3
- package/dist/call-hierarchy-model.d.ts +52 -0
- package/dist/call-hierarchy-model.js +99 -0
- package/dist/call-hierarchy.d.ts +42 -0
- package/dist/call-hierarchy.js +399 -0
- package/dist/code-actions-model.d.ts +2 -0
- package/dist/code-actions-model.js +12 -10
- package/dist/code-actions.js +3 -1
- package/dist/completion-model.d.ts +14 -4
- package/dist/completion-model.js +40 -33
- package/dist/completion.d.ts +4 -0
- package/dist/completion.js +257 -42
- package/dist/diagnostics.js +8 -6
- package/dist/diff-expansion.d.ts +9 -0
- package/dist/diff-expansion.js +41 -0
- package/dist/diff-overlays.d.ts +15 -0
- package/dist/diff-overlays.js +28 -0
- package/dist/diff-syntax.d.ts +16 -0
- package/dist/diff-syntax.js +49 -0
- package/dist/diff-wordmarks.d.ts +5 -0
- package/dist/diff-wordmarks.js +26 -0
- package/dist/doc-comment-model.d.ts +23 -0
- package/dist/doc-comment-model.js +291 -0
- package/dist/editor-language.d.ts +13 -1
- package/dist/editor-language.js +14 -4
- package/dist/editor-react.css +79 -0
- package/dist/format-on-type.d.ts +14 -0
- package/dist/format-on-type.js +96 -0
- package/dist/host-types.d.ts +17 -0
- package/dist/hover.d.ts +4 -0
- package/dist/hover.js +15 -2
- package/dist/index.d.ts +19 -5
- package/dist/index.js +9 -1
- package/dist/inlay-hints.d.ts +47 -2
- package/dist/inlay-hints.js +353 -16
- package/dist/language-ids.js +4 -2
- package/dist/locales/en.json +114 -3
- package/dist/locales/nl.json +114 -3
- package/dist/models.d.ts +6 -2
- package/dist/models.js +5 -1
- package/dist/patch-decorations.d.ts +27 -0
- package/dist/patch-decorations.js +182 -0
- package/dist/patch-layout.d.ts +40 -0
- package/dist/patch-layout.js +304 -0
- package/dist/peek.js +1 -0
- package/dist/pick.d.ts +1 -0
- package/dist/pick.js +11 -1
- package/dist/popups.d.ts +17 -0
- package/dist/popups.js +1 -0
- package/dist/project-language.d.ts +8 -0
- package/dist/project-language.js +34 -2
- package/dist/refresher.d.ts +1 -0
- package/dist/refresher.js +5 -0
- package/dist/rename-model.d.ts +1 -1
- package/dist/rename-model.js +3 -7
- package/dist/rename.js +5 -8
- package/dist/rendered-docs.d.ts +62 -0
- package/dist/rendered-docs.js +368 -0
- package/dist/row-host.d.ts +2 -0
- package/dist/row-host.js +11 -3
- package/dist/semantic-delta.d.ts +2 -0
- package/dist/semantic-delta.js +27 -0
- package/dist/semantic-model.js +16 -0
- package/dist/semantic-tokens.d.ts +26 -1
- package/dist/semantic-tokens.js +174 -14
- package/dist/shortcut-keys.d.ts +2 -0
- package/dist/shortcut-keys.js +6 -2
- package/dist/signature.js +1 -1
- package/dist/snippet-field-transforms.d.ts +30 -0
- package/dist/snippet-field-transforms.js +116 -0
- package/dist/snippet-indent.d.ts +2 -0
- package/dist/snippet-indent.js +49 -0
- package/dist/snippet-range-order.d.ts +3 -0
- package/dist/snippet-range-order.js +19 -0
- package/dist/snippet-session.d.ts +42 -6
- package/dist/snippet-session.js +650 -53
- package/dist/snippet-transform-client.d.ts +19 -0
- package/dist/snippet-transform-client.js +66 -0
- package/dist/snippet-transform-format.d.ts +15 -0
- package/dist/snippet-transform-format.js +302 -0
- package/dist/snippet-transform-protocol.d.ts +45 -0
- package/dist/snippet-transform-protocol.js +8 -0
- package/dist/snippet-transform-queue.d.ts +32 -0
- package/dist/snippet-transform-queue.js +173 -0
- package/dist/snippet-transform-worker.d.ts +10 -0
- package/dist/snippet-transform-worker.js +41 -0
- package/dist/snippet-variable-names.d.ts +1 -0
- package/dist/snippet-variable-names.js +36 -0
- package/dist/snippet-variables.d.ts +7 -0
- package/dist/snippet-variables.js +66 -0
- package/dist/snippet.d.ts +30 -3
- package/dist/snippet.js +402 -87
- package/dist/split-alignment.d.ts +6 -0
- package/dist/split-alignment.js +38 -0
- package/dist/split-scroll.d.ts +14 -0
- package/dist/split-scroll.js +45 -0
- package/dist/symbols.d.ts +2 -1
- package/dist/symbols.js +39 -7
- package/dist/testing.d.ts +5 -1
- package/dist/testing.js +12 -0
- package/dist/workspace-edit.d.ts +25 -3
- package/dist/workspace-edit.js +282 -143
- package/package.json +10 -5
- package/src/CallHierarchyPanel.tsx +238 -0
- package/src/CompletionPopup.tsx +12 -1
- package/src/DiffView.tsx +262 -0
- package/src/EditorContextMenu.tsx +1 -0
- package/src/EditorView.tsx +21 -2
- package/src/FindReplace.tsx +51 -13
- package/src/HoverCard.tsx +23 -21
- package/src/LanguagePopups.tsx +5 -0
- package/src/Markdown.tsx +10 -3
- package/src/PeekPanel.tsx +2 -3
- package/src/PickPopup.tsx +18 -2
- package/src/RenameCard.tsx +18 -0
- package/src/RenderedDocs.tsx +155 -0
- package/src/SplitDiffView.tsx +337 -0
- package/src/SymbolPicker.tsx +4 -3
- package/src/call-hierarchy-model.ts +158 -0
- package/src/call-hierarchy.ts +441 -0
- package/src/code-actions-model.ts +17 -11
- package/src/code-actions.ts +3 -1
- package/src/completion-model.ts +61 -35
- package/src/completion.ts +302 -42
- package/src/diagnostics.ts +8 -6
- package/src/diff-expansion.ts +49 -0
- package/src/diff-overlays.tsx +69 -0
- package/src/diff-syntax.ts +67 -0
- package/src/diff-wordmarks.ts +31 -0
- package/src/doc-comment-model.ts +336 -0
- package/src/editor-language.ts +21 -5
- package/src/editor-react.css +79 -0
- package/src/format-on-type.ts +111 -0
- package/src/host-types.ts +19 -0
- package/src/hover.ts +18 -3
- package/src/index.ts +27 -4
- package/src/inlay-hints.ts +394 -18
- package/src/language-ids.ts +4 -2
- package/src/locales/en.json +114 -3
- package/src/locales/nl.json +114 -3
- package/src/models.ts +40 -1
- package/src/patch-decorations.ts +224 -0
- package/src/patch-layout.ts +388 -0
- package/src/peek.ts +1 -0
- package/src/pick.ts +12 -1
- package/src/popups.ts +24 -0
- package/src/project-language.ts +43 -2
- package/src/refresher.ts +6 -0
- package/src/rename-model.ts +4 -8
- package/src/rename.ts +5 -8
- package/src/rendered-docs.ts +422 -0
- package/src/row-host.ts +12 -3
- package/src/semantic-delta.ts +29 -0
- package/src/semantic-model.ts +17 -0
- package/src/semantic-tokens.ts +202 -19
- package/src/shortcut-keys.ts +6 -2
- package/src/signature.ts +1 -1
- package/src/snippet-field-transforms.ts +144 -0
- package/src/snippet-indent.ts +53 -0
- package/src/snippet-range-order.ts +19 -0
- package/src/snippet-session.ts +797 -56
- package/src/snippet-transform-client.ts +84 -0
- package/src/snippet-transform-format.ts +325 -0
- package/src/snippet-transform-protocol.ts +24 -0
- package/src/snippet-transform-queue.ts +199 -0
- package/src/snippet-transform-worker.ts +58 -0
- package/src/snippet-variable-names.ts +36 -0
- package/src/snippet-variables.ts +74 -0
- package/src/snippet.ts +452 -89
- package/src/split-alignment.ts +45 -0
- package/src/split-scroll.ts +54 -0
- package/src/symbols.ts +43 -7
- package/src/testing.ts +25 -0
- package/src/workspace-edit.ts +347 -169
package/dist/language-ids.js
CHANGED
|
@@ -16,7 +16,8 @@ const LSP_IDS = {
|
|
|
16
16
|
python: 'python',
|
|
17
17
|
shellscript: 'shellscript',
|
|
18
18
|
docker: 'dockerfile',
|
|
19
|
-
twig: 'twig'
|
|
19
|
+
twig: 'twig',
|
|
20
|
+
sql: 'sql'
|
|
20
21
|
};
|
|
21
22
|
/* The LSP language id of a file, or null when no language server here knows its language. */
|
|
22
23
|
export function lspLanguageIdOf(language) {
|
|
@@ -43,7 +44,8 @@ const PATH_IDS = {
|
|
|
43
44
|
scss: 'scss',
|
|
44
45
|
html: 'html',
|
|
45
46
|
md: 'markdown',
|
|
46
|
-
twig: 'twig'
|
|
47
|
+
twig: 'twig',
|
|
48
|
+
sql: 'sql'
|
|
47
49
|
};
|
|
48
50
|
/* The highlighter id for the code of a file we only know by its path, such as a place another file refers to. */
|
|
49
51
|
export function shikiLanguageOfPath(path) {
|
package/dist/locales/en.json
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"line": "Line {{line}}",
|
|
10
10
|
"none": "No information for this position"
|
|
11
11
|
},
|
|
12
|
+
"inlay": {
|
|
13
|
+
"failed": "The hint's action failed: {{message}}"
|
|
14
|
+
},
|
|
12
15
|
"edit": {
|
|
13
16
|
"staged_one": "{{count}} file changed and not saved yet",
|
|
14
17
|
"staged_other": "{{count}} files changed and not saved yet",
|
|
@@ -30,6 +33,10 @@
|
|
|
30
33
|
"otherFiles_other": "and {{count}} other files",
|
|
31
34
|
"moves_one": "moves {{count}} file",
|
|
32
35
|
"moves_other": "moves {{count}} files",
|
|
36
|
+
"creates_one": "creates {{count}} file",
|
|
37
|
+
"creates_other": "creates {{count}} files",
|
|
38
|
+
"deletes_one": "deletes {{count}} file",
|
|
39
|
+
"deletes_other": "deletes {{count}} files",
|
|
33
40
|
"groups": {
|
|
34
41
|
"quickfix": "Quick fix",
|
|
35
42
|
"rewrite": "Rewrite",
|
|
@@ -56,7 +63,12 @@
|
|
|
56
63
|
"cancel": "Cancel",
|
|
57
64
|
"apply": "Rename",
|
|
58
65
|
"suggestions": "Suggested names",
|
|
59
|
-
"useSuggestion": "Use suggestion"
|
|
66
|
+
"useSuggestion": "Use suggestion",
|
|
67
|
+
"operations": {
|
|
68
|
+
"create": "Creates",
|
|
69
|
+
"rename": "Moves",
|
|
70
|
+
"delete": "Deletes"
|
|
71
|
+
}
|
|
60
72
|
},
|
|
61
73
|
"navigation": {
|
|
62
74
|
"unavailable": "No language server answers that here",
|
|
@@ -84,6 +96,33 @@
|
|
|
84
96
|
"noDefinition": "No definition found",
|
|
85
97
|
"unavailableDefinition": "No language server finds definitions in this file"
|
|
86
98
|
},
|
|
99
|
+
"callHierarchy": {
|
|
100
|
+
"unavailable": "No language server finds calls in this file",
|
|
101
|
+
"none": "No symbol with calls found here",
|
|
102
|
+
"failed": "Could not look up the calls: {{message}}",
|
|
103
|
+
"label": "Call hierarchy",
|
|
104
|
+
"direction": "Direction",
|
|
105
|
+
"incoming": "Callers",
|
|
106
|
+
"outgoing": "Callees",
|
|
107
|
+
"close": "Close",
|
|
108
|
+
"loading": "Loading…",
|
|
109
|
+
"noIncoming": "No callers",
|
|
110
|
+
"noOutgoing": "No callees",
|
|
111
|
+
"retry": "Could not load the calls: {{message}}. Press to try again",
|
|
112
|
+
"more_one": "Show {{formatted}} more call ({{hidden}} left)",
|
|
113
|
+
"more_other": "Show {{formatted}} more calls ({{hidden}} left)",
|
|
114
|
+
"sites_one": "{{formatted}} call",
|
|
115
|
+
"sites_other": "{{formatted}} calls",
|
|
116
|
+
"site": "Call {{current}} of {{total}}",
|
|
117
|
+
"previousSite": "Previous call",
|
|
118
|
+
"nextSite": "Next call",
|
|
119
|
+
"announce": {
|
|
120
|
+
"incoming_one": "{{count}} caller of {{name}}",
|
|
121
|
+
"incoming_other": "{{count}} callers of {{name}}",
|
|
122
|
+
"outgoing_one": "{{count}} callee of {{name}}",
|
|
123
|
+
"outgoing_other": "{{count}} callees of {{name}}"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
87
126
|
"codeVision": {
|
|
88
127
|
"usagesNone": "No usages",
|
|
89
128
|
"usages_one": "{{formatted}} usage",
|
|
@@ -126,20 +165,65 @@
|
|
|
126
165
|
"copy": "Copy",
|
|
127
166
|
"paste": "Paste"
|
|
128
167
|
},
|
|
168
|
+
"snippet": {
|
|
169
|
+
"choices": "Snippet choice"
|
|
170
|
+
},
|
|
129
171
|
"completion": {
|
|
172
|
+
"tooLarge": "Completion is too large to insert",
|
|
130
173
|
"insert": "Insert",
|
|
131
174
|
"replace": "Replace",
|
|
132
175
|
"details": "Details",
|
|
133
|
-
"none": "No suggestions"
|
|
176
|
+
"none": "No suggestions",
|
|
177
|
+
"transformBusy": "Snippet transforms are busy; try again",
|
|
178
|
+
"transformFailed": "Snippet transform could not be applied"
|
|
134
179
|
},
|
|
135
180
|
"history": {
|
|
136
181
|
"recent": "Recent locations"
|
|
182
|
+
},
|
|
183
|
+
"announce": {
|
|
184
|
+
"problem": "{{severity}}: {{message}}",
|
|
185
|
+
"severity": {
|
|
186
|
+
"error": "Error",
|
|
187
|
+
"warning": "Warning",
|
|
188
|
+
"info": "Information",
|
|
189
|
+
"hint": "Hint"
|
|
190
|
+
},
|
|
191
|
+
"field": "Field {{current}} of {{total}}",
|
|
192
|
+
"fieldChoices_one": "Field {{current}} of {{total}}, {{count}} choice",
|
|
193
|
+
"fieldChoices_other": "Field {{current}} of {{total}}, {{count}} choices"
|
|
194
|
+
},
|
|
195
|
+
"fold": {
|
|
196
|
+
"fold": "Fold lines {{start}} to {{end}}",
|
|
197
|
+
"unfold": "Unfold lines {{start}} to {{end}}"
|
|
198
|
+
},
|
|
199
|
+
"docs": {
|
|
200
|
+
"label": "Rendered documentation",
|
|
201
|
+
"labelNamed": "Rendered documentation: {{- summary}}",
|
|
202
|
+
"render": "Show rendered documentation",
|
|
203
|
+
"showSource": "Show documentation source",
|
|
204
|
+
"tags": {
|
|
205
|
+
"deprecated": "Deprecated",
|
|
206
|
+
"template": "Type parameters",
|
|
207
|
+
"param": "Parameters",
|
|
208
|
+
"property": "Properties",
|
|
209
|
+
"type": "Type",
|
|
210
|
+
"var": "Variable",
|
|
211
|
+
"return": "Returns",
|
|
212
|
+
"yield": "Yields",
|
|
213
|
+
"throws": "Throws",
|
|
214
|
+
"see": "See also",
|
|
215
|
+
"example": "Example",
|
|
216
|
+
"since": "Since",
|
|
217
|
+
"version": "Version",
|
|
218
|
+
"author": "Author"
|
|
219
|
+
}
|
|
137
220
|
}
|
|
138
221
|
},
|
|
139
222
|
"commands": {
|
|
140
223
|
"goToDefinition": "Go to definition",
|
|
141
224
|
"goToTypeDefinition": "Go to type definition",
|
|
142
225
|
"goToImplementation": "Go to implementation",
|
|
226
|
+
"callHierarchy": "Call hierarchy",
|
|
143
227
|
"peekReferences": "Peek references",
|
|
144
228
|
"renameSymbol": "Rename symbol",
|
|
145
229
|
"codeActions": "Code actions",
|
|
@@ -148,6 +232,7 @@
|
|
|
148
232
|
"find": {
|
|
149
233
|
"label": "Find",
|
|
150
234
|
"count": "{{current}} / {{total}}",
|
|
235
|
+
"countLimited": "{{current}} / {{total}}+",
|
|
151
236
|
"none": "No results",
|
|
152
237
|
"invalid": "Invalid regular expression",
|
|
153
238
|
"caseSensitive": "Match case",
|
|
@@ -166,7 +251,33 @@
|
|
|
166
251
|
"allLabel": "Replace all",
|
|
167
252
|
"preserveCase": "Preserve case",
|
|
168
253
|
"toggle": "Show replace",
|
|
169
|
-
"hide": "Hide replace"
|
|
254
|
+
"hide": "Hide replace",
|
|
255
|
+
"failed": {
|
|
256
|
+
"limit": "Too much to replace at once ({{edits}} edits or {{characters}} output characters)",
|
|
257
|
+
"timeout": "Replacement timed out; the text was not changed",
|
|
258
|
+
"unavailable": "Replacement needs the search worker",
|
|
259
|
+
"error": "Could not replace; the text was not changed"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"countMore": "{{total}}+ matches",
|
|
263
|
+
"searching": "Searching…",
|
|
264
|
+
"large": "Large document: press Enter to search",
|
|
265
|
+
"replaced": "Replaced {{count}} matches",
|
|
266
|
+
"failed": {
|
|
267
|
+
"timeout": "Search timed out; press Enter to retry",
|
|
268
|
+
"unavailable": "Regex search is unavailable",
|
|
269
|
+
"invalid": "Invalid regular expression",
|
|
270
|
+
"error": "Could not finish the search"
|
|
170
271
|
}
|
|
272
|
+
},
|
|
273
|
+
"diff": {
|
|
274
|
+
"hidden": "Show {{count}} hidden lines",
|
|
275
|
+
"contextLimit": "Context limit reached",
|
|
276
|
+
"oldSide": "Before",
|
|
277
|
+
"newSide": "After",
|
|
278
|
+
"noNewline": "No final newline",
|
|
279
|
+
"added": "Added, new line {{number}}",
|
|
280
|
+
"removed": "Removed, old line {{number}}",
|
|
281
|
+
"unchanged": "Old line {{old}}, new line {{new}}"
|
|
171
282
|
}
|
|
172
283
|
}
|
package/dist/locales/nl.json
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"line": "Regel {{line}}",
|
|
10
10
|
"none": "Geen informatie voor deze plek"
|
|
11
11
|
},
|
|
12
|
+
"inlay": {
|
|
13
|
+
"failed": "De actie van de hint is mislukt: {{message}}"
|
|
14
|
+
},
|
|
12
15
|
"edit": {
|
|
13
16
|
"staged_one": "{{count}} bestand gewijzigd en nog niet opgeslagen",
|
|
14
17
|
"staged_other": "{{count}} bestanden gewijzigd en nog niet opgeslagen",
|
|
@@ -30,6 +33,10 @@
|
|
|
30
33
|
"otherFiles_other": "en nog {{count}} bestanden",
|
|
31
34
|
"moves_one": "verplaatst {{count}} bestand",
|
|
32
35
|
"moves_other": "verplaatst {{count}} bestanden",
|
|
36
|
+
"creates_one": "maakt {{count}} bestand aan",
|
|
37
|
+
"creates_other": "maakt {{count}} bestanden aan",
|
|
38
|
+
"deletes_one": "verwijdert {{count}} bestand",
|
|
39
|
+
"deletes_other": "verwijdert {{count}} bestanden",
|
|
33
40
|
"groups": {
|
|
34
41
|
"quickfix": "Quick fix",
|
|
35
42
|
"rewrite": "Herschrijven",
|
|
@@ -56,7 +63,12 @@
|
|
|
56
63
|
"cancel": "Annuleer",
|
|
57
64
|
"apply": "Hernoem",
|
|
58
65
|
"suggestions": "Voorgestelde namen",
|
|
59
|
-
"useSuggestion": "Suggestie gebruiken"
|
|
66
|
+
"useSuggestion": "Suggestie gebruiken",
|
|
67
|
+
"operations": {
|
|
68
|
+
"create": "Maakt aan",
|
|
69
|
+
"rename": "Verplaatst",
|
|
70
|
+
"delete": "Verwijdert"
|
|
71
|
+
}
|
|
60
72
|
},
|
|
61
73
|
"navigation": {
|
|
62
74
|
"unavailable": "Geen language server die dat hier beantwoordt",
|
|
@@ -84,6 +96,33 @@
|
|
|
84
96
|
"noDefinition": "Geen definitie gevonden",
|
|
85
97
|
"unavailableDefinition": "Geen language server vindt definities in dit bestand"
|
|
86
98
|
},
|
|
99
|
+
"callHierarchy": {
|
|
100
|
+
"unavailable": "Geen language server vindt aanroepen in dit bestand",
|
|
101
|
+
"none": "Hier is geen symbool met aanroepen gevonden",
|
|
102
|
+
"failed": "Aanroepen opzoeken mislukt: {{message}}",
|
|
103
|
+
"label": "Aanroephiërarchie",
|
|
104
|
+
"direction": "Richting",
|
|
105
|
+
"incoming": "Aanroepers",
|
|
106
|
+
"outgoing": "Aangeroepen",
|
|
107
|
+
"close": "Sluit",
|
|
108
|
+
"loading": "Laden…",
|
|
109
|
+
"noIncoming": "Geen aanroepers",
|
|
110
|
+
"noOutgoing": "Roept niets aan",
|
|
111
|
+
"retry": "Aanroepen laden mislukt: {{message}}. Druk om opnieuw te proberen",
|
|
112
|
+
"more_one": "Toon nog {{formatted}} aanroep ({{hidden}} over)",
|
|
113
|
+
"more_other": "Toon nog {{formatted}} aanroepen ({{hidden}} over)",
|
|
114
|
+
"sites_one": "{{formatted}} aanroep",
|
|
115
|
+
"sites_other": "{{formatted}} aanroepen",
|
|
116
|
+
"site": "Aanroep {{current}} van {{total}}",
|
|
117
|
+
"previousSite": "Vorige aanroep",
|
|
118
|
+
"nextSite": "Volgende aanroep",
|
|
119
|
+
"announce": {
|
|
120
|
+
"incoming_one": "{{count}} aanroeper van {{name}}",
|
|
121
|
+
"incoming_other": "{{count}} aanroepers van {{name}}",
|
|
122
|
+
"outgoing_one": "{{count}} aangeroepen door {{name}}",
|
|
123
|
+
"outgoing_other": "{{count}} aangeroepen door {{name}}"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
87
126
|
"codeVision": {
|
|
88
127
|
"usagesNone": "Niet gebruikt",
|
|
89
128
|
"usages_one": "{{formatted}} keer gebruikt",
|
|
@@ -126,20 +165,65 @@
|
|
|
126
165
|
"copy": "Kopieer",
|
|
127
166
|
"paste": "Plak"
|
|
128
167
|
},
|
|
168
|
+
"snippet": {
|
|
169
|
+
"choices": "Snippetkeuze"
|
|
170
|
+
},
|
|
129
171
|
"completion": {
|
|
172
|
+
"tooLarge": "Deze aanvulling is te groot om in te voegen",
|
|
130
173
|
"insert": "Invoegen",
|
|
131
174
|
"replace": "Vervangen",
|
|
132
175
|
"details": "Details",
|
|
133
|
-
"none": "Geen suggesties"
|
|
176
|
+
"none": "Geen suggesties",
|
|
177
|
+
"transformBusy": "Snippettransformaties zijn bezig; probeer het opnieuw",
|
|
178
|
+
"transformFailed": "Snippettransformatie kon niet worden toegepast"
|
|
134
179
|
},
|
|
135
180
|
"history": {
|
|
136
181
|
"recent": "Recente plekken"
|
|
182
|
+
},
|
|
183
|
+
"announce": {
|
|
184
|
+
"problem": "{{severity}}: {{message}}",
|
|
185
|
+
"severity": {
|
|
186
|
+
"error": "Fout",
|
|
187
|
+
"warning": "Waarschuwing",
|
|
188
|
+
"info": "Informatie",
|
|
189
|
+
"hint": "Hint"
|
|
190
|
+
},
|
|
191
|
+
"field": "Veld {{current}} van {{total}}",
|
|
192
|
+
"fieldChoices_one": "Veld {{current}} van {{total}}, {{count}} keuze",
|
|
193
|
+
"fieldChoices_other": "Veld {{current}} van {{total}}, {{count}} keuzes"
|
|
194
|
+
},
|
|
195
|
+
"fold": {
|
|
196
|
+
"fold": "Regels {{start}} tot {{end}} invouwen",
|
|
197
|
+
"unfold": "Regels {{start}} tot {{end}} uitvouwen"
|
|
198
|
+
},
|
|
199
|
+
"docs": {
|
|
200
|
+
"label": "Weergegeven documentatie",
|
|
201
|
+
"labelNamed": "Weergegeven documentatie: {{- summary}}",
|
|
202
|
+
"render": "Toon weergegeven documentatie",
|
|
203
|
+
"showSource": "Toon bron van documentatie",
|
|
204
|
+
"tags": {
|
|
205
|
+
"deprecated": "Verouderd",
|
|
206
|
+
"template": "Typeparameters",
|
|
207
|
+
"param": "Parameters",
|
|
208
|
+
"property": "Eigenschappen",
|
|
209
|
+
"type": "Type",
|
|
210
|
+
"var": "Variabele",
|
|
211
|
+
"return": "Geeft terug",
|
|
212
|
+
"yield": "Levert op",
|
|
213
|
+
"throws": "Gooit",
|
|
214
|
+
"see": "Zie ook",
|
|
215
|
+
"example": "Voorbeeld",
|
|
216
|
+
"since": "Sinds",
|
|
217
|
+
"version": "Versie",
|
|
218
|
+
"author": "Auteur"
|
|
219
|
+
}
|
|
137
220
|
}
|
|
138
221
|
},
|
|
139
222
|
"commands": {
|
|
140
223
|
"goToDefinition": "Ga naar definitie",
|
|
141
224
|
"goToTypeDefinition": "Ga naar typedefinitie",
|
|
142
225
|
"goToImplementation": "Ga naar implementatie",
|
|
226
|
+
"callHierarchy": "Aanroephiërarchie",
|
|
143
227
|
"peekReferences": "Bekijk referenties",
|
|
144
228
|
"renameSymbol": "Symbool hernoemen",
|
|
145
229
|
"codeActions": "Codeacties",
|
|
@@ -148,6 +232,7 @@
|
|
|
148
232
|
"find": {
|
|
149
233
|
"label": "Zoeken",
|
|
150
234
|
"count": "{{current}} / {{total}}",
|
|
235
|
+
"countLimited": "{{current}} / {{total}}+",
|
|
151
236
|
"none": "Geen resultaten",
|
|
152
237
|
"invalid": "Ongeldige reguliere expressie",
|
|
153
238
|
"caseSensitive": "Hoofdlettergevoelig",
|
|
@@ -166,7 +251,33 @@
|
|
|
166
251
|
"allLabel": "Alles vervangen",
|
|
167
252
|
"preserveCase": "Hoofdletters behouden",
|
|
168
253
|
"toggle": "Vervangen tonen",
|
|
169
|
-
"hide": "Vervangen verbergen"
|
|
254
|
+
"hide": "Vervangen verbergen",
|
|
255
|
+
"failed": {
|
|
256
|
+
"limit": "Te veel om ineens te vervangen ({{edits}} edits of {{characters}} uitvoertekens)",
|
|
257
|
+
"timeout": "Vervangen duurde te lang; de tekst is niet gewijzigd",
|
|
258
|
+
"unavailable": "Vervangen vereist de zoekworker",
|
|
259
|
+
"error": "Vervangen is niet gelukt; de tekst is niet gewijzigd"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"countMore": "{{total}}+ resultaten",
|
|
263
|
+
"searching": "Zoeken…",
|
|
264
|
+
"large": "Groot document: druk op Enter om te zoeken",
|
|
265
|
+
"replaced": "{{count}} resultaten vervangen",
|
|
266
|
+
"failed": {
|
|
267
|
+
"timeout": "Zoeken duurde te lang; druk op Enter om opnieuw te proberen",
|
|
268
|
+
"unavailable": "Zoeken met regex is niet beschikbaar",
|
|
269
|
+
"invalid": "Ongeldige reguliere expressie",
|
|
270
|
+
"error": "Zoeken kon niet worden voltooid"
|
|
170
271
|
}
|
|
272
|
+
},
|
|
273
|
+
"diff": {
|
|
274
|
+
"hidden": "Toon {{count}} verborgen regels",
|
|
275
|
+
"contextLimit": "Limiet voor context bereikt",
|
|
276
|
+
"oldSide": "Voor de wijziging",
|
|
277
|
+
"newSide": "Na de wijziging",
|
|
278
|
+
"noNewline": "Geen afsluitende nieuwe regel",
|
|
279
|
+
"added": "Toegevoegd, nieuwe regel {{number}}",
|
|
280
|
+
"removed": "Verwijderd, oude regel {{number}}",
|
|
281
|
+
"unchanged": "Oude regel {{old}}, nieuwe regel {{new}}"
|
|
171
282
|
}
|
|
172
283
|
}
|
package/dist/models.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
export { isIdentifierCharacter, identifierPrefix, type MatchDetail, matchDetail, matchScore, editRangeOf, itemsOf, prefixFor, type Ranked, rankCompletions, matchedCharacters, qualifierOf, qualifiersOf, snippetToText, METHOD_KIND, FUNCTION_KIND, CONSTRUCTOR_KIND, CLASS_KIND, SNIPPET_FORMAT, type Insertion, insertionOf, mirroredInsertions, documentationText, completionDocsOf, type KindTone, kindLetterOf, kindToneOf, type RowWindow, rowWindow } from './completion-model.ts';
|
|
1
|
+
export { isIdentifierCharacter, identifierPrefix, type MatchDetail, matchDetail, matchScore, editRangeOf, itemsOf, prefixFor, type Ranked, rankCompletions, matchedCharacters, qualifierOf, qualifiersOf, snippetToText, METHOD_KIND, FUNCTION_KIND, CONSTRUCTOR_KIND, CLASS_KIND, SNIPPET_FORMAT, type Insertion, type SnippetInsertionOptions, insertionOf, mirroredInsertions, documentationText, completionDocsOf, type KindTone, kindLetterOf, kindToneOf, type RowWindow, rowWindow } from './completion-model.ts';
|
|
2
2
|
export { PARAMETER_HINTS_COMMAND, type CallPlan, type CallSite, isCallItem, hasParameters, planCall, withParentheses } from './completion-call.ts';
|
|
3
3
|
export { type Problem, severityOf, markerOf, comparePositions, shiftPosition, shiftRange, rangeHolds, problemsAt, neighborProblem, codeLabelOf } from './diagnostics-model.ts';
|
|
4
4
|
export { type SignatureBlock, type HoverText, splitSignatures, hoverTextOf, isEmptyHover, locationsOf, sameRange, type DocTag, splitDocTags, type HoverSection, type BaselineLevel, type Baseline, docblockMarkdown, type MarkdownPart, markdownParts, hoverSectionsOf } from './hover-content.ts';
|
|
5
5
|
export { type SignatureViewModel, parameterSpan, signatureViewOf } from './signature-model.ts';
|
|
6
6
|
export { wordRangeAt, type RenameTarget, renameTargetOf, type Occurrences, occurrencesOf, type RenameRow, type RenameFile, renameRowsOf, renamePreviewOf } from './rename-model.ts';
|
|
7
7
|
export { type NameRange, type PeekPlace, type PeekFile, PEEK_READ_FILES, peekFilesOf, type PeekSnippet, snippetOf, definitionSnippetOf, distinguishingFolders, visualColumnOf } from './peek-model.ts';
|
|
8
|
+
export { type CallDirection, type CallLoad, type CallNode, type CallRow, CALL_LEVEL_LIMIT, rootsOf, childrenOf, rowsOf, stepsOf, targetOf, statusIdOf, moreIdOf } from './call-hierarchy-model.ts';
|
|
8
9
|
export { type SymbolGroup, SYMBOL_GROUPS, groupOfKind, letterOfKind, type SymbolTone, toneOfKind, type SymbolEntry, entriesOf, scoreOf, filterEntries, type EntryGroup, groupEntries, type PickerMode, modeOf, type WorkspaceEntry, workspaceEntriesOf } from './symbol-picker-model.ts';
|
|
9
10
|
export { SYMBOL_LINK_CLASS, isTypeName, linkTypeNames, declaredNameOf, placesOfName } from './symbol-links.ts';
|
|
10
11
|
export { scopesOf, decodeSemanticTokens } from './semantic-model.ts';
|
|
12
|
+
export { applySemanticEdits } from './semantic-delta.ts';
|
|
11
13
|
export { type ActionGroup, ACTION_GROUPS, REFACTOR_GROUPS, type ActionEntry, groupOf, actionsOf, mergeEntries, isHint, fixableOnLine, diagnosticsAt, type EditPreview, previewOf } from './code-actions-model.ts';
|
|
14
|
+
export { resourceOperationsOf, type ResourceOperationView } from './workspace-edit.ts';
|
|
12
15
|
export { MAX_DECLARATIONS, type CodeVisionDeclaration, type DeclarationSource, startAfterComments, declarationsOf, usagesText } from './code-vision-model.ts';
|
|
13
16
|
export { UNCOMMITTED, mapBlame, type CodeAuthor, type CodeAuthorship, shortName, authorshipOf, authorsText } from './code-authors.ts';
|
|
14
|
-
export { type SnippetStop, type ParsedSnippet, parseSnippet, tabOrder } from './snippet.ts';
|
|
17
|
+
export { type SnippetTransform, type SnippetStop, type SnippetRange, type SnippetField, type SnippetVariableResolver, type SnippetTemplate, compileSnippet, type ParsedSnippet, parseSnippet, tabOrder } from './snippet.ts';
|
|
15
18
|
export { type LineSpan, lineSpanOf, isEmptyRange, inlineRangeOf, type InlineProblem, problemsOnLines, type InlineAnswer, parseAnswer, fitReplacement, endOfInsertion, type DiffSegment, diffSegments, emphasisOf, offsetOf, textInRange, replaceRange, locateSelection } from './proposal-model.ts';
|
|
16
19
|
export { type LineReplacement, replaceLines, replaceAllLines } from './line-edits.ts';
|
|
17
20
|
export { replacedWords } from './word-diff.ts';
|
|
18
21
|
export { type FindOptions, type FindQuery, EMPTY_FIND_QUERY, type TextMatch, type CompiledFind, MATCH_LIMIT, compileFind, matchesIn, stepIndex } from './find-query.ts';
|
|
19
22
|
export { type PopupSize, type PopupPlacement, type PlaceOptions, placePopup, placeBeside } from './popup-placement.ts';
|
|
20
23
|
export { planConflict, type ConflictStretch, type ConflictPlan } from './conflict-model.ts';
|
|
24
|
+
export { patchLayoutOf, DEFAULT_PATCH_LIMITS, type PatchLayout, type PatchLayoutLine, type PatchLineRole, type PatchFileLayout, type PatchFileStatus, type PatchHunkLayout, type PatchLimits } from './patch-layout.ts';
|
package/dist/models.js
CHANGED
|
@@ -5,16 +5,20 @@ export { splitSignatures, hoverTextOf, isEmptyHover, locationsOf, sameRange, spl
|
|
|
5
5
|
export { parameterSpan, signatureViewOf } from './signature-model.js';
|
|
6
6
|
export { wordRangeAt, renameTargetOf, occurrencesOf, renameRowsOf, renamePreviewOf } from './rename-model.js';
|
|
7
7
|
export { PEEK_READ_FILES, peekFilesOf, snippetOf, definitionSnippetOf, distinguishingFolders, visualColumnOf } from './peek-model.js';
|
|
8
|
+
export { CALL_LEVEL_LIMIT, rootsOf, childrenOf, rowsOf, stepsOf, targetOf, statusIdOf, moreIdOf } from './call-hierarchy-model.js';
|
|
8
9
|
export { SYMBOL_GROUPS, groupOfKind, letterOfKind, toneOfKind, entriesOf, scoreOf, filterEntries, groupEntries, modeOf, workspaceEntriesOf } from './symbol-picker-model.js';
|
|
9
10
|
export { SYMBOL_LINK_CLASS, isTypeName, linkTypeNames, declaredNameOf, placesOfName } from './symbol-links.js';
|
|
10
11
|
export { scopesOf, decodeSemanticTokens } from './semantic-model.js';
|
|
12
|
+
export { applySemanticEdits } from './semantic-delta.js';
|
|
11
13
|
export { ACTION_GROUPS, REFACTOR_GROUPS, groupOf, actionsOf, mergeEntries, isHint, fixableOnLine, diagnosticsAt, previewOf } from './code-actions-model.js';
|
|
14
|
+
export { resourceOperationsOf } from './workspace-edit.js';
|
|
12
15
|
export { MAX_DECLARATIONS, startAfterComments, declarationsOf, usagesText } from './code-vision-model.js';
|
|
13
16
|
export { UNCOMMITTED, mapBlame, shortName, authorshipOf, authorsText } from './code-authors.js';
|
|
14
|
-
export { parseSnippet, tabOrder } from './snippet.js';
|
|
17
|
+
export { compileSnippet, parseSnippet, tabOrder } from './snippet.js';
|
|
15
18
|
export { lineSpanOf, isEmptyRange, inlineRangeOf, problemsOnLines, parseAnswer, fitReplacement, endOfInsertion, diffSegments, emphasisOf, offsetOf, textInRange, replaceRange, locateSelection } from './proposal-model.js';
|
|
16
19
|
export { replaceLines, replaceAllLines } from './line-edits.js';
|
|
17
20
|
export { replacedWords } from './word-diff.js';
|
|
18
21
|
export { EMPTY_FIND_QUERY, MATCH_LIMIT, compileFind, matchesIn, stepIndex } from './find-query.js';
|
|
19
22
|
export { placePopup, placeBeside } from './popup-placement.js';
|
|
20
23
|
export { planConflict } from './conflict-model.js';
|
|
24
|
+
export { patchLayoutOf, DEFAULT_PATCH_LIMITS } from './patch-layout.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Editor } from '@adecore/editor';
|
|
2
|
+
import { type PatchLayout, type PatchLimits } from './patch-layout.ts';
|
|
3
|
+
export interface PatchLineLabels {
|
|
4
|
+
added(number: number): string;
|
|
5
|
+
removed(number: number): string;
|
|
6
|
+
unchanged(old: number, fresh: number): string;
|
|
7
|
+
}
|
|
8
|
+
export interface PatchDecorationOptions {
|
|
9
|
+
numbers?: 'single' | 'both';
|
|
10
|
+
labels?: PatchLineLabels;
|
|
11
|
+
limits?: PatchLimits;
|
|
12
|
+
onLayout?(layout: PatchLayout): void;
|
|
13
|
+
delay?: number;
|
|
14
|
+
immediateBelow?: number;
|
|
15
|
+
timer?: PatchTimer;
|
|
16
|
+
}
|
|
17
|
+
export interface PatchTimer {
|
|
18
|
+
set(callback: () => void, delay: number): unknown;
|
|
19
|
+
clear(handle: unknown): void;
|
|
20
|
+
}
|
|
21
|
+
export interface PatchDecoration {
|
|
22
|
+
readonly layout: PatchLayout;
|
|
23
|
+
refresh(): void;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function decoratePatch(editor: Editor, options?: PatchDecorationOptions): PatchDecoration;
|
|
27
|
+
export declare function usePatchDecorations(editor: Editor | null, options?: Omit<PatchDecorationOptions, 'labels' | 'onLayout'>): PatchLayout | null;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { patchLayoutOf } from './patch-layout.js';
|
|
4
|
+
const DEFAULT_TIMER = {
|
|
5
|
+
set: (callback, delay) => setTimeout(callback, delay),
|
|
6
|
+
clear: (handle) => clearTimeout(handle)
|
|
7
|
+
};
|
|
8
|
+
const CHANGE_LAYER = 'patch';
|
|
9
|
+
function numberOf(line, numbers, width) {
|
|
10
|
+
if (line.old === null && line.new === null) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (numbers === 'single') {
|
|
14
|
+
return String(line.new ?? line.old);
|
|
15
|
+
}
|
|
16
|
+
const pad = (value) => (value === null ? '' : String(value)).padStart(width, ' ');
|
|
17
|
+
return `${pad(line.old)} ${pad(line.new)}`;
|
|
18
|
+
}
|
|
19
|
+
/* Runs of one role become one highlight, so the bar of consecutive changed lines is one stripe. */
|
|
20
|
+
function highlightsOf(layout) {
|
|
21
|
+
const highlights = [];
|
|
22
|
+
const marks = [];
|
|
23
|
+
const lines = layout.lines;
|
|
24
|
+
for (let index = 0; index < lines.length; index++) {
|
|
25
|
+
const role = lines[index].role;
|
|
26
|
+
if (role === 'file-header') {
|
|
27
|
+
highlights.push({ startLine: index + 1, endLine: index + 1, color: '--text-muted', fill: '--surface-raised' });
|
|
28
|
+
}
|
|
29
|
+
else if (role === 'hunk-header') {
|
|
30
|
+
highlights.push({ startLine: index + 1, endLine: index + 1, color: '--accent' });
|
|
31
|
+
}
|
|
32
|
+
else if (role === 'added' || role === 'removed') {
|
|
33
|
+
let end = index;
|
|
34
|
+
while (end + 1 < lines.length && lines[end + 1].role === role) {
|
|
35
|
+
end++;
|
|
36
|
+
}
|
|
37
|
+
const removed = role === 'removed';
|
|
38
|
+
highlights.push({
|
|
39
|
+
startLine: index + 1,
|
|
40
|
+
endLine: end + 1,
|
|
41
|
+
color: removed ? '--editor-deleted' : '--editor-added',
|
|
42
|
+
bar: removed ? 'hatched' : 'solid'
|
|
43
|
+
});
|
|
44
|
+
marks.push({ startLine: index + 1, endLine: end + 1, kind: removed ? 'deleted' : 'added' });
|
|
45
|
+
index = end;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return { highlights, marks };
|
|
49
|
+
}
|
|
50
|
+
/*
|
|
51
|
+
* Draws a patch in the editor the way the diff views draw a change: tinted lines, numbers from the hunk
|
|
52
|
+
* headers in the gutter and styled file and hunk headers. The editor stays editable. A small patch is read
|
|
53
|
+
* again on the microtask after an edit, so its decorations are right within a frame; a large one waits for
|
|
54
|
+
* the edits to rest, and `onLayout` always does. Typing costs one pass over the text (bounded by the limits).
|
|
55
|
+
*/
|
|
56
|
+
export function decoratePatch(editor, options = {}) {
|
|
57
|
+
let layout = patchLayoutOf('', options.limits);
|
|
58
|
+
let pending = false;
|
|
59
|
+
let disposed = false;
|
|
60
|
+
let length = 0;
|
|
61
|
+
let wait = null;
|
|
62
|
+
const timer = options.timer ?? DEFAULT_TIMER;
|
|
63
|
+
const delay = options.delay ?? 150;
|
|
64
|
+
const immediateBelow = options.immediateBelow ?? 100_000;
|
|
65
|
+
const clearWait = () => {
|
|
66
|
+
if (wait !== null) {
|
|
67
|
+
timer.clear(wait);
|
|
68
|
+
wait = null;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const after = (callback) => {
|
|
72
|
+
clearWait();
|
|
73
|
+
wait = timer.set(() => {
|
|
74
|
+
wait = null;
|
|
75
|
+
callback();
|
|
76
|
+
}, delay);
|
|
77
|
+
};
|
|
78
|
+
const apply = () => {
|
|
79
|
+
const numbers = options.numbers ?? 'single';
|
|
80
|
+
const lines = layout.lines;
|
|
81
|
+
const width = lines.reduce((digits, line) => Math.max(digits, String(Math.max(line.old ?? 0, line.new ?? 0)).length), 1);
|
|
82
|
+
editor.setLineNumbers((line) => {
|
|
83
|
+
const entry = lines[line];
|
|
84
|
+
return entry === undefined ? null : numberOf(entry, numbers, width);
|
|
85
|
+
});
|
|
86
|
+
const labels = options.labels;
|
|
87
|
+
editor.setLineLabels(labels === undefined
|
|
88
|
+
? null
|
|
89
|
+
: (line) => {
|
|
90
|
+
const entry = lines[line];
|
|
91
|
+
if (entry?.role === 'removed') {
|
|
92
|
+
return labels.removed(entry.old);
|
|
93
|
+
}
|
|
94
|
+
if (entry?.role === 'added') {
|
|
95
|
+
return labels.added(entry.new);
|
|
96
|
+
}
|
|
97
|
+
return entry?.role === 'context' ? labels.unchanged(entry.old, entry.new) : null;
|
|
98
|
+
});
|
|
99
|
+
const { highlights, marks } = highlightsOf(layout);
|
|
100
|
+
editor.setLineHighlights(highlights);
|
|
101
|
+
editor.setChangeMarks(marks, CHANGE_LAYER);
|
|
102
|
+
};
|
|
103
|
+
const decorate = () => {
|
|
104
|
+
pending = false;
|
|
105
|
+
if (disposed) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const text = editor.getText();
|
|
109
|
+
length = text.length;
|
|
110
|
+
layout = patchLayoutOf(text, options.limits);
|
|
111
|
+
apply();
|
|
112
|
+
};
|
|
113
|
+
const announce = () => {
|
|
114
|
+
if (!disposed) {
|
|
115
|
+
options.onLayout?.(layout);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const read = () => {
|
|
119
|
+
clearWait();
|
|
120
|
+
decorate();
|
|
121
|
+
announce();
|
|
122
|
+
};
|
|
123
|
+
const schedule = () => {
|
|
124
|
+
if (length < immediateBelow) {
|
|
125
|
+
if (pending) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
pending = true;
|
|
129
|
+
queueMicrotask(() => {
|
|
130
|
+
decorate();
|
|
131
|
+
after(announce);
|
|
132
|
+
});
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
pending = true;
|
|
136
|
+
after(() => {
|
|
137
|
+
decorate();
|
|
138
|
+
announce();
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const stop = editor.onTextChange(schedule);
|
|
142
|
+
read();
|
|
143
|
+
return {
|
|
144
|
+
get layout() {
|
|
145
|
+
return layout;
|
|
146
|
+
},
|
|
147
|
+
refresh: read,
|
|
148
|
+
dispose() {
|
|
149
|
+
disposed = true;
|
|
150
|
+
clearWait();
|
|
151
|
+
stop();
|
|
152
|
+
editor.setLineNumbers(null);
|
|
153
|
+
editor.setLineLabels(null);
|
|
154
|
+
editor.setLineHighlights([]);
|
|
155
|
+
editor.setChangeMarks([], CHANGE_LAYER);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/* Decorates a mounted editor as a patch for as long as it stands, in the editor namespace's words, and returns the layout for a file tree. */
|
|
160
|
+
export function usePatchDecorations(editor, options = {}) {
|
|
161
|
+
const { t } = useTranslation('editor');
|
|
162
|
+
const [state, setState] = useState(null);
|
|
163
|
+
const { numbers } = options;
|
|
164
|
+
const { maxLines, maxCharacters } = options.limits ?? {};
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (editor === null) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const decoration = decoratePatch(editor, {
|
|
170
|
+
...(numbers === undefined ? {} : { numbers }),
|
|
171
|
+
limits: { ...(maxLines === undefined ? {} : { maxLines }), ...(maxCharacters === undefined ? {} : { maxCharacters }) },
|
|
172
|
+
labels: {
|
|
173
|
+
added: (number) => t('diff.added', { number }),
|
|
174
|
+
removed: (number) => t('diff.removed', { number }),
|
|
175
|
+
unchanged: (old, fresh) => t('diff.unchanged', { old, new: fresh })
|
|
176
|
+
},
|
|
177
|
+
onLayout: (layout) => setState({ editor, layout })
|
|
178
|
+
});
|
|
179
|
+
return () => decoration.dispose();
|
|
180
|
+
}, [editor, numbers, maxLines, maxCharacters, t]);
|
|
181
|
+
return state !== null && state.editor === editor ? state.layout : null;
|
|
182
|
+
}
|