@lvce-editor/hover-worker 1.4.0 → 2.0.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/hoverWorkerMain.js +195 -168
- package/package.json +1 -1
package/dist/hoverWorkerMain.js
CHANGED
|
@@ -882,7 +882,7 @@ const send = (transport, method, ...params) => {
|
|
|
882
882
|
const invoke$4 = (ipc, method, ...params) => {
|
|
883
883
|
return invokeHelper(ipc, method, params, false);
|
|
884
884
|
};
|
|
885
|
-
const invokeAndTransfer$
|
|
885
|
+
const invokeAndTransfer$2 = (ipc, method, ...params) => {
|
|
886
886
|
return invokeHelper(ipc, method, params, true);
|
|
887
887
|
};
|
|
888
888
|
|
|
@@ -921,7 +921,7 @@ const createRpc = ipc => {
|
|
|
921
921
|
return invoke$4(ipc, method, ...params);
|
|
922
922
|
},
|
|
923
923
|
invokeAndTransfer(method, ...params) {
|
|
924
|
-
return invokeAndTransfer$
|
|
924
|
+
return invokeAndTransfer$2(ipc, method, ...params);
|
|
925
925
|
},
|
|
926
926
|
async dispose() {
|
|
927
927
|
await ipc?.dispose();
|
|
@@ -975,20 +975,25 @@ const create$5 = async ({
|
|
|
975
975
|
messagePort.start();
|
|
976
976
|
return rpc;
|
|
977
977
|
};
|
|
978
|
-
const create$
|
|
978
|
+
const create$3 = async ({
|
|
979
979
|
commandMap,
|
|
980
|
-
|
|
980
|
+
send
|
|
981
981
|
}) => {
|
|
982
|
+
const {
|
|
983
|
+
port1,
|
|
984
|
+
port2
|
|
985
|
+
} = new MessageChannel();
|
|
986
|
+
await send(port1);
|
|
982
987
|
return create$5({
|
|
983
988
|
commandMap,
|
|
984
|
-
messagePort
|
|
989
|
+
messagePort: port2
|
|
985
990
|
});
|
|
986
991
|
};
|
|
987
|
-
const
|
|
992
|
+
const TransferMessagePortRpcParent = {
|
|
988
993
|
__proto__: null,
|
|
989
|
-
create: create$
|
|
994
|
+
create: create$3
|
|
990
995
|
};
|
|
991
|
-
const create$
|
|
996
|
+
const create$4 = async ({
|
|
992
997
|
commandMap
|
|
993
998
|
}) => {
|
|
994
999
|
// TODO create a commandMap per rpc instance
|
|
@@ -1000,7 +1005,7 @@ const create$3 = async ({
|
|
|
1000
1005
|
};
|
|
1001
1006
|
const WebWorkerRpcClient = {
|
|
1002
1007
|
__proto__: null,
|
|
1003
|
-
create: create$
|
|
1008
|
+
create: create$4
|
|
1004
1009
|
};
|
|
1005
1010
|
const createMockRpc = ({
|
|
1006
1011
|
commandMap
|
|
@@ -1022,6 +1027,90 @@ const createMockRpc = ({
|
|
|
1022
1027
|
return mockRpc;
|
|
1023
1028
|
};
|
|
1024
1029
|
|
|
1030
|
+
const toCommandId = key => {
|
|
1031
|
+
const dotIndex = key.indexOf('.');
|
|
1032
|
+
return key.slice(dotIndex + 1);
|
|
1033
|
+
};
|
|
1034
|
+
const create$2 = () => {
|
|
1035
|
+
const states = Object.create(null);
|
|
1036
|
+
const commandMapRef = {};
|
|
1037
|
+
return {
|
|
1038
|
+
get(uid) {
|
|
1039
|
+
return states[uid];
|
|
1040
|
+
},
|
|
1041
|
+
set(uid, oldState, newState) {
|
|
1042
|
+
states[uid] = {
|
|
1043
|
+
oldState,
|
|
1044
|
+
newState
|
|
1045
|
+
};
|
|
1046
|
+
},
|
|
1047
|
+
dispose(uid) {
|
|
1048
|
+
delete states[uid];
|
|
1049
|
+
},
|
|
1050
|
+
getKeys() {
|
|
1051
|
+
return Object.keys(states).map(key => {
|
|
1052
|
+
return Number.parseInt(key);
|
|
1053
|
+
});
|
|
1054
|
+
},
|
|
1055
|
+
clear() {
|
|
1056
|
+
for (const key of Object.keys(states)) {
|
|
1057
|
+
delete states[key];
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
wrapCommand(fn) {
|
|
1061
|
+
const wrapped = async (uid, ...args) => {
|
|
1062
|
+
const {
|
|
1063
|
+
newState
|
|
1064
|
+
} = states[uid];
|
|
1065
|
+
const newerState = await fn(newState, ...args);
|
|
1066
|
+
if (newState === newerState) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
const latest = states[uid];
|
|
1070
|
+
states[uid] = {
|
|
1071
|
+
oldState: latest.oldState,
|
|
1072
|
+
newState: newerState
|
|
1073
|
+
};
|
|
1074
|
+
};
|
|
1075
|
+
return wrapped;
|
|
1076
|
+
},
|
|
1077
|
+
wrapGetter(fn) {
|
|
1078
|
+
const wrapped = (uid, ...args) => {
|
|
1079
|
+
const {
|
|
1080
|
+
newState
|
|
1081
|
+
} = states[uid];
|
|
1082
|
+
return fn(newState, ...args);
|
|
1083
|
+
};
|
|
1084
|
+
return wrapped;
|
|
1085
|
+
},
|
|
1086
|
+
diff(uid, modules, numbers) {
|
|
1087
|
+
const {
|
|
1088
|
+
oldState,
|
|
1089
|
+
newState
|
|
1090
|
+
} = states[uid];
|
|
1091
|
+
const diffResult = [];
|
|
1092
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1093
|
+
const fn = modules[i];
|
|
1094
|
+
if (!fn(oldState, newState)) {
|
|
1095
|
+
diffResult.push(numbers[i]);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return diffResult;
|
|
1099
|
+
},
|
|
1100
|
+
getCommandIds() {
|
|
1101
|
+
const keys = Object.keys(commandMapRef);
|
|
1102
|
+
const ids = keys.map(toCommandId);
|
|
1103
|
+
return ids;
|
|
1104
|
+
},
|
|
1105
|
+
registerCommands(commandMap) {
|
|
1106
|
+
Object.assign(commandMapRef, commandMap);
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
};
|
|
1110
|
+
const terminate = () => {
|
|
1111
|
+
globalThis.close();
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1025
1114
|
const Text = 12;
|
|
1026
1115
|
|
|
1027
1116
|
const EditorWorker$1 = 99;
|
|
@@ -1037,7 +1126,7 @@ const get$1 = id => {
|
|
|
1037
1126
|
return rpcs[id];
|
|
1038
1127
|
};
|
|
1039
1128
|
|
|
1040
|
-
const create$
|
|
1129
|
+
const create$1 = rpcId => {
|
|
1041
1130
|
return {
|
|
1042
1131
|
// @ts-ignore
|
|
1043
1132
|
invoke(method, ...params) {
|
|
@@ -1063,13 +1152,13 @@ const create$2 = rpcId => {
|
|
|
1063
1152
|
|
|
1064
1153
|
const {
|
|
1065
1154
|
invoke: invoke$3,
|
|
1066
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1155
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1067
1156
|
set: set$4,
|
|
1068
1157
|
dispose: dispose$3
|
|
1069
|
-
} = create$
|
|
1070
|
-
const sendMessagePortToExtensionHostWorker$
|
|
1158
|
+
} = create$1(EditorWorker$1);
|
|
1159
|
+
const sendMessagePortToExtensionHostWorker$2 = async port => {
|
|
1071
1160
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1072
|
-
await invokeAndTransfer$
|
|
1161
|
+
await invokeAndTransfer$1(
|
|
1073
1162
|
// @ts-ignore
|
|
1074
1163
|
'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, 0);
|
|
1075
1164
|
};
|
|
@@ -1114,7 +1203,7 @@ const getSelections = async editorUid => {
|
|
|
1114
1203
|
const getWordAtOffset2$1 = async editorUid => {
|
|
1115
1204
|
return invoke$3('Editor.getWordAtOffset2', editorUid);
|
|
1116
1205
|
};
|
|
1117
|
-
const getWordBefore = async (editorUid, rowIndex, columnIndex) => {
|
|
1206
|
+
const getWordBefore$1 = async (editorUid, rowIndex, columnIndex) => {
|
|
1118
1207
|
return invoke$3('Editor.getWordBefore2', editorUid, rowIndex, columnIndex);
|
|
1119
1208
|
};
|
|
1120
1209
|
const updateDebugInfo = async info => {
|
|
@@ -1156,21 +1245,21 @@ const EditorWorker = {
|
|
|
1156
1245
|
getUri,
|
|
1157
1246
|
getWordAt,
|
|
1158
1247
|
getWordAtOffset2: getWordAtOffset2$1,
|
|
1159
|
-
getWordBefore,
|
|
1248
|
+
getWordBefore: getWordBefore$1,
|
|
1160
1249
|
invoke: invoke$3,
|
|
1161
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1250
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1162
1251
|
registerMockRpc: registerMockRpc$1,
|
|
1163
|
-
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$
|
|
1252
|
+
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$2,
|
|
1164
1253
|
set: set$4,
|
|
1165
1254
|
updateDebugInfo
|
|
1166
1255
|
};
|
|
1167
1256
|
|
|
1168
1257
|
const {
|
|
1169
1258
|
invoke: invoke$2,
|
|
1170
|
-
invokeAndTransfer
|
|
1259
|
+
invokeAndTransfer,
|
|
1171
1260
|
set: set$3,
|
|
1172
1261
|
dispose: dispose$2
|
|
1173
|
-
} = create$
|
|
1262
|
+
} = create$1(ExtensionHostWorker);
|
|
1174
1263
|
const executeReferenceProvider = async (id, offset) => {
|
|
1175
1264
|
// @ts-ignore
|
|
1176
1265
|
return invoke$2('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
@@ -1198,7 +1287,7 @@ const ExtensionHost = {
|
|
|
1198
1287
|
executeReferenceProvider,
|
|
1199
1288
|
getRuntimeStatus,
|
|
1200
1289
|
invoke: invoke$2,
|
|
1201
|
-
invokeAndTransfer
|
|
1290
|
+
invokeAndTransfer,
|
|
1202
1291
|
registerMockRpc,
|
|
1203
1292
|
set: set$3
|
|
1204
1293
|
};
|
|
@@ -1206,8 +1295,9 @@ const ExtensionHost = {
|
|
|
1206
1295
|
const {
|
|
1207
1296
|
invoke: invoke$1,
|
|
1208
1297
|
set: set$2,
|
|
1209
|
-
|
|
1210
|
-
|
|
1298
|
+
getWordAtOffset2,
|
|
1299
|
+
getWordBefore,
|
|
1300
|
+
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1
|
|
1211
1301
|
} = EditorWorker;
|
|
1212
1302
|
|
|
1213
1303
|
const FocusEditorHovers = 9;
|
|
@@ -1224,93 +1314,12 @@ const close = async state => {
|
|
|
1224
1314
|
return state;
|
|
1225
1315
|
};
|
|
1226
1316
|
|
|
1227
|
-
const toCommandId = key => {
|
|
1228
|
-
const dotIndex = key.indexOf('.');
|
|
1229
|
-
return key.slice(dotIndex + 1);
|
|
1230
|
-
};
|
|
1231
|
-
const create$1 = () => {
|
|
1232
|
-
const states = Object.create(null);
|
|
1233
|
-
const commandMapRef = {};
|
|
1234
|
-
return {
|
|
1235
|
-
get(uid) {
|
|
1236
|
-
return states[uid];
|
|
1237
|
-
},
|
|
1238
|
-
set(uid, oldState, newState) {
|
|
1239
|
-
states[uid] = {
|
|
1240
|
-
oldState,
|
|
1241
|
-
newState
|
|
1242
|
-
};
|
|
1243
|
-
},
|
|
1244
|
-
dispose(uid) {
|
|
1245
|
-
delete states[uid];
|
|
1246
|
-
},
|
|
1247
|
-
getKeys() {
|
|
1248
|
-
return Object.keys(states).map(key => {
|
|
1249
|
-
return Number.parseInt(key);
|
|
1250
|
-
});
|
|
1251
|
-
},
|
|
1252
|
-
clear() {
|
|
1253
|
-
for (const key of Object.keys(states)) {
|
|
1254
|
-
delete states[key];
|
|
1255
|
-
}
|
|
1256
|
-
},
|
|
1257
|
-
wrapCommand(fn) {
|
|
1258
|
-
const wrapped = async (uid, ...args) => {
|
|
1259
|
-
const {
|
|
1260
|
-
newState
|
|
1261
|
-
} = states[uid];
|
|
1262
|
-
const newerState = await fn(newState, ...args);
|
|
1263
|
-
if (newState === newerState) {
|
|
1264
|
-
return;
|
|
1265
|
-
}
|
|
1266
|
-
const latest = states[uid];
|
|
1267
|
-
states[uid] = {
|
|
1268
|
-
oldState: latest.oldState,
|
|
1269
|
-
newState: newerState
|
|
1270
|
-
};
|
|
1271
|
-
};
|
|
1272
|
-
return wrapped;
|
|
1273
|
-
},
|
|
1274
|
-
wrapGetter(fn) {
|
|
1275
|
-
const wrapped = (uid, ...args) => {
|
|
1276
|
-
const {
|
|
1277
|
-
newState
|
|
1278
|
-
} = states[uid];
|
|
1279
|
-
return fn(newState, ...args);
|
|
1280
|
-
};
|
|
1281
|
-
return wrapped;
|
|
1282
|
-
},
|
|
1283
|
-
diff(uid, modules, numbers) {
|
|
1284
|
-
const {
|
|
1285
|
-
oldState,
|
|
1286
|
-
newState
|
|
1287
|
-
} = states[uid];
|
|
1288
|
-
const diffResult = [];
|
|
1289
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1290
|
-
const fn = modules[i];
|
|
1291
|
-
if (!fn(oldState, newState)) {
|
|
1292
|
-
diffResult.push(numbers[i]);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
return diffResult;
|
|
1296
|
-
},
|
|
1297
|
-
getCommandIds() {
|
|
1298
|
-
const keys = Object.keys(commandMapRef);
|
|
1299
|
-
const ids = keys.map(toCommandId);
|
|
1300
|
-
return ids;
|
|
1301
|
-
},
|
|
1302
|
-
registerCommands(commandMap) {
|
|
1303
|
-
Object.assign(commandMapRef, commandMap);
|
|
1304
|
-
}
|
|
1305
|
-
};
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
1317
|
const {
|
|
1309
1318
|
get,
|
|
1310
1319
|
set: set$1,
|
|
1311
1320
|
wrapCommand,
|
|
1312
1321
|
dispose: dispose$1
|
|
1313
|
-
} = create$
|
|
1322
|
+
} = create$2();
|
|
1314
1323
|
|
|
1315
1324
|
const create = (uid, x, y, width, height, editorUid, editorLanguageId) => {
|
|
1316
1325
|
const state = {
|
|
@@ -1461,36 +1470,16 @@ const handleSashPointerUp = (state, eventX, eventY) => {
|
|
|
1461
1470
|
return state;
|
|
1462
1471
|
};
|
|
1463
1472
|
|
|
1464
|
-
const getPortTuple = () => {
|
|
1465
|
-
const {
|
|
1466
|
-
port1,
|
|
1467
|
-
port2
|
|
1468
|
-
} = new MessageChannel();
|
|
1469
|
-
return {
|
|
1470
|
-
port1,
|
|
1471
|
-
port2
|
|
1472
|
-
};
|
|
1473
|
-
};
|
|
1474
|
-
|
|
1475
1473
|
const sendMessagePortToExtensionHostWorker = async port => {
|
|
1476
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1477
1474
|
// @ts-ignore
|
|
1478
|
-
await
|
|
1479
|
-
// @ts-ignore
|
|
1480
|
-
'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, 0 // TODO
|
|
1481
|
-
);
|
|
1475
|
+
await sendMessagePortToExtensionHostWorker$1(port);
|
|
1482
1476
|
};
|
|
1483
1477
|
|
|
1484
1478
|
const createExtensionHostRpc = async () => {
|
|
1485
1479
|
try {
|
|
1486
|
-
const {
|
|
1487
|
-
port1,
|
|
1488
|
-
port2
|
|
1489
|
-
} = getPortTuple();
|
|
1490
|
-
await sendMessagePortToExtensionHostWorker(port2);
|
|
1491
|
-
const rpc = await PlainMessagePortRpcParent.create({
|
|
1480
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
1492
1481
|
commandMap: {},
|
|
1493
|
-
|
|
1482
|
+
send: sendMessagePortToExtensionHostWorker
|
|
1494
1483
|
});
|
|
1495
1484
|
return rpc;
|
|
1496
1485
|
} catch (error) {
|
|
@@ -1508,6 +1497,35 @@ const initialize = async () => {
|
|
|
1508
1497
|
set(rpc);
|
|
1509
1498
|
};
|
|
1510
1499
|
|
|
1500
|
+
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
1501
|
+
// TODO ask editor worker or renderer process
|
|
1502
|
+
return 100;
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1505
|
+
const tokenizeCodeBlock = async (codeBlock, languageId, tokenizerPath) => {
|
|
1506
|
+
// TODO maybe use syntax highlighting worker for this or another worker
|
|
1507
|
+
return [];
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
const getHoverDetails = async (hover, error, hoverFullWidth, hoverPaddingLeft, hoverPaddingRight, hoverBorderLeft, hoverBorderRight, hoverDocumentationFontFamily, hoverDocumentationFontSize, hoverDocumentationLineHeight, fallbackDisplayStringLanguageId) => {
|
|
1511
|
+
if (error) {
|
|
1512
|
+
return {
|
|
1513
|
+
lineInfos: [],
|
|
1514
|
+
documentation: '',
|
|
1515
|
+
documentationHeight: 0
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
const {
|
|
1519
|
+
documentation} = hover;
|
|
1520
|
+
const lineInfos = await tokenizeCodeBlock();
|
|
1521
|
+
const documentationHeight = await measureTextBlockHeight();
|
|
1522
|
+
return {
|
|
1523
|
+
lineInfos,
|
|
1524
|
+
documentation,
|
|
1525
|
+
documentationHeight
|
|
1526
|
+
};
|
|
1527
|
+
};
|
|
1528
|
+
|
|
1511
1529
|
// @deprecated this doesn't work for variable width characters (unicode/emoji).
|
|
1512
1530
|
// Use position computation in renderer process instead
|
|
1513
1531
|
|
|
@@ -1534,6 +1552,15 @@ const y = (editor, rowIndex) => {
|
|
|
1534
1552
|
return offsetY;
|
|
1535
1553
|
};
|
|
1536
1554
|
|
|
1555
|
+
const getHoverPositionXy = (editor, rowIndex, wordStart) => {
|
|
1556
|
+
const x$1 = x(editor, rowIndex, wordStart);
|
|
1557
|
+
const y$1 = editor.height - y(editor, rowIndex) + editor.y + 40;
|
|
1558
|
+
return {
|
|
1559
|
+
x: x$1,
|
|
1560
|
+
y: y$1
|
|
1561
|
+
};
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1537
1564
|
const getOffsetAtCursor = editorUid => {
|
|
1538
1565
|
// TODO ask editor worker
|
|
1539
1566
|
return 0;
|
|
@@ -1582,21 +1609,21 @@ const executeHoverProvider = async (editorUid, editorLanguageId, offset) => {
|
|
|
1582
1609
|
};
|
|
1583
1610
|
|
|
1584
1611
|
const getHover = async (editorUid, editorLanguageId, offset) => {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1612
|
+
try {
|
|
1613
|
+
number(editorUid);
|
|
1614
|
+
number(offset);
|
|
1615
|
+
// TODO invoke extension host worker directly
|
|
1616
|
+
const hover = await executeHoverProvider(editorUid, editorLanguageId, offset);
|
|
1617
|
+
return {
|
|
1618
|
+
hover,
|
|
1619
|
+
error: undefined
|
|
1620
|
+
};
|
|
1621
|
+
} catch (error) {
|
|
1622
|
+
return {
|
|
1623
|
+
hover: undefined,
|
|
1624
|
+
error
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1600
1627
|
};
|
|
1601
1628
|
|
|
1602
1629
|
const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
@@ -1608,14 +1635,6 @@ const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
|
1608
1635
|
}
|
|
1609
1636
|
return matching;
|
|
1610
1637
|
};
|
|
1611
|
-
const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) => {
|
|
1612
|
-
const x$1 = x(editor, rowIndex, wordStart);
|
|
1613
|
-
const y$1 = editor.height - y(editor, rowIndex) + editor.y + 40;
|
|
1614
|
-
return {
|
|
1615
|
-
x: x$1,
|
|
1616
|
-
y: y$1
|
|
1617
|
-
};
|
|
1618
|
-
};
|
|
1619
1638
|
const getEditorHoverInfo = async (editorUid, editorLanguageId, hoverFullWidth, hoverPaddingLeft, hoverPaddingRight, hoverBorderLeft, hoverBorderRight, hoverDocumentationFontFamily, hoverDocumentationFontSize, hoverDocumentationLineHeight, fallbackDisplayStringLanguageId) => {
|
|
1620
1639
|
number(editorUid);
|
|
1621
1640
|
const {
|
|
@@ -1623,16 +1642,12 @@ const getEditorHoverInfo = async (editorUid, editorLanguageId, hoverFullWidth, h
|
|
|
1623
1642
|
columnIndex
|
|
1624
1643
|
} = await getPositionAtCursor(editorUid);
|
|
1625
1644
|
const offset = getOffsetAtCursor();
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
}
|
|
1630
|
-
const {
|
|
1631
|
-
documentation} = hover;
|
|
1632
|
-
const lineInfos = await tokenizeCodeBlock();
|
|
1645
|
+
|
|
1646
|
+
// @ts-ignore
|
|
1647
|
+
const diagnostics = await invoke$1('Editor.getDiagnostics', editorUid);
|
|
1633
1648
|
const wordPart = await getWordBefore(editorUid, rowIndex, columnIndex);
|
|
1634
1649
|
const wordStart = columnIndex - wordPart.length;
|
|
1635
|
-
|
|
1650
|
+
|
|
1636
1651
|
// TODO
|
|
1637
1652
|
const editor = {};
|
|
1638
1653
|
const {
|
|
@@ -1640,8 +1655,24 @@ const getEditorHoverInfo = async (editorUid, editorLanguageId, hoverFullWidth, h
|
|
|
1640
1655
|
y
|
|
1641
1656
|
} = getHoverPositionXy(editor, rowIndex, wordStart);
|
|
1642
1657
|
// @ts-ignore
|
|
1643
|
-
const diagnostics = editor.diagnostics || [];
|
|
1644
1658
|
const matchingDiagnostics = getMatchingDiagnostics(diagnostics, rowIndex);
|
|
1659
|
+
const {
|
|
1660
|
+
hover,
|
|
1661
|
+
error
|
|
1662
|
+
} = await getHover(editorUid, editorLanguageId, offset);
|
|
1663
|
+
if (!hover) {
|
|
1664
|
+
return {
|
|
1665
|
+
lineInfos: [],
|
|
1666
|
+
documentation: '',
|
|
1667
|
+
x,
|
|
1668
|
+
y,
|
|
1669
|
+
matchingDiagnostics
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
const {
|
|
1673
|
+
documentation,
|
|
1674
|
+
lineInfos
|
|
1675
|
+
} = await getHoverDetails(hover, error);
|
|
1645
1676
|
return {
|
|
1646
1677
|
lineInfos,
|
|
1647
1678
|
documentation,
|
|
@@ -1675,13 +1706,13 @@ const loadContent = async state => {
|
|
|
1675
1706
|
} = info;
|
|
1676
1707
|
return {
|
|
1677
1708
|
...state,
|
|
1678
|
-
leadingWord: wordAtOffset,
|
|
1679
|
-
x,
|
|
1680
|
-
y,
|
|
1681
1709
|
documentation,
|
|
1710
|
+
leadingWord: wordAtOffset,
|
|
1682
1711
|
lineInfos,
|
|
1683
1712
|
matchingDiagnostics,
|
|
1684
|
-
width: 300
|
|
1713
|
+
width: 300,
|
|
1714
|
+
x,
|
|
1715
|
+
y
|
|
1685
1716
|
};
|
|
1686
1717
|
};
|
|
1687
1718
|
|
|
@@ -1884,10 +1915,6 @@ const render2 = (uid, diffResult) => {
|
|
|
1884
1915
|
return commands;
|
|
1885
1916
|
};
|
|
1886
1917
|
|
|
1887
|
-
const terminate = () => {
|
|
1888
|
-
globalThis.close();
|
|
1889
|
-
};
|
|
1890
|
-
|
|
1891
1918
|
const commandMap = {
|
|
1892
1919
|
'Hover.close': wrapCommand(close),
|
|
1893
1920
|
'Hover.create': create,
|