@lvce-editor/editor-worker 19.0.0 → 19.2.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/editorWorkerMain.js +313 -294
- package/dist/editorWorkerMain.min.js +1 -1
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -674,7 +674,7 @@ const execute$1 = (command, ...args) => {
|
|
|
674
674
|
|
|
675
675
|
const Two$1 = '2.0';
|
|
676
676
|
const callbacks = Object.create(null);
|
|
677
|
-
const get$
|
|
677
|
+
const get$9 = id => {
|
|
678
678
|
return callbacks[id];
|
|
679
679
|
};
|
|
680
680
|
const remove$9 = id => {
|
|
@@ -823,7 +823,7 @@ const warn$1 = (...args) => {
|
|
|
823
823
|
console.warn(...args);
|
|
824
824
|
};
|
|
825
825
|
const resolve = (id, response) => {
|
|
826
|
-
const fn = get$
|
|
826
|
+
const fn = get$9(id);
|
|
827
827
|
if (!fn) {
|
|
828
828
|
console.log(response);
|
|
829
829
|
warn$1(`callback ${id} may already be disposed`);
|
|
@@ -1225,10 +1225,10 @@ const createMockRpc = ({
|
|
|
1225
1225
|
};
|
|
1226
1226
|
|
|
1227
1227
|
const rpcs = Object.create(null);
|
|
1228
|
-
const set$
|
|
1228
|
+
const set$f = (id, rpc) => {
|
|
1229
1229
|
rpcs[id] = rpc;
|
|
1230
1230
|
};
|
|
1231
|
-
const get$
|
|
1231
|
+
const get$8 = id => {
|
|
1232
1232
|
return rpcs[id];
|
|
1233
1233
|
};
|
|
1234
1234
|
const remove$8 = id => {
|
|
@@ -1239,18 +1239,18 @@ const remove$8 = id => {
|
|
|
1239
1239
|
const create$9 = rpcId => {
|
|
1240
1240
|
return {
|
|
1241
1241
|
async dispose() {
|
|
1242
|
-
const rpc = get$
|
|
1242
|
+
const rpc = get$8(rpcId);
|
|
1243
1243
|
await rpc.dispose();
|
|
1244
1244
|
},
|
|
1245
1245
|
// @ts-ignore
|
|
1246
1246
|
invoke(method, ...params) {
|
|
1247
|
-
const rpc = get$
|
|
1247
|
+
const rpc = get$8(rpcId);
|
|
1248
1248
|
// @ts-ignore
|
|
1249
1249
|
return rpc.invoke(method, ...params);
|
|
1250
1250
|
},
|
|
1251
1251
|
// @ts-ignore
|
|
1252
1252
|
invokeAndTransfer(method, ...params) {
|
|
1253
|
-
const rpc = get$
|
|
1253
|
+
const rpc = get$8(rpcId);
|
|
1254
1254
|
// @ts-ignore
|
|
1255
1255
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1256
1256
|
},
|
|
@@ -1258,7 +1258,7 @@ const create$9 = rpcId => {
|
|
|
1258
1258
|
const mockRpc = createMockRpc({
|
|
1259
1259
|
commandMap
|
|
1260
1260
|
});
|
|
1261
|
-
set$
|
|
1261
|
+
set$f(rpcId, mockRpc);
|
|
1262
1262
|
// @ts-ignore
|
|
1263
1263
|
mockRpc[Symbol.dispose] = () => {
|
|
1264
1264
|
remove$8(rpcId);
|
|
@@ -1267,7 +1267,7 @@ const create$9 = rpcId => {
|
|
|
1267
1267
|
return mockRpc;
|
|
1268
1268
|
},
|
|
1269
1269
|
set(rpc) {
|
|
1270
|
-
set$
|
|
1270
|
+
set$f(rpcId, rpc);
|
|
1271
1271
|
}
|
|
1272
1272
|
};
|
|
1273
1273
|
};
|
|
@@ -1353,18 +1353,18 @@ const FocusEditorText$1 = 12;
|
|
|
1353
1353
|
|
|
1354
1354
|
const {
|
|
1355
1355
|
invoke: invoke$f,
|
|
1356
|
-
set: set$
|
|
1356
|
+
set: set$e
|
|
1357
1357
|
} = create$9(ExtensionHostWorker);
|
|
1358
1358
|
|
|
1359
1359
|
const ExtensionHost = {
|
|
1360
1360
|
__proto__: null,
|
|
1361
1361
|
invoke: invoke$f,
|
|
1362
|
-
set: set$
|
|
1362
|
+
set: set$e
|
|
1363
1363
|
};
|
|
1364
1364
|
|
|
1365
1365
|
const {
|
|
1366
1366
|
invoke: invoke$e,
|
|
1367
|
-
set: set$
|
|
1367
|
+
set: set$d
|
|
1368
1368
|
} = create$9(ExtensionManagementWorker);
|
|
1369
1369
|
const getLanguages$1 = (platform, assetDir) => {
|
|
1370
1370
|
return invoke$e('Extensions.getLanguages', platform, assetDir);
|
|
@@ -1372,7 +1372,7 @@ const getLanguages$1 = (platform, assetDir) => {
|
|
|
1372
1372
|
|
|
1373
1373
|
const {
|
|
1374
1374
|
invoke: invoke$d,
|
|
1375
|
-
set: set$
|
|
1375
|
+
set: set$c
|
|
1376
1376
|
} = create$9(OpenerWorker);
|
|
1377
1377
|
const openUrl = async (url, platform) => {
|
|
1378
1378
|
return invoke$d('Open.openUrl', url, platform);
|
|
@@ -1380,13 +1380,13 @@ const openUrl = async (url, platform) => {
|
|
|
1380
1380
|
|
|
1381
1381
|
const {
|
|
1382
1382
|
invoke: invoke$c,
|
|
1383
|
-
set: set$
|
|
1383
|
+
set: set$b
|
|
1384
1384
|
} = create$9(IconThemeWorker);
|
|
1385
1385
|
|
|
1386
1386
|
const {
|
|
1387
1387
|
invoke: invoke$b,
|
|
1388
1388
|
invokeAndTransfer,
|
|
1389
|
-
set: set$
|
|
1389
|
+
set: set$a
|
|
1390
1390
|
} = create$9(RendererWorker$1);
|
|
1391
1391
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1392
1392
|
number(uid);
|
|
@@ -1451,20 +1451,20 @@ const RendererWorker = {
|
|
|
1451
1451
|
sendMessagePortToOpenerWorker,
|
|
1452
1452
|
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1453
1453
|
sendMessagePortToTextMeasurementWorker,
|
|
1454
|
-
set: set$
|
|
1454
|
+
set: set$a,
|
|
1455
1455
|
showContextMenu2,
|
|
1456
1456
|
writeClipBoardText
|
|
1457
1457
|
};
|
|
1458
1458
|
|
|
1459
1459
|
const {
|
|
1460
1460
|
invoke: invoke$a,
|
|
1461
|
-
set: set$
|
|
1461
|
+
set: set$9
|
|
1462
1462
|
} = create$9(MarkdownWorker);
|
|
1463
1463
|
|
|
1464
1464
|
const SyntaxHighlightingWorker = {
|
|
1465
1465
|
__proto__: null,
|
|
1466
1466
|
invoke: invoke$a,
|
|
1467
|
-
set: set$
|
|
1467
|
+
set: set$9
|
|
1468
1468
|
};
|
|
1469
1469
|
|
|
1470
1470
|
const createLazyRpc = rpcId => {
|
|
@@ -1472,7 +1472,7 @@ const createLazyRpc = rpcId => {
|
|
|
1472
1472
|
let factory;
|
|
1473
1473
|
const createRpc = async () => {
|
|
1474
1474
|
const rpc = await factory();
|
|
1475
|
-
set$
|
|
1475
|
+
set$f(rpcId, rpc);
|
|
1476
1476
|
};
|
|
1477
1477
|
const ensureRpc = async () => {
|
|
1478
1478
|
if (!rpcPromise) {
|
|
@@ -1483,12 +1483,12 @@ const createLazyRpc = rpcId => {
|
|
|
1483
1483
|
return {
|
|
1484
1484
|
async invoke(method, ...params) {
|
|
1485
1485
|
await ensureRpc();
|
|
1486
|
-
const rpc = get$
|
|
1486
|
+
const rpc = get$8(rpcId);
|
|
1487
1487
|
return rpc.invoke(method, ...params);
|
|
1488
1488
|
},
|
|
1489
1489
|
async invokeAndTransfer(method, ...params) {
|
|
1490
1490
|
await ensureRpc();
|
|
1491
|
-
const rpc = get$
|
|
1491
|
+
const rpc = get$8(rpcId);
|
|
1492
1492
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1493
1493
|
},
|
|
1494
1494
|
setFactory(value) {
|
|
@@ -1538,12 +1538,12 @@ const launchColorPickerWorker = async () => {
|
|
|
1538
1538
|
return launchWorker(name, url);
|
|
1539
1539
|
};
|
|
1540
1540
|
|
|
1541
|
-
const state$
|
|
1541
|
+
const state$e = {};
|
|
1542
1542
|
const getOrCreate$3 = () => {
|
|
1543
|
-
if (!state$
|
|
1544
|
-
state$
|
|
1543
|
+
if (!state$e.workerPromise) {
|
|
1544
|
+
state$e.workerPromise = launchColorPickerWorker();
|
|
1545
1545
|
}
|
|
1546
|
-
return state$
|
|
1546
|
+
return state$e.workerPromise;
|
|
1547
1547
|
};
|
|
1548
1548
|
const invoke$9 = async (method, ...params) => {
|
|
1549
1549
|
const worker = await getOrCreate$3();
|
|
@@ -1574,14 +1574,14 @@ const {
|
|
|
1574
1574
|
registerCommands,
|
|
1575
1575
|
wrapGetter
|
|
1576
1576
|
} = editorStates;
|
|
1577
|
-
const get$
|
|
1577
|
+
const get$7 = id => {
|
|
1578
1578
|
return editorStates.get(id);
|
|
1579
1579
|
};
|
|
1580
1580
|
const getKeys$2 = () => {
|
|
1581
1581
|
const keys = editorStates.getKeys();
|
|
1582
1582
|
return keys.map(String);
|
|
1583
1583
|
};
|
|
1584
|
-
const set$
|
|
1584
|
+
const set$8 = (id, oldEditor, newEditor) => {
|
|
1585
1585
|
editorStates.set(id, oldEditor, newEditor);
|
|
1586
1586
|
};
|
|
1587
1587
|
|
|
@@ -1626,6 +1626,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1626
1626
|
fontWeight: 0,
|
|
1627
1627
|
handleOffset: 0,
|
|
1628
1628
|
handleOffsetX: 0,
|
|
1629
|
+
hasListener: false,
|
|
1629
1630
|
height,
|
|
1630
1631
|
highlightedLine: -1,
|
|
1631
1632
|
id,
|
|
@@ -1637,6 +1638,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1637
1638
|
isAutoClosingTagsEnabled: false,
|
|
1638
1639
|
isMonospaceFont: false,
|
|
1639
1640
|
isQuickSuggestionsEnabled: false,
|
|
1641
|
+
isSelecting: false,
|
|
1640
1642
|
itemHeight: 20,
|
|
1641
1643
|
languageId: '',
|
|
1642
1644
|
letterSpacing: 0,
|
|
@@ -1657,6 +1659,10 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1657
1659
|
savedSelections: [],
|
|
1658
1660
|
scrollBarHeight: 0,
|
|
1659
1661
|
scrollBarWidth: 0,
|
|
1662
|
+
selectionAutoMovePosition: {
|
|
1663
|
+
columnIndex: 0,
|
|
1664
|
+
rowIndex: 0
|
|
1665
|
+
},
|
|
1660
1666
|
selectionInfos: [],
|
|
1661
1667
|
selections: new Uint32Array(),
|
|
1662
1668
|
tabSize: 0,
|
|
@@ -1672,7 +1678,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1672
1678
|
x,
|
|
1673
1679
|
y
|
|
1674
1680
|
};
|
|
1675
|
-
set$
|
|
1681
|
+
set$8(id, editor, editor);
|
|
1676
1682
|
};
|
|
1677
1683
|
|
|
1678
1684
|
// TODO use numeric enum
|
|
@@ -1695,15 +1701,15 @@ const Rename = 'rename';
|
|
|
1695
1701
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1696
1702
|
|
|
1697
1703
|
const map$1 = Object.create(null);
|
|
1698
|
-
const set$
|
|
1704
|
+
const set$7 = (id, widget) => {
|
|
1699
1705
|
map$1[id] = widget;
|
|
1700
1706
|
};
|
|
1701
|
-
const get$
|
|
1707
|
+
const get$6 = id => {
|
|
1702
1708
|
return map$1[id];
|
|
1703
1709
|
};
|
|
1704
1710
|
|
|
1705
1711
|
const getModule = id => {
|
|
1706
|
-
return get$
|
|
1712
|
+
return get$6(id);
|
|
1707
1713
|
};
|
|
1708
1714
|
|
|
1709
1715
|
const applyWidgetChange = async (editor, widget, changes) => {
|
|
@@ -1847,7 +1853,7 @@ const getInitialLineState = initialLineState => {
|
|
|
1847
1853
|
return deepCopy(initialLineState);
|
|
1848
1854
|
};
|
|
1849
1855
|
|
|
1850
|
-
const state$
|
|
1856
|
+
const state$d = {
|
|
1851
1857
|
warned: []
|
|
1852
1858
|
};
|
|
1853
1859
|
const flattenTokensArray = tokens => {
|
|
@@ -1859,10 +1865,10 @@ const flattenTokensArray = tokens => {
|
|
|
1859
1865
|
return flattened;
|
|
1860
1866
|
};
|
|
1861
1867
|
const warnDeprecatedArrayReturn = (languageId, fn) => {
|
|
1862
|
-
if (state$
|
|
1868
|
+
if (state$d.warned.includes(fn)) {
|
|
1863
1869
|
return;
|
|
1864
1870
|
}
|
|
1865
|
-
state$
|
|
1871
|
+
state$d.warned.push(fn);
|
|
1866
1872
|
console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${languageId})`);
|
|
1867
1873
|
};
|
|
1868
1874
|
const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasArrayReturn) => {
|
|
@@ -1923,40 +1929,40 @@ const TokenizePlainText = {
|
|
|
1923
1929
|
tokenizeLine
|
|
1924
1930
|
};
|
|
1925
1931
|
|
|
1926
|
-
const state$
|
|
1932
|
+
const state$c = {
|
|
1927
1933
|
enabled: false
|
|
1928
1934
|
};
|
|
1929
1935
|
const setEnabled$1 = value => {
|
|
1930
|
-
state$
|
|
1936
|
+
state$c.enabled = value;
|
|
1931
1937
|
};
|
|
1932
1938
|
const getEnabled$1 = () => {
|
|
1933
|
-
return state$
|
|
1939
|
+
return state$c.enabled;
|
|
1934
1940
|
};
|
|
1935
1941
|
|
|
1936
1942
|
const {
|
|
1937
1943
|
invoke: invoke$8,
|
|
1938
|
-
set: set$
|
|
1944
|
+
set: set$6
|
|
1939
1945
|
} = SyntaxHighlightingWorker;
|
|
1940
1946
|
|
|
1941
|
-
const state$
|
|
1947
|
+
const state$b = {
|
|
1942
1948
|
pending: Object.create(null),
|
|
1943
1949
|
tokenizePaths: Object.create(null),
|
|
1944
1950
|
tokenizers: Object.create(null)
|
|
1945
1951
|
};
|
|
1946
1952
|
const has = languageId => {
|
|
1947
|
-
return Object.hasOwn(state$
|
|
1953
|
+
return Object.hasOwn(state$b.tokenizers, languageId);
|
|
1948
1954
|
};
|
|
1949
|
-
const set$
|
|
1950
|
-
state$
|
|
1955
|
+
const set$5 = (languageId, tokenizer) => {
|
|
1956
|
+
state$b.tokenizers[languageId] = tokenizer;
|
|
1951
1957
|
};
|
|
1952
|
-
const get$
|
|
1953
|
-
return state$
|
|
1958
|
+
const get$5 = languageId => {
|
|
1959
|
+
return state$b.tokenizers[languageId];
|
|
1954
1960
|
};
|
|
1955
1961
|
const setTokenizePath = (languageId, tokenizePath) => {
|
|
1956
|
-
state$
|
|
1962
|
+
state$b.tokenizePaths[languageId] = tokenizePath;
|
|
1957
1963
|
};
|
|
1958
1964
|
const getTokenizePath$1 = languageId => {
|
|
1959
|
-
return state$
|
|
1965
|
+
return state$b.tokenizePaths[languageId] || '';
|
|
1960
1966
|
};
|
|
1961
1967
|
const setTokenizePaths = languages => {
|
|
1962
1968
|
for (const language of languages) {
|
|
@@ -1966,14 +1972,14 @@ const setTokenizePaths = languages => {
|
|
|
1966
1972
|
}
|
|
1967
1973
|
};
|
|
1968
1974
|
const isPending = languageId => {
|
|
1969
|
-
return Object.hasOwn(state$
|
|
1975
|
+
return Object.hasOwn(state$b.pending, languageId);
|
|
1970
1976
|
};
|
|
1971
1977
|
|
|
1972
1978
|
const tokenMaps = Object.create(null);
|
|
1973
|
-
const set$
|
|
1979
|
+
const set$4 = (languageId, tokenMap) => {
|
|
1974
1980
|
tokenMaps[languageId] = tokenMap;
|
|
1975
1981
|
};
|
|
1976
|
-
const get$
|
|
1982
|
+
const get$4 = languageId => {
|
|
1977
1983
|
return tokenMaps[languageId] || {};
|
|
1978
1984
|
};
|
|
1979
1985
|
|
|
@@ -1986,7 +1992,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
1986
1992
|
if (getEnabled$1()) {
|
|
1987
1993
|
// @ts-ignore
|
|
1988
1994
|
const tokenMap = await invoke$8('Tokenizer.load', languageId, tokenizePath);
|
|
1989
|
-
set$
|
|
1995
|
+
set$4(languageId, tokenMap);
|
|
1990
1996
|
return;
|
|
1991
1997
|
}
|
|
1992
1998
|
try {
|
|
@@ -2002,8 +2008,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2002
2008
|
console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
|
|
2003
2009
|
return;
|
|
2004
2010
|
}
|
|
2005
|
-
set$
|
|
2006
|
-
set$
|
|
2011
|
+
set$4(languageId, tokenizer.TokenMap);
|
|
2012
|
+
set$5(languageId, tokenizer);
|
|
2007
2013
|
} catch (error) {
|
|
2008
2014
|
// TODO better error handling
|
|
2009
2015
|
console.error(error);
|
|
@@ -2011,7 +2017,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2011
2017
|
};
|
|
2012
2018
|
const getTokenizer = languageId => {
|
|
2013
2019
|
if (has(languageId)) {
|
|
2014
|
-
return get$
|
|
2020
|
+
return get$5(languageId);
|
|
2015
2021
|
}
|
|
2016
2022
|
if (isPending(languageId)) {
|
|
2017
2023
|
return TokenizePlainText;
|
|
@@ -2020,10 +2026,10 @@ const getTokenizer = languageId => {
|
|
|
2020
2026
|
};
|
|
2021
2027
|
|
|
2022
2028
|
const tokenizers = Object.create(null);
|
|
2023
|
-
const set$
|
|
2029
|
+
const set$3 = (id, value) => {
|
|
2024
2030
|
tokenizers[id] = value;
|
|
2025
2031
|
};
|
|
2026
|
-
const get$
|
|
2032
|
+
const get$3 = id => {
|
|
2027
2033
|
return tokenizers[id] || TokenizePlainText;
|
|
2028
2034
|
};
|
|
2029
2035
|
|
|
@@ -2105,7 +2111,7 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
2105
2111
|
lines,
|
|
2106
2112
|
tokenizerId
|
|
2107
2113
|
} = editor;
|
|
2108
|
-
const tokenizer = get$
|
|
2114
|
+
const tokenizer = get$3(tokenizerId);
|
|
2109
2115
|
const {
|
|
2110
2116
|
hasArrayReturn,
|
|
2111
2117
|
initialLineState,
|
|
@@ -2686,7 +2692,7 @@ const getLineInfosViewport = (editor, tokens, embeddedResults, minLineY, maxLine
|
|
|
2686
2692
|
languageId,
|
|
2687
2693
|
lines
|
|
2688
2694
|
} = editor;
|
|
2689
|
-
const tokenMap = get$
|
|
2695
|
+
const tokenMap = get$4(languageId);
|
|
2690
2696
|
let offset = minLineOffset;
|
|
2691
2697
|
const tabSize = 2;
|
|
2692
2698
|
for (let i = minLineY; i < maxLineY; i++) {
|
|
@@ -2809,14 +2815,14 @@ const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
|
|
|
2809
2815
|
};
|
|
2810
2816
|
};
|
|
2811
2817
|
|
|
2812
|
-
const state$
|
|
2818
|
+
const state$a = {
|
|
2813
2819
|
enabled: false
|
|
2814
2820
|
};
|
|
2815
2821
|
const setEnabled = value => {
|
|
2816
|
-
state$
|
|
2822
|
+
state$a.enabled = value;
|
|
2817
2823
|
};
|
|
2818
2824
|
const getEnabled = () => {
|
|
2819
|
-
return state$
|
|
2825
|
+
return state$a.enabled;
|
|
2820
2826
|
};
|
|
2821
2827
|
|
|
2822
2828
|
// TODO this should be in a separate scrolling module
|
|
@@ -2996,7 +3002,7 @@ const getUrlAtOffset = (editor, offset) => {
|
|
|
2996
3002
|
|
|
2997
3003
|
const EditorChange = 1;
|
|
2998
3004
|
|
|
2999
|
-
const state$
|
|
3005
|
+
const state$9 = Object.create(null);
|
|
3000
3006
|
|
|
3001
3007
|
/**
|
|
3002
3008
|
* Register a listener for a specific event type
|
|
@@ -3006,13 +3012,13 @@ const state$a = Object.create(null);
|
|
|
3006
3012
|
const registerListener$1 = (listenerType, rpcId) => {
|
|
3007
3013
|
number(listenerType);
|
|
3008
3014
|
number(rpcId);
|
|
3009
|
-
if (!Object.hasOwn(state$
|
|
3010
|
-
state$
|
|
3015
|
+
if (!Object.hasOwn(state$9, listenerType)) {
|
|
3016
|
+
state$9[listenerType] = [];
|
|
3011
3017
|
}
|
|
3012
3018
|
|
|
3013
3019
|
// Avoid duplicate registrations
|
|
3014
|
-
if (!state$
|
|
3015
|
-
state$
|
|
3020
|
+
if (!state$9[listenerType].includes(rpcId)) {
|
|
3021
|
+
state$9[listenerType].push(rpcId);
|
|
3016
3022
|
}
|
|
3017
3023
|
};
|
|
3018
3024
|
|
|
@@ -3024,10 +3030,10 @@ const registerListener$1 = (listenerType, rpcId) => {
|
|
|
3024
3030
|
const unregisterListener$1 = (listenerType, rpcId) => {
|
|
3025
3031
|
number(listenerType);
|
|
3026
3032
|
number(rpcId);
|
|
3027
|
-
if (Object.hasOwn(state$
|
|
3028
|
-
const index = state$
|
|
3033
|
+
if (Object.hasOwn(state$9, listenerType)) {
|
|
3034
|
+
const index = state$9[listenerType].indexOf(rpcId);
|
|
3029
3035
|
if (index !== -1) {
|
|
3030
|
-
state$
|
|
3036
|
+
state$9[listenerType].splice(index, 1);
|
|
3031
3037
|
}
|
|
3032
3038
|
}
|
|
3033
3039
|
};
|
|
@@ -3039,7 +3045,7 @@ const unregisterListener$1 = (listenerType, rpcId) => {
|
|
|
3039
3045
|
*/
|
|
3040
3046
|
const getListeners = listenerType => {
|
|
3041
3047
|
number(listenerType);
|
|
3042
|
-
return state$
|
|
3048
|
+
return state$9[listenerType] || [];
|
|
3043
3049
|
};
|
|
3044
3050
|
|
|
3045
3051
|
/**
|
|
@@ -3056,7 +3062,7 @@ const notifyListeners = async (listenerType, method, ...params) => {
|
|
|
3056
3062
|
// Notify all listeners in parallel
|
|
3057
3063
|
const notifications = rpcIds.map(async rpcId => {
|
|
3058
3064
|
try {
|
|
3059
|
-
const rpc = get$
|
|
3065
|
+
const rpc = get$8(rpcId);
|
|
3060
3066
|
if (rpc) {
|
|
3061
3067
|
await rpc.invoke(method, ...params);
|
|
3062
3068
|
}
|
|
@@ -3516,7 +3522,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
3516
3522
|
...newEditor,
|
|
3517
3523
|
decorations: linkDecorations
|
|
3518
3524
|
};
|
|
3519
|
-
set$
|
|
3525
|
+
set$8(editor.uid, editor, newEditorWithDecorations);
|
|
3520
3526
|
|
|
3521
3527
|
// Notify main-area-worker about modified status change
|
|
3522
3528
|
if (!editor.modified) {
|
|
@@ -3693,9 +3699,11 @@ const emptyEditor = {
|
|
|
3693
3699
|
differences: [],
|
|
3694
3700
|
embeds: [],
|
|
3695
3701
|
focused: false,
|
|
3702
|
+
hasListener: false,
|
|
3696
3703
|
height: 0,
|
|
3697
3704
|
highlightedLine: -1,
|
|
3698
3705
|
incrementalEdits: emptyIncrementalEdits,
|
|
3706
|
+
isSelecting: false,
|
|
3699
3707
|
languageId: '',
|
|
3700
3708
|
// TODO use numeric language id?
|
|
3701
3709
|
lineCache: [],
|
|
@@ -3705,6 +3713,10 @@ const emptyEditor = {
|
|
|
3705
3713
|
minLineY: 0,
|
|
3706
3714
|
redoStack: [],
|
|
3707
3715
|
scrollBarHeight: 0,
|
|
3716
|
+
selectionAutoMovePosition: {
|
|
3717
|
+
columnIndex: 0,
|
|
3718
|
+
rowIndex: 0
|
|
3719
|
+
},
|
|
3708
3720
|
selectionInfos: [],
|
|
3709
3721
|
selections: new Uint32Array(),
|
|
3710
3722
|
textInfos: [],
|
|
@@ -3722,7 +3734,7 @@ const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
|
3722
3734
|
|
|
3723
3735
|
const {
|
|
3724
3736
|
invoke: invoke$6,
|
|
3725
|
-
set: set$
|
|
3737
|
+
set: set$2
|
|
3726
3738
|
} = ExtensionHost;
|
|
3727
3739
|
|
|
3728
3740
|
const getFileExtensionIndex = file => {
|
|
@@ -3788,7 +3800,7 @@ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpa
|
|
|
3788
3800
|
return await measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
3789
3801
|
};
|
|
3790
3802
|
|
|
3791
|
-
const get$
|
|
3803
|
+
const get$2 = async key => {
|
|
3792
3804
|
const value = await getPreference(key);
|
|
3793
3805
|
return value;
|
|
3794
3806
|
};
|
|
@@ -3933,7 +3945,7 @@ const updateDiagnostics = async newState => {
|
|
|
3933
3945
|
// @ts-ignore
|
|
3934
3946
|
await invoke$6(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
3935
3947
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
3936
|
-
const latest = get$
|
|
3948
|
+
const latest = get$7(newState.id);
|
|
3937
3949
|
if (!latest) {
|
|
3938
3950
|
return newState;
|
|
3939
3951
|
}
|
|
@@ -3949,7 +3961,7 @@ const updateDiagnostics = async newState => {
|
|
|
3949
3961
|
diagnostics,
|
|
3950
3962
|
visualDecorations // Visual decorations (objects with x, y, width, height) for squiggly underlines
|
|
3951
3963
|
};
|
|
3952
|
-
set$
|
|
3964
|
+
set$8(newState.id, latest.oldState, newEditor);
|
|
3953
3965
|
// @ts-ignore
|
|
3954
3966
|
await invoke$b('Editor.rerender', newState.id);
|
|
3955
3967
|
return newEditor;
|
|
@@ -4027,6 +4039,7 @@ const createEditor = async ({
|
|
|
4027
4039
|
fontWeight,
|
|
4028
4040
|
handleOffset: 0,
|
|
4029
4041
|
handleOffsetX: 0,
|
|
4042
|
+
hasListener: false,
|
|
4030
4043
|
height,
|
|
4031
4044
|
id,
|
|
4032
4045
|
incrementalEdits: emptyIncrementalEdits,
|
|
@@ -4036,6 +4049,7 @@ const createEditor = async ({
|
|
|
4036
4049
|
isAutoClosingTagsEnabled,
|
|
4037
4050
|
isMonospaceFont,
|
|
4038
4051
|
isQuickSuggestionsEnabled,
|
|
4052
|
+
isSelecting: false,
|
|
4039
4053
|
itemHeight: 20,
|
|
4040
4054
|
languageId: computedlanguageId,
|
|
4041
4055
|
letterSpacing,
|
|
@@ -4056,6 +4070,10 @@ const createEditor = async ({
|
|
|
4056
4070
|
savedSelections,
|
|
4057
4071
|
scrollBarHeight: 0,
|
|
4058
4072
|
scrollBarWidth: 0,
|
|
4073
|
+
selectionAutoMovePosition: {
|
|
4074
|
+
columnIndex: 0,
|
|
4075
|
+
rowIndex: 0
|
|
4076
|
+
},
|
|
4059
4077
|
selectionInfos: [],
|
|
4060
4078
|
selections: new Uint32Array(),
|
|
4061
4079
|
tabSize,
|
|
@@ -4102,7 +4120,7 @@ const createEditor = async ({
|
|
|
4102
4120
|
focused: true,
|
|
4103
4121
|
textInfos
|
|
4104
4122
|
};
|
|
4105
|
-
set$
|
|
4123
|
+
set$8(id, emptyEditor, newEditor4);
|
|
4106
4124
|
|
|
4107
4125
|
// TODO only sync when needed
|
|
4108
4126
|
// e.g. it might not always be necessary to send text to extension host worker
|
|
@@ -4113,9 +4131,9 @@ const createEditor = async ({
|
|
|
4113
4131
|
if (diagnosticsEnabled) {
|
|
4114
4132
|
await updateDiagnostics(newEditor4);
|
|
4115
4133
|
}
|
|
4116
|
-
const completionsOnTypeRaw = await get$
|
|
4134
|
+
const completionsOnTypeRaw = await get$2('editor.completionsOnType');
|
|
4117
4135
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
4118
|
-
set$
|
|
4136
|
+
set$8(id, emptyEditor, {
|
|
4119
4137
|
...newEditor4,
|
|
4120
4138
|
completionsOnType
|
|
4121
4139
|
});
|
|
@@ -4159,7 +4177,7 @@ const diff2 = uid => {
|
|
|
4159
4177
|
const {
|
|
4160
4178
|
newState,
|
|
4161
4179
|
oldState
|
|
4162
|
-
} = get$
|
|
4180
|
+
} = get$7(uid);
|
|
4163
4181
|
const result = diff(oldState, newState);
|
|
4164
4182
|
return result;
|
|
4165
4183
|
};
|
|
@@ -4521,7 +4539,7 @@ const y = (editor, rowIndex) => {
|
|
|
4521
4539
|
return offsetY;
|
|
4522
4540
|
};
|
|
4523
4541
|
|
|
4524
|
-
const state$
|
|
4542
|
+
const state$8 = {
|
|
4525
4543
|
timeout: -1
|
|
4526
4544
|
};
|
|
4527
4545
|
|
|
@@ -4552,7 +4570,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
4552
4570
|
|
|
4553
4571
|
// TODO use wrapper timing module instead of this
|
|
4554
4572
|
// @ts-ignore
|
|
4555
|
-
state$
|
|
4573
|
+
state$8.timeout = setTimeout(handleTimeout, 3000);
|
|
4556
4574
|
}
|
|
4557
4575
|
return editor;
|
|
4558
4576
|
};
|
|
@@ -4572,8 +4590,8 @@ const showErrorMessage = async (editor, rowIndex, columnIndex, message) => {
|
|
|
4572
4590
|
|
|
4573
4591
|
// @ts-ignore
|
|
4574
4592
|
const editorHideMessage = async editor => {
|
|
4575
|
-
clearTimeout(state$
|
|
4576
|
-
state$
|
|
4593
|
+
clearTimeout(state$8.timeout);
|
|
4594
|
+
state$8.timeout = -1;
|
|
4577
4595
|
// await RendererProcess.invoke(/* Viewlet.send */ 'Viewlet.send', /* id */ editor.uid, /* method */ 'hideOverlayMessage')
|
|
4578
4596
|
return editor;
|
|
4579
4597
|
};
|
|
@@ -4689,12 +4707,12 @@ const launchRenameWorker = async () => {
|
|
|
4689
4707
|
return rpc;
|
|
4690
4708
|
};
|
|
4691
4709
|
|
|
4692
|
-
const state$
|
|
4710
|
+
const state$7 = {};
|
|
4693
4711
|
const getOrCreate$2 = () => {
|
|
4694
|
-
if (!state$
|
|
4695
|
-
state$
|
|
4712
|
+
if (!state$7.workerPromise) {
|
|
4713
|
+
state$7.workerPromise = launchRenameWorker();
|
|
4696
4714
|
}
|
|
4697
|
-
return state$
|
|
4715
|
+
return state$7.workerPromise;
|
|
4698
4716
|
};
|
|
4699
4717
|
const invoke$5 = async (method, ...params) => {
|
|
4700
4718
|
const worker = await getOrCreate$2();
|
|
@@ -4716,7 +4734,7 @@ const closeRename = async editor => {
|
|
|
4716
4734
|
}
|
|
4717
4735
|
const renameWidget = widgets[renameWidgetIndex];
|
|
4718
4736
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
4719
|
-
const latest = get$
|
|
4737
|
+
const latest = get$7(uid);
|
|
4720
4738
|
const {
|
|
4721
4739
|
newState
|
|
4722
4740
|
} = latest;
|
|
@@ -4814,12 +4832,12 @@ const openColorPicker = async editor => {
|
|
|
4814
4832
|
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$6);
|
|
4815
4833
|
};
|
|
4816
4834
|
|
|
4817
|
-
const state$
|
|
4835
|
+
const state$6 = {
|
|
4818
4836
|
compositionText: '',
|
|
4819
4837
|
isComposing: false
|
|
4820
4838
|
};
|
|
4821
4839
|
const compositionStart = (editor, event) => {
|
|
4822
|
-
state$
|
|
4840
|
+
state$6.isComposing = true;
|
|
4823
4841
|
return editor;
|
|
4824
4842
|
};
|
|
4825
4843
|
const getCompositionChanges = (selections, data) => {
|
|
@@ -4829,9 +4847,9 @@ const getCompositionChanges = (selections, data) => {
|
|
|
4829
4847
|
const selectionStartColumn = selections[i + 1];
|
|
4830
4848
|
const selectionEndRow = selections[i + 2];
|
|
4831
4849
|
const selectionEndColumn = selections[i + 3];
|
|
4832
|
-
const startColumnIndex = selectionStartColumn - state$
|
|
4850
|
+
const startColumnIndex = selectionStartColumn - state$6.compositionText.length;
|
|
4833
4851
|
changes.push({
|
|
4834
|
-
deleted: [state$
|
|
4852
|
+
deleted: [state$6.compositionText],
|
|
4835
4853
|
end: {
|
|
4836
4854
|
columnIndex: selectionEndColumn,
|
|
4837
4855
|
rowIndex: selectionEndRow
|
|
@@ -4851,7 +4869,7 @@ const compositionUpdate = (editor, data) => {
|
|
|
4851
4869
|
selections
|
|
4852
4870
|
} = editor;
|
|
4853
4871
|
const changes = getCompositionChanges(selections, data);
|
|
4854
|
-
state$
|
|
4872
|
+
state$6.compositionText = data;
|
|
4855
4873
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
4856
4874
|
};
|
|
4857
4875
|
const compositionEnd = (editor, data) => {
|
|
@@ -4859,8 +4877,8 @@ const compositionEnd = (editor, data) => {
|
|
|
4859
4877
|
selections
|
|
4860
4878
|
} = editor;
|
|
4861
4879
|
const changes = getCompositionChanges(selections, data);
|
|
4862
|
-
state$
|
|
4863
|
-
state$
|
|
4880
|
+
state$6.isComposing = false;
|
|
4881
|
+
state$6.compositionText = '';
|
|
4864
4882
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
4865
4883
|
};
|
|
4866
4884
|
|
|
@@ -5960,19 +5978,19 @@ const closeWidgetsMaybe = widgets => {
|
|
|
5960
5978
|
return widgets.filter(isPersistentWidget);
|
|
5961
5979
|
};
|
|
5962
5980
|
|
|
5963
|
-
const state$
|
|
5981
|
+
const state$5 = {
|
|
5964
5982
|
position: {
|
|
5965
5983
|
columnIndex: 0,
|
|
5966
5984
|
rowIndex: 0
|
|
5967
5985
|
}
|
|
5968
5986
|
};
|
|
5969
|
-
const getPosition
|
|
5970
|
-
return state$
|
|
5987
|
+
const getPosition = () => {
|
|
5988
|
+
return state$5.position;
|
|
5971
5989
|
};
|
|
5972
5990
|
|
|
5973
5991
|
// @ts-ignore
|
|
5974
|
-
const setPosition
|
|
5975
|
-
state$
|
|
5992
|
+
const setPosition = position => {
|
|
5993
|
+
state$5.position = position;
|
|
5976
5994
|
};
|
|
5977
5995
|
|
|
5978
5996
|
const openExternal = async (url, platform) => {
|
|
@@ -6039,7 +6057,7 @@ const Alt = 2;
|
|
|
6039
6057
|
|
|
6040
6058
|
const handleSingleClickDefault = (editor, position) => {
|
|
6041
6059
|
// TODO avoid global variables, add them to editor state
|
|
6042
|
-
setPosition
|
|
6060
|
+
setPosition(position);
|
|
6043
6061
|
const widgets = closeWidgetsMaybe(editor.widgets);
|
|
6044
6062
|
return {
|
|
6045
6063
|
...editor,
|
|
@@ -6192,20 +6210,20 @@ const handleMouseDown = (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
|
6192
6210
|
}
|
|
6193
6211
|
};
|
|
6194
6212
|
|
|
6195
|
-
const state$
|
|
6213
|
+
const state$4 = {
|
|
6196
6214
|
editor: undefined,
|
|
6197
6215
|
timeout: -1,
|
|
6198
6216
|
x: 0,
|
|
6199
6217
|
y: 0
|
|
6200
6218
|
};
|
|
6201
|
-
const get = () => {
|
|
6202
|
-
return state$
|
|
6219
|
+
const get$1 = () => {
|
|
6220
|
+
return state$4;
|
|
6203
6221
|
};
|
|
6204
|
-
const set = (editor, timeout, x, y) => {
|
|
6205
|
-
state$
|
|
6206
|
-
state$
|
|
6207
|
-
state$
|
|
6208
|
-
state$
|
|
6222
|
+
const set$1 = (editor, timeout, x, y) => {
|
|
6223
|
+
state$4.editor = editor;
|
|
6224
|
+
state$4.timeout = timeout;
|
|
6225
|
+
state$4.x = x;
|
|
6226
|
+
state$4.y = y;
|
|
6209
6227
|
};
|
|
6210
6228
|
|
|
6211
6229
|
const showHover$1 = async (editor, position) => {
|
|
@@ -6227,7 +6245,7 @@ const onHoverIdle = async () => {
|
|
|
6227
6245
|
editor,
|
|
6228
6246
|
x,
|
|
6229
6247
|
y
|
|
6230
|
-
} = get();
|
|
6248
|
+
} = get$1();
|
|
6231
6249
|
await at(editor, x, y);
|
|
6232
6250
|
await showHover$1();
|
|
6233
6251
|
};
|
|
@@ -6238,12 +6256,12 @@ const handleMouseMove = (editor, x, y) => {
|
|
|
6238
6256
|
if (!editor.hoverEnabled) {
|
|
6239
6257
|
return editor;
|
|
6240
6258
|
}
|
|
6241
|
-
const oldState = get();
|
|
6259
|
+
const oldState = get$1();
|
|
6242
6260
|
if (oldState.timeout !== -1) {
|
|
6243
6261
|
clearTimeout(oldState.timeout);
|
|
6244
6262
|
}
|
|
6245
6263
|
const timeout = setTimeout(onHoverIdle, hoverDelay);
|
|
6246
|
-
set(editor, timeout, x, y);
|
|
6264
|
+
set$1(editor, timeout, x, y);
|
|
6247
6265
|
return editor;
|
|
6248
6266
|
};
|
|
6249
6267
|
|
|
@@ -6346,59 +6364,25 @@ const editorHandleNativeSelectionChange = (editor, range) => {
|
|
|
6346
6364
|
return scheduleSelections(editor, selections);
|
|
6347
6365
|
};
|
|
6348
6366
|
|
|
6349
|
-
const state$4 = {
|
|
6350
|
-
/**
|
|
6351
|
-
* @type {any}
|
|
6352
|
-
*/
|
|
6353
|
-
currentEditor: undefined,
|
|
6354
|
-
hasListener: false,
|
|
6355
|
-
isSelecting: false,
|
|
6356
|
-
position: {
|
|
6357
|
-
columnIndex: 0,
|
|
6358
|
-
rowIndex: 0
|
|
6359
|
-
}
|
|
6360
|
-
};
|
|
6361
|
-
|
|
6362
|
-
// @ts-ignore
|
|
6363
|
-
const setEditor = editor => {
|
|
6364
|
-
state$4.currentEditor = editor;
|
|
6365
|
-
state$4.hasListener = true;
|
|
6366
|
-
};
|
|
6367
|
-
const clearEditor = () => {
|
|
6368
|
-
state$4.currentEditor = undefined;
|
|
6369
|
-
state$4.hasListener = false;
|
|
6370
|
-
state$4.isSelecting = false;
|
|
6371
|
-
};
|
|
6372
|
-
const startSelecting = () => {
|
|
6373
|
-
state$4.isSelecting = true;
|
|
6374
|
-
};
|
|
6375
|
-
const isSelecting = () => {
|
|
6376
|
-
return state$4.isSelecting;
|
|
6377
|
-
};
|
|
6378
|
-
|
|
6379
|
-
// @ts-ignore
|
|
6380
|
-
const setPosition = position => {
|
|
6381
|
-
state$4.position = position;
|
|
6382
|
-
};
|
|
6383
|
-
const getEditor$1 = () => {
|
|
6384
|
-
return state$4.currentEditor;
|
|
6385
|
-
};
|
|
6386
|
-
const getPosition = () => {
|
|
6387
|
-
return state$4.position;
|
|
6388
|
-
};
|
|
6389
|
-
const hasListener = () => {
|
|
6390
|
-
return state$4.hasListener;
|
|
6391
|
-
};
|
|
6392
|
-
|
|
6393
6367
|
// @ts-ignore
|
|
6394
6368
|
const handlePointerCaptureLost = editor => {
|
|
6395
|
-
|
|
6396
|
-
|
|
6369
|
+
return {
|
|
6370
|
+
...editor,
|
|
6371
|
+
hasListener: false,
|
|
6372
|
+
isSelecting: false,
|
|
6373
|
+
selectionAutoMovePosition: {
|
|
6374
|
+
columnIndex: 0,
|
|
6375
|
+
rowIndex: 0
|
|
6376
|
+
}
|
|
6377
|
+
};
|
|
6397
6378
|
};
|
|
6398
6379
|
|
|
6399
|
-
const handlePointerDown$1 = (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
6400
|
-
|
|
6401
|
-
return
|
|
6380
|
+
const handlePointerDown$1 = async (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
6381
|
+
const newState = await handleMouseDown(state, button, altKey, ctrlKey, x, y, detail);
|
|
6382
|
+
return {
|
|
6383
|
+
...newState,
|
|
6384
|
+
isSelecting: true
|
|
6385
|
+
};
|
|
6402
6386
|
};
|
|
6403
6387
|
|
|
6404
6388
|
const moveRectangleSelection = (editor, position) => {
|
|
@@ -6437,6 +6421,43 @@ const requestAnimationFrame = fn => {
|
|
|
6437
6421
|
globalThis.requestAnimationFrame(fn);
|
|
6438
6422
|
};
|
|
6439
6423
|
|
|
6424
|
+
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
6425
|
+
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
6426
|
+
};
|
|
6427
|
+
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
6428
|
+
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
6429
|
+
return false;
|
|
6430
|
+
}
|
|
6431
|
+
return oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.decorations !== newState.decorations || oldState.embeds !== newState.embeds || oldState.deltaX !== newState.deltaX || oldState.width !== newState.width || oldState.highlightedLine !== newState.highlightedLine || oldState.debugEnabled !== newState.debugEnabled;
|
|
6432
|
+
};
|
|
6433
|
+
const updateDerivedState = async (oldState, newState) => {
|
|
6434
|
+
let finalState = newState;
|
|
6435
|
+
if (shouldUpdateVisibleTextData(oldState, newState)) {
|
|
6436
|
+
const syncIncremental = getEnabled();
|
|
6437
|
+
const {
|
|
6438
|
+
differences,
|
|
6439
|
+
textInfos
|
|
6440
|
+
} = await getVisible$1(newState, syncIncremental);
|
|
6441
|
+
finalState = {
|
|
6442
|
+
...newState,
|
|
6443
|
+
differences,
|
|
6444
|
+
textInfos
|
|
6445
|
+
};
|
|
6446
|
+
}
|
|
6447
|
+
if (!shouldUpdateSelectionData(oldState, newState)) {
|
|
6448
|
+
return finalState;
|
|
6449
|
+
}
|
|
6450
|
+
const {
|
|
6451
|
+
cursorInfos,
|
|
6452
|
+
selectionInfos
|
|
6453
|
+
} = await getVisible(finalState);
|
|
6454
|
+
return {
|
|
6455
|
+
...finalState,
|
|
6456
|
+
cursorInfos,
|
|
6457
|
+
selectionInfos
|
|
6458
|
+
};
|
|
6459
|
+
};
|
|
6460
|
+
|
|
6440
6461
|
const LessThan = -1;
|
|
6441
6462
|
const Equal = 0;
|
|
6442
6463
|
const GreaterThan = 1;
|
|
@@ -6491,7 +6512,7 @@ const getNewSelections$5 = (anchor, position) => {
|
|
|
6491
6512
|
|
|
6492
6513
|
// @ts-ignore
|
|
6493
6514
|
const editorMoveSelection = (editor, position) => {
|
|
6494
|
-
const anchor = getPosition
|
|
6515
|
+
const anchor = getPosition();
|
|
6495
6516
|
const newSelections = getNewSelections$5(anchor, position);
|
|
6496
6517
|
// TODO if selection equals previous selection -> do nothing
|
|
6497
6518
|
return scheduleSelections(editor, newSelections);
|
|
@@ -6509,7 +6530,7 @@ const getNewEditor$1 = (editor, position) => {
|
|
|
6509
6530
|
const newMinLineY = position.rowIndex;
|
|
6510
6531
|
const newMaxLineY = position.rowIndex + diff;
|
|
6511
6532
|
const newDeltaY = position.rowIndex * rowHeight;
|
|
6512
|
-
const anchor = getPosition
|
|
6533
|
+
const anchor = getPosition();
|
|
6513
6534
|
const newSelections = new Uint32Array([position.rowIndex - 1, position.columnIndex, anchor.rowIndex, anchor.columnIndex]);
|
|
6514
6535
|
return {
|
|
6515
6536
|
...editor,
|
|
@@ -6524,7 +6545,7 @@ const getNewEditor$1 = (editor, position) => {
|
|
|
6524
6545
|
const newMinLineY = position.rowIndex - diff;
|
|
6525
6546
|
const newMaxLineY = position.rowIndex;
|
|
6526
6547
|
const newDeltaY = newMinLineY * rowHeight;
|
|
6527
|
-
const anchor = getPosition
|
|
6548
|
+
const anchor = getPosition();
|
|
6528
6549
|
const newSelections = new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex + 1, position.columnIndex]);
|
|
6529
6550
|
return {
|
|
6530
6551
|
...editor,
|
|
@@ -6536,12 +6557,13 @@ const getNewEditor$1 = (editor, position) => {
|
|
|
6536
6557
|
}
|
|
6537
6558
|
return editor;
|
|
6538
6559
|
};
|
|
6539
|
-
const continueScrollingAndMovingSelection = async
|
|
6540
|
-
const
|
|
6541
|
-
|
|
6560
|
+
const continueScrollingAndMovingSelection = async editorUid => {
|
|
6561
|
+
const editorState = get$7(editorUid);
|
|
6562
|
+
const editor = editorState?.newState;
|
|
6563
|
+
if (!editor || !editor.hasListener || !editor.isSelecting) {
|
|
6542
6564
|
return;
|
|
6543
6565
|
}
|
|
6544
|
-
const position =
|
|
6566
|
+
const position = editor.selectionAutoMovePosition;
|
|
6545
6567
|
if (position.rowIndex === 0) {
|
|
6546
6568
|
return;
|
|
6547
6569
|
}
|
|
@@ -6549,19 +6571,18 @@ const continueScrollingAndMovingSelection = async () => {
|
|
|
6549
6571
|
if (editor === newEditor) {
|
|
6550
6572
|
return;
|
|
6551
6573
|
}
|
|
6552
|
-
// await Viewlet.setState(ViewletModuleId.EditorText, newEditor)
|
|
6553
|
-
setEditor(newEditor);
|
|
6554
6574
|
// @ts-ignore
|
|
6555
6575
|
const delta = position.rowIndex < editor.minLineY ? -1 : 1;
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6576
|
+
const nextEditor = {
|
|
6577
|
+
...newEditor,
|
|
6578
|
+
selectionAutoMovePosition: {
|
|
6579
|
+
columnIndex: position.columnIndex,
|
|
6580
|
+
rowIndex: position.rowIndex + delta
|
|
6581
|
+
}
|
|
6582
|
+
};
|
|
6583
|
+
const newEditorWithDerivedState = await updateDerivedState(editor, nextEditor);
|
|
6584
|
+
set$8(editor.uid, editor, newEditorWithDerivedState);
|
|
6585
|
+
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
6565
6586
|
};
|
|
6566
6587
|
|
|
6567
6588
|
// @ts-ignore
|
|
@@ -6570,16 +6591,20 @@ const moveSelectionPx = async (editor, x, y) => {
|
|
|
6570
6591
|
number(x);
|
|
6571
6592
|
number(y);
|
|
6572
6593
|
const position = await at(editor, x, y);
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6594
|
+
const newEditor = editorMoveSelection(editor, position);
|
|
6595
|
+
if (!editor.hasListener && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
|
|
6596
|
+
requestAnimationFrame(() => continueScrollingAndMovingSelection(editor.uid));
|
|
6597
|
+
return {
|
|
6598
|
+
...newEditor,
|
|
6599
|
+
hasListener: true,
|
|
6600
|
+
selectionAutoMovePosition: position
|
|
6601
|
+
};
|
|
6577
6602
|
}
|
|
6578
|
-
return
|
|
6603
|
+
return newEditor;
|
|
6579
6604
|
};
|
|
6580
6605
|
|
|
6581
6606
|
const handlePointerMove = async (editor, x, y, altKey) => {
|
|
6582
|
-
if (!isSelecting
|
|
6607
|
+
if (!editor.isSelecting) {
|
|
6583
6608
|
return editor;
|
|
6584
6609
|
}
|
|
6585
6610
|
if (altKey) {
|
|
@@ -6589,8 +6614,15 @@ const handlePointerMove = async (editor, x, y, altKey) => {
|
|
|
6589
6614
|
};
|
|
6590
6615
|
|
|
6591
6616
|
const handlePointerUp = editor => {
|
|
6592
|
-
|
|
6593
|
-
|
|
6617
|
+
return {
|
|
6618
|
+
...editor,
|
|
6619
|
+
hasListener: false,
|
|
6620
|
+
isSelecting: false,
|
|
6621
|
+
selectionAutoMovePosition: {
|
|
6622
|
+
columnIndex: 0,
|
|
6623
|
+
rowIndex: 0
|
|
6624
|
+
}
|
|
6625
|
+
};
|
|
6594
6626
|
};
|
|
6595
6627
|
|
|
6596
6628
|
// @ts-ignore
|
|
@@ -7083,7 +7115,7 @@ const newStateGenerator$4 = async (state, parentUid) => {
|
|
|
7083
7115
|
} = state;
|
|
7084
7116
|
const {
|
|
7085
7117
|
newState
|
|
7086
|
-
} = get$
|
|
7118
|
+
} = get$7(parentUid);
|
|
7087
7119
|
const {
|
|
7088
7120
|
languageId
|
|
7089
7121
|
} = newState;
|
|
@@ -7136,18 +7168,18 @@ const launchFindWidgetWorker = async () => {
|
|
|
7136
7168
|
const rpcId = 9002;
|
|
7137
7169
|
const launch = async () => {
|
|
7138
7170
|
// TODO race condition
|
|
7139
|
-
if (get$
|
|
7171
|
+
if (get$8(rpcId)) {
|
|
7140
7172
|
return;
|
|
7141
7173
|
}
|
|
7142
7174
|
const rpc = await launchFindWidgetWorker();
|
|
7143
|
-
set$
|
|
7175
|
+
set$f(rpcId, rpc);
|
|
7144
7176
|
};
|
|
7145
7177
|
const invoke$3 = async (method, ...params) => {
|
|
7146
|
-
const rpc = get$
|
|
7178
|
+
const rpc = get$8(rpcId);
|
|
7147
7179
|
return await rpc.invoke(method, ...params);
|
|
7148
7180
|
};
|
|
7149
7181
|
const dispose = async () => {
|
|
7150
|
-
const rpc = get$
|
|
7182
|
+
const rpc = get$8(rpcId);
|
|
7151
7183
|
remove$8(rpcId);
|
|
7152
7184
|
if (rpc) {
|
|
7153
7185
|
await rpc.dispose();
|
|
@@ -7159,7 +7191,7 @@ const dispose = async () => {
|
|
|
7159
7191
|
};
|
|
7160
7192
|
|
|
7161
7193
|
const getEditor = editorUid => {
|
|
7162
|
-
const instance = get$
|
|
7194
|
+
const instance = get$7(editorUid);
|
|
7163
7195
|
if (!instance) {
|
|
7164
7196
|
throw new Error(`editor ${editorUid} not found`);
|
|
7165
7197
|
}
|
|
@@ -7253,7 +7285,7 @@ const newStateGenerator$2 = async (state, parentUid) => {
|
|
|
7253
7285
|
} = state;
|
|
7254
7286
|
const {
|
|
7255
7287
|
newState
|
|
7256
|
-
} = get$
|
|
7288
|
+
} = get$7(parentUid);
|
|
7257
7289
|
const {
|
|
7258
7290
|
languageId
|
|
7259
7291
|
} = newState;
|
|
@@ -8076,7 +8108,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
8076
8108
|
await loadTokenizer(languageId, tokenizePath);
|
|
8077
8109
|
const tokenizer = getTokenizer(languageId);
|
|
8078
8110
|
const newTokenizerId = tokenizerId + 1;
|
|
8079
|
-
set$
|
|
8111
|
+
set$3(newTokenizerId, tokenizer);
|
|
8080
8112
|
const latest = getEditor(editor.uid);
|
|
8081
8113
|
if (!latest) {
|
|
8082
8114
|
return editor;
|
|
@@ -8231,7 +8263,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
8231
8263
|
} = state;
|
|
8232
8264
|
const {
|
|
8233
8265
|
newState
|
|
8234
|
-
} = get$
|
|
8266
|
+
} = get$7(parentUid);
|
|
8235
8267
|
const {
|
|
8236
8268
|
languageId
|
|
8237
8269
|
} = newState;
|
|
@@ -8315,7 +8347,7 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
8315
8347
|
} = state;
|
|
8316
8348
|
const {
|
|
8317
8349
|
newState
|
|
8318
|
-
} = get$
|
|
8350
|
+
} = get$7(parentUid);
|
|
8319
8351
|
const {
|
|
8320
8352
|
languageId
|
|
8321
8353
|
} = newState;
|
|
@@ -9227,7 +9259,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
9227
9259
|
...state,
|
|
9228
9260
|
commands
|
|
9229
9261
|
};
|
|
9230
|
-
const latest = get$
|
|
9262
|
+
const latest = get$7(editor.uid).newState;
|
|
9231
9263
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
9232
9264
|
return newEditor;
|
|
9233
9265
|
};
|
|
@@ -9542,7 +9574,7 @@ const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) =>
|
|
|
9542
9574
|
};
|
|
9543
9575
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
9544
9576
|
number(editorUid);
|
|
9545
|
-
const instance = get$
|
|
9577
|
+
const instance = get$7(editorUid);
|
|
9546
9578
|
const editor = instance.newState;
|
|
9547
9579
|
const {
|
|
9548
9580
|
selections
|
|
@@ -9951,7 +9983,7 @@ const getEditorSourceActions = async editorId => {
|
|
|
9951
9983
|
}
|
|
9952
9984
|
const {
|
|
9953
9985
|
newState
|
|
9954
|
-
} = get$
|
|
9986
|
+
} = get$7(editorId);
|
|
9955
9987
|
const {
|
|
9956
9988
|
languageId
|
|
9957
9989
|
} = newState;
|
|
@@ -9991,43 +10023,6 @@ const unsetAdditionalFocus = async focusKey => {
|
|
|
9991
10023
|
await invoke$b('Focus.removeAdditionalFocus', focusKey);
|
|
9992
10024
|
};
|
|
9993
10025
|
|
|
9994
|
-
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
9995
|
-
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
9996
|
-
};
|
|
9997
|
-
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
9998
|
-
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
9999
|
-
return false;
|
|
10000
|
-
}
|
|
10001
|
-
return oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.decorations !== newState.decorations || oldState.embeds !== newState.embeds || oldState.deltaX !== newState.deltaX || oldState.width !== newState.width || oldState.highlightedLine !== newState.highlightedLine || oldState.debugEnabled !== newState.debugEnabled;
|
|
10002
|
-
};
|
|
10003
|
-
const updateDerivedState = async (oldState, newState) => {
|
|
10004
|
-
let finalState = newState;
|
|
10005
|
-
if (shouldUpdateVisibleTextData(oldState, newState)) {
|
|
10006
|
-
const syncIncremental = getEnabled();
|
|
10007
|
-
const {
|
|
10008
|
-
differences,
|
|
10009
|
-
textInfos
|
|
10010
|
-
} = await getVisible$1(newState, syncIncremental);
|
|
10011
|
-
finalState = {
|
|
10012
|
-
...newState,
|
|
10013
|
-
differences,
|
|
10014
|
-
textInfos
|
|
10015
|
-
};
|
|
10016
|
-
}
|
|
10017
|
-
if (!shouldUpdateSelectionData(oldState, newState)) {
|
|
10018
|
-
return finalState;
|
|
10019
|
-
}
|
|
10020
|
-
const {
|
|
10021
|
-
cursorInfos,
|
|
10022
|
-
selectionInfos
|
|
10023
|
-
} = await getVisible(finalState);
|
|
10024
|
-
return {
|
|
10025
|
-
...finalState,
|
|
10026
|
-
cursorInfos,
|
|
10027
|
-
selectionInfos
|
|
10028
|
-
};
|
|
10029
|
-
};
|
|
10030
|
-
|
|
10031
10026
|
const FocusEditor = 12;
|
|
10032
10027
|
const FocusEditorCompletions = 9;
|
|
10033
10028
|
const FocusEditorRename = 11;
|
|
@@ -10096,7 +10091,7 @@ const setSelections2 = async (editorUid, selections) => {
|
|
|
10096
10091
|
selections
|
|
10097
10092
|
};
|
|
10098
10093
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10099
|
-
set$
|
|
10094
|
+
set$8(editorUid, editor, newEditorWithDerivedState);
|
|
10100
10095
|
};
|
|
10101
10096
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
10102
10097
|
const editor = getEditor(editorUid);
|
|
@@ -10116,7 +10111,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
10116
10111
|
widgets: newWidgets
|
|
10117
10112
|
};
|
|
10118
10113
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10119
|
-
set$
|
|
10114
|
+
set$8(editorUid, editor, newEditorWithDerivedState);
|
|
10120
10115
|
await setFocus(FocusEditorText);
|
|
10121
10116
|
if (unsetAdditionalFocus$1) {
|
|
10122
10117
|
await unsetAdditionalFocus(unsetAdditionalFocus$1);
|
|
@@ -10129,7 +10124,7 @@ const applyEdits2 = async (editorUid, edits) => {
|
|
|
10129
10124
|
const editor = getEditor(editorUid);
|
|
10130
10125
|
const newEditor = await applyEdit(editor, edits);
|
|
10131
10126
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10132
|
-
set$
|
|
10127
|
+
set$8(editorUid, editor, newEditorWithDerivedState);
|
|
10133
10128
|
};
|
|
10134
10129
|
const getSourceActions = async editorUid => {
|
|
10135
10130
|
const actions = await getEditorSourceActions(editorUid);
|
|
@@ -10592,7 +10587,7 @@ const getProblems = async () => {
|
|
|
10592
10587
|
const keys = getKeys$2();
|
|
10593
10588
|
const editors = keys.map(key => {
|
|
10594
10589
|
const numericKey = parseInt(key);
|
|
10595
|
-
const editor = get$
|
|
10590
|
+
const editor = get$7(numericKey);
|
|
10596
10591
|
return editor;
|
|
10597
10592
|
});
|
|
10598
10593
|
const newEditors = editors.map(editor => editor.newState);
|
|
@@ -10707,7 +10702,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
10707
10702
|
messagePort: port
|
|
10708
10703
|
});
|
|
10709
10704
|
if (rpcId) {
|
|
10710
|
-
set$
|
|
10705
|
+
set$f(rpcId, rpc);
|
|
10711
10706
|
}
|
|
10712
10707
|
};
|
|
10713
10708
|
|
|
@@ -10740,7 +10735,7 @@ const getWidgetName = widgetId => {
|
|
|
10740
10735
|
const saveWidgetState = async keys => {
|
|
10741
10736
|
const savedStates = Object.create(null);
|
|
10742
10737
|
for (const key of keys) {
|
|
10743
|
-
const editor = get$
|
|
10738
|
+
const editor = get$7(parseInt(key));
|
|
10744
10739
|
const {
|
|
10745
10740
|
widgets
|
|
10746
10741
|
} = editor.newState;
|
|
@@ -10759,7 +10754,7 @@ const restoreWidgetState = async (keys, savedStates) => {
|
|
|
10759
10754
|
const newEditors = [];
|
|
10760
10755
|
for (const key of keys) {
|
|
10761
10756
|
const editorUid = parseInt(key);
|
|
10762
|
-
const editor = get$
|
|
10757
|
+
const editor = get$7(editorUid);
|
|
10763
10758
|
const {
|
|
10764
10759
|
widgets
|
|
10765
10760
|
} = editor.newState;
|
|
@@ -10808,7 +10803,7 @@ const hotReload = async () => {
|
|
|
10808
10803
|
await relaunchWorkers();
|
|
10809
10804
|
const newEditors = await restoreWidgetState(keys, savedStates);
|
|
10810
10805
|
for (const editor of newEditors) {
|
|
10811
|
-
set$
|
|
10806
|
+
set$8(editor.newState.uid, editor.oldState, editor.newState);
|
|
10812
10807
|
}
|
|
10813
10808
|
|
|
10814
10809
|
// TODO ask renderer worker to rerender all editors
|
|
@@ -10844,7 +10839,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
10844
10839
|
if (syntaxHighlightingEnabled) {
|
|
10845
10840
|
setEnabled$1(true);
|
|
10846
10841
|
const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
|
|
10847
|
-
set$
|
|
10842
|
+
set$6(syntaxRpc);
|
|
10848
10843
|
}
|
|
10849
10844
|
if (syncIncremental) {
|
|
10850
10845
|
setEnabled(true);
|
|
@@ -10876,46 +10871,46 @@ const kAutoClosingQuotes = 'editor.autoClosingQuotes';
|
|
|
10876
10871
|
const kAutoClosingBrackets = 'editor.autoclosingBrackets';
|
|
10877
10872
|
const kFontWeight = 'editor.fontWeight';
|
|
10878
10873
|
const isAutoClosingBracketsEnabled = async () => {
|
|
10879
|
-
return Boolean(await get$
|
|
10874
|
+
return Boolean(await get$2(kAutoClosingBrackets));
|
|
10880
10875
|
};
|
|
10881
10876
|
const isAutoClosingQuotesEnabled = async () => {
|
|
10882
|
-
return Boolean(await get$
|
|
10877
|
+
return Boolean(await get$2(kAutoClosingQuotes));
|
|
10883
10878
|
};
|
|
10884
10879
|
const isQuickSuggestionsEnabled = async () => {
|
|
10885
|
-
return Boolean(await get$
|
|
10880
|
+
return Boolean(await get$2(kQuickSuggestions));
|
|
10886
10881
|
};
|
|
10887
10882
|
const isAutoClosingTagsEnabled = async () => {
|
|
10888
10883
|
return true;
|
|
10889
10884
|
};
|
|
10890
10885
|
const getRowHeight = async () => {
|
|
10891
|
-
return (await get$
|
|
10886
|
+
return (await get$2(kLineHeight)) || 20;
|
|
10892
10887
|
};
|
|
10893
10888
|
const getFontSize = async () => {
|
|
10894
|
-
return (await get$
|
|
10889
|
+
return (await get$2(kFontSize)) || 15; // TODO find out if it is possible to use all numeric values for settings for efficiency, maybe settings could be an array
|
|
10895
10890
|
};
|
|
10896
10891
|
const getFontFamily = async () => {
|
|
10897
|
-
return (await get$
|
|
10892
|
+
return (await get$2(kFontFamily)) || 'Fira Code';
|
|
10898
10893
|
};
|
|
10899
10894
|
const getLetterSpacing = async () => {
|
|
10900
10895
|
// if (!false) {
|
|
10901
10896
|
// return 0
|
|
10902
10897
|
// }
|
|
10903
|
-
return (await get$
|
|
10898
|
+
return (await get$2(kLetterSpacing)) ?? 0.5;
|
|
10904
10899
|
};
|
|
10905
10900
|
const getTabSize = async () => {
|
|
10906
|
-
return (await get$
|
|
10901
|
+
return (await get$2(kTabSize)) || 2;
|
|
10907
10902
|
};
|
|
10908
10903
|
const getLineNumbers = async () => {
|
|
10909
|
-
return (await get$
|
|
10904
|
+
return (await get$2(kLineNumbers)) ?? false;
|
|
10910
10905
|
};
|
|
10911
10906
|
const getCompletionTriggerCharacters = async () => {
|
|
10912
10907
|
return ['.', '/'];
|
|
10913
10908
|
};
|
|
10914
10909
|
const diagnosticsEnabled = async () => {
|
|
10915
|
-
return (await get$
|
|
10910
|
+
return (await get$2(kDiagnostics)) ?? false;
|
|
10916
10911
|
};
|
|
10917
10912
|
const getFontWeight = async () => {
|
|
10918
|
-
return (await get$
|
|
10913
|
+
return (await get$2(kFontWeight)) ?? 400;
|
|
10919
10914
|
};
|
|
10920
10915
|
|
|
10921
10916
|
const getEditorPreferences = async () => {
|
|
@@ -10980,7 +10975,7 @@ const loadContent = async (state, savedState) => {
|
|
|
10980
10975
|
await loadTokenizer(computedLanguageId, tokenizePath);
|
|
10981
10976
|
const tokenizer = getTokenizer(computedLanguageId);
|
|
10982
10977
|
const newTokenizerId = state.tokenizerId + 1;
|
|
10983
|
-
set$
|
|
10978
|
+
set$3(newTokenizerId, tokenizer);
|
|
10984
10979
|
const newEditor0 = {
|
|
10985
10980
|
...state,
|
|
10986
10981
|
charWidth,
|
|
@@ -11035,7 +11030,7 @@ const loadContent = async (state, savedState) => {
|
|
|
11035
11030
|
if (diagnosticsEnabled) {
|
|
11036
11031
|
await updateDiagnostics(newEditor4);
|
|
11037
11032
|
}
|
|
11038
|
-
const completionsOnTypeRaw = await get$
|
|
11033
|
+
const completionsOnTypeRaw = await get$2('editor.completionsOnType');
|
|
11039
11034
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
11040
11035
|
const newEditor5 = {
|
|
11041
11036
|
...newEditor4,
|
|
@@ -11143,7 +11138,7 @@ const renderCss = (oldState, newState) => {
|
|
|
11143
11138
|
};
|
|
11144
11139
|
|
|
11145
11140
|
const renderFocus$2 = (oldState, newState) => {
|
|
11146
|
-
const selector = '.EditorInput';
|
|
11141
|
+
const selector = '.EditorInput textarea';
|
|
11147
11142
|
return [FocusSelector, newState.uid, selector];
|
|
11148
11143
|
};
|
|
11149
11144
|
|
|
@@ -11414,6 +11409,10 @@ const diffTree = (oldNodes, newNodes) => {
|
|
|
11414
11409
|
|
|
11415
11410
|
const getEditorInputVirtualDom = () => {
|
|
11416
11411
|
return [{
|
|
11412
|
+
childCount: 1,
|
|
11413
|
+
className: 'EditorInput',
|
|
11414
|
+
type: Div
|
|
11415
|
+
}, {
|
|
11417
11416
|
ariaAutoComplete: 'list',
|
|
11418
11417
|
ariaMultiLine: 'true',
|
|
11419
11418
|
ariaRoleDescription: 'editor',
|
|
@@ -11421,7 +11420,6 @@ const getEditorInputVirtualDom = () => {
|
|
|
11421
11420
|
autocomplete: 'off',
|
|
11422
11421
|
autocorrect: 'off',
|
|
11423
11422
|
childCount: 0,
|
|
11424
|
-
className: 'EditorInput',
|
|
11425
11423
|
name: 'editor',
|
|
11426
11424
|
onBeforeInput: HandleBeforeInput,
|
|
11427
11425
|
onBlur: HandleBlur,
|
|
@@ -11679,13 +11677,14 @@ const getEditorVirtualDom = ({
|
|
|
11679
11677
|
selectionInfos = [],
|
|
11680
11678
|
textInfos
|
|
11681
11679
|
}) => {
|
|
11680
|
+
const gutterDom = lineNumbers ? getEditorGutterVirtualDom(gutterInfos) : [];
|
|
11682
11681
|
return [{
|
|
11683
|
-
childCount: 2,
|
|
11682
|
+
childCount: lineNumbers ? 2 : 1,
|
|
11684
11683
|
className: 'Viewlet Editor',
|
|
11685
11684
|
onContextMenu: HandleContextMenu,
|
|
11686
11685
|
role: 'code',
|
|
11687
11686
|
type: Div
|
|
11688
|
-
}, ...
|
|
11687
|
+
}, ...gutterDom, ...getEditorContentVirtualDom({
|
|
11689
11688
|
cursorInfos,
|
|
11690
11689
|
deltaY,
|
|
11691
11690
|
diagnostics,
|
|
@@ -11701,6 +11700,14 @@ const getEditorVirtualDom = ({
|
|
|
11701
11700
|
})];
|
|
11702
11701
|
};
|
|
11703
11702
|
|
|
11703
|
+
const renderedDoms = new Map();
|
|
11704
|
+
const get = uid => {
|
|
11705
|
+
return renderedDoms.get(uid);
|
|
11706
|
+
};
|
|
11707
|
+
const set = (uid, dom) => {
|
|
11708
|
+
renderedDoms.set(uid, dom);
|
|
11709
|
+
};
|
|
11710
|
+
|
|
11704
11711
|
const getDom = state => {
|
|
11705
11712
|
const {
|
|
11706
11713
|
initial,
|
|
@@ -11711,13 +11718,24 @@ const getDom = state => {
|
|
|
11711
11718
|
}
|
|
11712
11719
|
return getEditorVirtualDom(state);
|
|
11713
11720
|
};
|
|
11721
|
+
const isFastScroll = (oldState, newState) => {
|
|
11722
|
+
return Math.abs(newState.minLineY - oldState.minLineY) > 1;
|
|
11723
|
+
};
|
|
11714
11724
|
const renderIncremental = (oldState, newState) => {
|
|
11715
|
-
const oldDom = getDom(oldState);
|
|
11725
|
+
const oldDom = oldState.initial ? getDom(oldState) : get(newState.uid) || getDom(oldState);
|
|
11716
11726
|
const newDom = getDom(newState);
|
|
11727
|
+
if (isFastScroll(oldState, newState)) {
|
|
11728
|
+
set(newState.uid, newDom);
|
|
11729
|
+
return [SetPatches, newState.uid, [{
|
|
11730
|
+
nodes: newDom,
|
|
11731
|
+
type: 6
|
|
11732
|
+
}]];
|
|
11733
|
+
}
|
|
11717
11734
|
const patches = diffTree(oldDom, newDom);
|
|
11718
11735
|
if (patches.length === 0) {
|
|
11719
11736
|
return [];
|
|
11720
11737
|
}
|
|
11738
|
+
set(newState.uid, newDom);
|
|
11721
11739
|
return [SetPatches, newState.uid, patches];
|
|
11722
11740
|
};
|
|
11723
11741
|
|
|
@@ -11752,28 +11770,28 @@ const render2 = (uid, diffResult) => {
|
|
|
11752
11770
|
const {
|
|
11753
11771
|
newState,
|
|
11754
11772
|
oldState
|
|
11755
|
-
} = get$
|
|
11756
|
-
set$
|
|
11773
|
+
} = get$7(uid);
|
|
11774
|
+
set$8(uid, newState, newState);
|
|
11757
11775
|
const commands = applyRender(oldState, newState, diffResult);
|
|
11758
11776
|
return commands;
|
|
11759
11777
|
};
|
|
11760
11778
|
|
|
11761
11779
|
const addWidget = widget => {
|
|
11762
|
-
const module = get$
|
|
11780
|
+
const module = get$6(widget.id);
|
|
11763
11781
|
if (!module) {
|
|
11764
11782
|
throw new Error('unsupported widget');
|
|
11765
11783
|
}
|
|
11766
11784
|
return module.add(widget);
|
|
11767
11785
|
};
|
|
11768
11786
|
const renderWidget = widget => {
|
|
11769
|
-
const module = get$
|
|
11787
|
+
const module = get$6(widget.id);
|
|
11770
11788
|
if (!module) {
|
|
11771
11789
|
throw new Error('unsupported widget');
|
|
11772
11790
|
}
|
|
11773
11791
|
return module.render(widget);
|
|
11774
11792
|
};
|
|
11775
11793
|
const removeWidget = widget => {
|
|
11776
|
-
const module = get$
|
|
11794
|
+
const module = get$6(widget.id);
|
|
11777
11795
|
if (!module) {
|
|
11778
11796
|
throw new Error('unsupported widget');
|
|
11779
11797
|
}
|
|
@@ -11863,16 +11881,17 @@ const renderGutterInfo = {
|
|
|
11863
11881
|
maxLineY,
|
|
11864
11882
|
minLineY
|
|
11865
11883
|
} = newState;
|
|
11884
|
+
if (!lineNumbers) {
|
|
11885
|
+
return [];
|
|
11886
|
+
}
|
|
11866
11887
|
const gutterInfos = [];
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
gutterInfos.push(i + 1);
|
|
11870
|
-
}
|
|
11888
|
+
for (let i = minLineY; i < maxLineY; i++) {
|
|
11889
|
+
gutterInfos.push(i + 1);
|
|
11871
11890
|
}
|
|
11872
11891
|
const dom = getEditorGutterVirtualDom$1(gutterInfos);
|
|
11873
11892
|
return ['renderGutter', dom];
|
|
11874
11893
|
},
|
|
11875
|
-
isEqual: (oldState, newState) => oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
11894
|
+
isEqual: (oldState, newState) => oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
11876
11895
|
};
|
|
11877
11896
|
const renderWidgets = {
|
|
11878
11897
|
apply(oldState, newState) {
|
|
@@ -11931,7 +11950,7 @@ const renderWidgets = {
|
|
|
11931
11950
|
};
|
|
11932
11951
|
const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
11933
11952
|
const renderEditor = async id => {
|
|
11934
|
-
const instance = get$
|
|
11953
|
+
const instance = get$7(id);
|
|
11935
11954
|
if (!instance) {
|
|
11936
11955
|
return [];
|
|
11937
11956
|
}
|
|
@@ -11940,7 +11959,7 @@ const renderEditor = async id => {
|
|
|
11940
11959
|
oldState
|
|
11941
11960
|
} = instance;
|
|
11942
11961
|
const commands = [];
|
|
11943
|
-
set$
|
|
11962
|
+
set$8(id, newState, newState);
|
|
11944
11963
|
for (const item of render$6) {
|
|
11945
11964
|
if (item.isEqual(oldState, newState)) {
|
|
11946
11965
|
continue;
|
|
@@ -12065,7 +12084,7 @@ const unregisterListener = (listenerType, rpcId) => {
|
|
|
12065
12084
|
};
|
|
12066
12085
|
|
|
12067
12086
|
const invoke = async (method, ...params) => {
|
|
12068
|
-
const worker = get$
|
|
12087
|
+
const worker = get$8(DebugWorker);
|
|
12069
12088
|
return worker.invoke(method, ...params);
|
|
12070
12089
|
};
|
|
12071
12090
|
|
|
@@ -12081,7 +12100,7 @@ const getKey = () => {
|
|
|
12081
12100
|
const updateDebugInfo = async debugId => {
|
|
12082
12101
|
const newInfo = await getDebugHighlight(debugId);
|
|
12083
12102
|
const key = getKey();
|
|
12084
|
-
const instance = get$
|
|
12103
|
+
const instance = get$7(key);
|
|
12085
12104
|
if (!instance) {
|
|
12086
12105
|
return;
|
|
12087
12106
|
}
|
|
@@ -12093,7 +12112,7 @@ const updateDebugInfo = async debugId => {
|
|
|
12093
12112
|
...newState,
|
|
12094
12113
|
highlightedLine: newInfo.rowIndex
|
|
12095
12114
|
};
|
|
12096
|
-
set$
|
|
12115
|
+
set$8(key, oldState, newEditor);
|
|
12097
12116
|
// @ts-ignore
|
|
12098
12117
|
await invoke$b('Editor.rerender', key);
|
|
12099
12118
|
};
|
|
@@ -12102,7 +12121,7 @@ const updateDebugInfo = async debugId => {
|
|
|
12102
12121
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
12103
12122
|
|
|
12104
12123
|
const wrapCommand = fn => async (editorUid, ...args) => {
|
|
12105
|
-
const oldInstance = get$
|
|
12124
|
+
const oldInstance = get$7(editorUid);
|
|
12106
12125
|
const state = oldInstance.newState;
|
|
12107
12126
|
const newEditor = await fn(state, ...args);
|
|
12108
12127
|
if (state === newEditor) {
|
|
@@ -12114,7 +12133,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
12114
12133
|
|
|
12115
12134
|
// TODO combine neweditor with latest editor?
|
|
12116
12135
|
|
|
12117
|
-
set$
|
|
12136
|
+
set$8(editorUid, state, newEditorWithDerivedState);
|
|
12118
12137
|
return newEditorWithDerivedState;
|
|
12119
12138
|
};
|
|
12120
12139
|
|
|
@@ -12395,7 +12414,7 @@ const createExtensionHostRpc = async () => {
|
|
|
12395
12414
|
|
|
12396
12415
|
const initializeExtensionHost = async () => {
|
|
12397
12416
|
const extensionHostRpc = await createExtensionHostRpc();
|
|
12398
|
-
set$
|
|
12417
|
+
set$2(extensionHostRpc);
|
|
12399
12418
|
};
|
|
12400
12419
|
|
|
12401
12420
|
const createExtensionManagementWorkerRpc = async () => {
|
|
@@ -12411,7 +12430,7 @@ const createExtensionManagementWorkerRpc = async () => {
|
|
|
12411
12430
|
const initializeExtensionManagementWorker = async () => {
|
|
12412
12431
|
try {
|
|
12413
12432
|
const rpc = await createExtensionManagementWorkerRpc();
|
|
12414
|
-
set$
|
|
12433
|
+
set$d(rpc);
|
|
12415
12434
|
} catch {
|
|
12416
12435
|
// ignore
|
|
12417
12436
|
}
|
|
@@ -12426,14 +12445,14 @@ const initializeOpenerWorker = async () => {
|
|
|
12426
12445
|
commandMap: {},
|
|
12427
12446
|
send: send$1
|
|
12428
12447
|
});
|
|
12429
|
-
set$
|
|
12448
|
+
set$c(rpc);
|
|
12430
12449
|
};
|
|
12431
12450
|
|
|
12432
12451
|
const initializeRendererWorker = async () => {
|
|
12433
12452
|
const rpc = await create$a({
|
|
12434
12453
|
commandMap: commandMap
|
|
12435
12454
|
});
|
|
12436
|
-
set$
|
|
12455
|
+
set$a(rpc);
|
|
12437
12456
|
};
|
|
12438
12457
|
|
|
12439
12458
|
const send = port => {
|
|
@@ -12444,7 +12463,7 @@ const initializeTextMeasurementWorker = async () => {
|
|
|
12444
12463
|
commandMap: {},
|
|
12445
12464
|
send
|
|
12446
12465
|
});
|
|
12447
|
-
set$
|
|
12466
|
+
set$b(rpc);
|
|
12448
12467
|
};
|
|
12449
12468
|
|
|
12450
12469
|
const listen = async () => {
|
|
@@ -12729,14 +12748,14 @@ const EditorHoverWidget = {
|
|
|
12729
12748
|
};
|
|
12730
12749
|
|
|
12731
12750
|
const registerWidgets = () => {
|
|
12732
|
-
set$
|
|
12733
|
-
set$
|
|
12734
|
-
set$
|
|
12735
|
-
set$
|
|
12736
|
-
set$
|
|
12737
|
-
set$
|
|
12738
|
-
set$
|
|
12739
|
-
set$
|
|
12751
|
+
set$7(ColorPicker$1, EditorColorPickerWidget);
|
|
12752
|
+
set$7(Completion, EditorCompletionWidget);
|
|
12753
|
+
set$7(CompletionDetail, EditorCompletionDetailWidget);
|
|
12754
|
+
set$7(Find, EditorFindWidget);
|
|
12755
|
+
set$7(Hover, EditorHoverWidget);
|
|
12756
|
+
set$7(Rename$1, EditorRenameWidget);
|
|
12757
|
+
set$7(SourceAction$1, EditorSourceActionWidget);
|
|
12758
|
+
set$7(CodeGenerator, EditorCodeGeneratorWidget);
|
|
12740
12759
|
};
|
|
12741
12760
|
|
|
12742
12761
|
const handleUnhandledRejection = event => {
|