@lvce-editor/test-worker 13.3.0 → 13.5.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/api.d.ts CHANGED
@@ -86,6 +86,8 @@ export interface SelectItem2Options {
86
86
  readonly label: string;
87
87
  }
88
88
 
89
+ export type TokenRow = readonly string[];
90
+
89
91
  export type SearchInputType = "SearchValue" | "ReplaceValue" | "IncludeValue" | "ExcludeValue";
90
92
 
91
93
  interface Workspace {
@@ -162,6 +164,7 @@ interface Dialog {
162
164
 
163
165
  interface Editor {
164
166
  readonly addAllMissingImports: () => Promise<void>;
167
+ readonly cancelSelection: () => Promise<void>;
165
168
  readonly closeColorPicker: () => Promise<void>;
166
169
  readonly closeCompletion: () => Promise<void>;
167
170
  readonly closeCompletionDetails: () => Promise<void>;
@@ -181,6 +184,13 @@ interface Editor {
181
184
  readonly deleteAll: () => Promise<void>;
182
185
  readonly deleteAllLeft: () => Promise<void>;
183
186
  readonly deleteAllRight: () => Promise<void>;
187
+ readonly deleteCharacterLeft: () => Promise<void>;
188
+ readonly deleteCharacterRight: () => Promise<void>;
189
+ readonly deleteHorizontalRight: () => Promise<void>;
190
+ readonly deleteWordLeft: () => Promise<void>;
191
+ readonly deleteWordPartLeft: () => Promise<void>;
192
+ readonly deleteWordPartRight: () => Promise<void>;
193
+ readonly deleteWordRight: () => Promise<void>;
184
194
  readonly disableCompletionsOnType: () => Promise<void>;
185
195
  readonly disableDiagnostics: () => Promise<void>;
186
196
  readonly enableCompletionsOnType: () => Promise<void>;
@@ -215,7 +225,10 @@ interface Editor {
215
225
  readonly selectAllLeft: () => Promise<void>;
216
226
  readonly selectAllOccurrences: () => Promise<void>;
217
227
  readonly selectAllRight: () => Promise<void>;
228
+ readonly selectCharacterLeft: () => Promise<void>;
229
+ readonly selectCharacterRight: () => Promise<void>;
218
230
  readonly selectDown: () => Promise<void>;
231
+ readonly selectLine: () => Promise<void>;
219
232
  readonly selectNextOccurrence: () => Promise<void>;
220
233
  readonly selectPreviousOccurrence: () => Promise<void>;
221
234
  readonly selectUp: () => Promise<void>;
@@ -227,6 +240,7 @@ interface Editor {
227
240
  readonly shouldHaveDiagnostics: (expectedDiagnostics: readonly Diagnostic[]) => Promise<void>;
228
241
  readonly shouldHaveSelections: (expectedSelections: Uint32Array) => Promise<void>;
229
242
  readonly shouldHaveText: (expectedText: string) => Promise<void>;
243
+ readonly shouldHaveTokens: (expectedTokens: readonly TokenRow[]) => Promise<void>;
230
244
  readonly showHover: () => Promise<void>;
231
245
  readonly sortImports: () => Promise<void>;
232
246
  readonly sourceActionsSelectCurrent: () => Promise<void>;
@@ -1897,6 +1897,9 @@ const Settings = {
1897
1897
  const setCursor = async (rowIndex, columnIndex) => {
1898
1898
  await invoke('Editor.cursorSet', rowIndex, columnIndex);
1899
1899
  };
1900
+ const cancelSelection = async () => {
1901
+ await invoke('Editor.cancelSelection');
1902
+ };
1900
1903
  const openCompletion = async () => {
1901
1904
  await invoke('Editor.openCompletion');
1902
1905
  };
@@ -1930,6 +1933,9 @@ const cursorDown = async () => {
1930
1933
  const selectDown$1 = async () => {
1931
1934
  await invoke('Editor.selectDown');
1932
1935
  };
1936
+ const selectLine = async () => {
1937
+ await invoke('Editor.selectLine');
1938
+ };
1933
1939
  const selectAllLeft = async () => {
1934
1940
  await invoke('Editor.selectAllLeft');
1935
1941
  };
@@ -1957,6 +1963,33 @@ const setText = async text => {
1957
1963
  const deleteAll = async () => {
1958
1964
  await invoke('Editor.deleteAll');
1959
1965
  };
1966
+ const selectCharacterLeft = async () => {
1967
+ await invoke('Editor.selectCharacterLeft');
1968
+ };
1969
+ const selectCharacterRight = async () => {
1970
+ await invoke('Editor.selectCharacterRight');
1971
+ };
1972
+ const deleteCharacterLeft = async () => {
1973
+ await invoke('Editor.deleteCharacterLeft');
1974
+ };
1975
+ const deleteWordPartRight = async () => {
1976
+ await invoke('Editor.deleteWordPartRight');
1977
+ };
1978
+ const deleteWordRight = async () => {
1979
+ await invoke('Editor.deleteWordRight');
1980
+ };
1981
+ const deleteWordPartLeft = async () => {
1982
+ await invoke('Editor.deleteWordPartLeft');
1983
+ };
1984
+ const deleteWordLeft = async () => {
1985
+ await invoke('Editor.deleteWordLeft');
1986
+ };
1987
+ const deleteHorizontalRight = async () => {
1988
+ await invoke('Editor.deleteHorizontalRight');
1989
+ };
1990
+ const deleteCharacterRight = async () => {
1991
+ await invoke('Editor.deleteCharacterRight');
1992
+ };
1960
1993
  const cursorWordRight = async () => {
1961
1994
  await invoke('Editor.cursorWordRight');
1962
1995
  };
@@ -2105,6 +2138,33 @@ const shouldHaveText = async expectedText => {
2105
2138
  throw new Error(`Expected editor to have text ${expectedText} but was ${text}`);
2106
2139
  }
2107
2140
  };
2141
+ const areTokensEqual = (actual, expected) => {
2142
+ if (actual.length !== expected.length) {
2143
+ return false;
2144
+ }
2145
+ for (let i = 0; i < actual.length; i++) {
2146
+ const actualRow = actual[i];
2147
+ const expectedRow = expected[i];
2148
+ if (actualRow.length !== expectedRow.length) {
2149
+ return false;
2150
+ }
2151
+ for (let j = 0; j < actualRow.length; j++) {
2152
+ if (actualRow[j] !== expectedRow[j]) {
2153
+ return false;
2154
+ }
2155
+ }
2156
+ }
2157
+ return true;
2158
+ };
2159
+ const shouldHaveTokens = async expectedTokens => {
2160
+ const key = await getEditorKey();
2161
+ const text = await invoke$1('Editor.getTokens', key);
2162
+ if (!areTokensEqual(text, expectedTokens)) {
2163
+ const stringifiedActual = JSON.stringify(text);
2164
+ const stringifiedExpected = JSON.stringify(expectedTokens);
2165
+ throw new Error(`Expected editor to have tokens ${stringifiedExpected} but was ${stringifiedActual}`);
2166
+ }
2167
+ };
2108
2168
  const shouldHaveSelections = async expectedSelections => {
2109
2169
  const key = await getEditorKey();
2110
2170
  const selections = await invoke$1('Editor.getSelections', key);
@@ -2150,6 +2210,7 @@ const disableDiagnostics = async () => {
2150
2210
 
2151
2211
  const Editor = {
2152
2212
  addAllMissingImports,
2213
+ cancelSelection,
2153
2214
  closeColorPicker,
2154
2215
  closeCompletion,
2155
2216
  closeCompletionDetails,
@@ -2169,6 +2230,13 @@ const Editor = {
2169
2230
  deleteAll,
2170
2231
  deleteAllLeft,
2171
2232
  deleteAllRight,
2233
+ deleteCharacterLeft,
2234
+ deleteCharacterRight,
2235
+ deleteHorizontalRight,
2236
+ deleteWordLeft,
2237
+ deleteWordPartLeft,
2238
+ deleteWordPartRight,
2239
+ deleteWordRight,
2172
2240
  disableCompletionsOnType,
2173
2241
  disableDiagnostics,
2174
2242
  enableCompletionsOnType,
@@ -2203,7 +2271,10 @@ const Editor = {
2203
2271
  selectAllLeft,
2204
2272
  selectAllOccurrences,
2205
2273
  selectAllRight,
2274
+ selectCharacterLeft,
2275
+ selectCharacterRight,
2206
2276
  selectDown: selectDown$1,
2277
+ selectLine,
2207
2278
  selectNextOccurrence,
2208
2279
  selectPreviousOccurrence,
2209
2280
  selectUp: selectUp$1,
@@ -2215,6 +2286,7 @@ const Editor = {
2215
2286
  shouldHaveDiagnostics,
2216
2287
  shouldHaveSelections,
2217
2288
  shouldHaveText,
2289
+ shouldHaveTokens,
2218
2290
  showHover,
2219
2291
  sortImports,
2220
2292
  sourceActionsSelectCurrent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "13.3.0",
3
+ "version": "13.5.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",