@lvce-editor/output-view 1.10.0 → 1.12.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/outputViewWorkerMain.js +38 -26
- package/package.json +1 -1
|
@@ -1106,7 +1106,8 @@ const {
|
|
|
1106
1106
|
get: get$1,
|
|
1107
1107
|
set: set$4,
|
|
1108
1108
|
wrapCommand,
|
|
1109
|
-
wrapGetter
|
|
1109
|
+
wrapGetter,
|
|
1110
|
+
getKeys
|
|
1110
1111
|
} = create$2();
|
|
1111
1112
|
|
|
1112
1113
|
const create$1 = (id, uri, x, y, width, height, platform, parentId) => {
|
|
@@ -1136,7 +1137,8 @@ const create$1 = (id, uri, x, y, width, height, platform, parentId) => {
|
|
|
1136
1137
|
errorCode: 0,
|
|
1137
1138
|
buttons: [],
|
|
1138
1139
|
filteredItems: [],
|
|
1139
|
-
platform
|
|
1140
|
+
platform,
|
|
1141
|
+
watchId: 0
|
|
1140
1142
|
};
|
|
1141
1143
|
set$4(id, state, state);
|
|
1142
1144
|
};
|
|
@@ -1146,7 +1148,7 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
1146
1148
|
};
|
|
1147
1149
|
|
|
1148
1150
|
const isEqual$1 = (oldState, newState) => {
|
|
1149
|
-
return oldState.selectedOption === newState.selectedOption;
|
|
1151
|
+
return oldState.selectedOption === newState.selectedOption && oldState.listItems === newState.listItems;
|
|
1150
1152
|
};
|
|
1151
1153
|
|
|
1152
1154
|
const isEqual = (oldState, newState) => {
|
|
@@ -1563,9 +1565,36 @@ const handleFilterInput = async (state, value) => {
|
|
|
1563
1565
|
};
|
|
1564
1566
|
};
|
|
1565
1567
|
|
|
1568
|
+
const watchCallbacks = Object.create(null);
|
|
1569
|
+
const registerWatchCallback = (id, fn) => {
|
|
1570
|
+
watchCallbacks[id] = fn;
|
|
1571
|
+
};
|
|
1572
|
+
const executeWatchCallBack = id => {
|
|
1573
|
+
watchCallbacks[id]();
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
const handleChange = watchId => {
|
|
1577
|
+
// console.log('channel changed', watchId)
|
|
1578
|
+
const keys = getKeys();
|
|
1579
|
+
for (const key of keys) {
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
const setupChangeListener = async uri => {
|
|
1583
|
+
try {
|
|
1584
|
+
const watchId = Math.random();
|
|
1585
|
+
const rpcId = 7001;
|
|
1586
|
+
registerWatchCallback(watchId, handleChange);
|
|
1587
|
+
// @ts-ignore
|
|
1588
|
+
await FileSystemWorker.invoke(/* OutputChannel.open */'FileSystem.watchFile', watchId, /* path */uri, rpcId);
|
|
1589
|
+
} catch {
|
|
1590
|
+
// ignore
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1566
1594
|
const selectChannel = async (state, id) => {
|
|
1567
1595
|
const {
|
|
1568
|
-
options
|
|
1596
|
+
options,
|
|
1597
|
+
filterValue
|
|
1569
1598
|
} = state;
|
|
1570
1599
|
const matchingOption = options.find(option => option.id === id);
|
|
1571
1600
|
if (!matchingOption) {
|
|
@@ -1577,11 +1606,16 @@ const selectChannel = async (state, id) => {
|
|
|
1577
1606
|
error,
|
|
1578
1607
|
code
|
|
1579
1608
|
} = await loadLines(matchingOption.uri);
|
|
1609
|
+
|
|
1610
|
+
// TODO memory leak and race condition, need to dispose file watcher of previous uri
|
|
1611
|
+
await setupChangeListener(matchingOption.uri);
|
|
1612
|
+
const filteredItems = filterItems(lines, filterValue);
|
|
1580
1613
|
return {
|
|
1581
1614
|
...state,
|
|
1582
1615
|
error,
|
|
1583
1616
|
errorCode: code,
|
|
1584
1617
|
listItems: lines,
|
|
1618
|
+
filteredItems,
|
|
1585
1619
|
selectedOption: id
|
|
1586
1620
|
};
|
|
1587
1621
|
};
|
|
@@ -1707,28 +1741,6 @@ const loadOptions = async platform => {
|
|
|
1707
1741
|
}, ...extensionOptions];
|
|
1708
1742
|
};
|
|
1709
1743
|
|
|
1710
|
-
const watchCallbacks = Object.create(null);
|
|
1711
|
-
const registerWatchCallback = (id, fn) => {
|
|
1712
|
-
watchCallbacks[id] = fn;
|
|
1713
|
-
};
|
|
1714
|
-
const executeWatchCallBack = id => {
|
|
1715
|
-
watchCallbacks[id]();
|
|
1716
|
-
};
|
|
1717
|
-
|
|
1718
|
-
const setupChangeListener = async uri => {
|
|
1719
|
-
try {
|
|
1720
|
-
const watchId = Math.random();
|
|
1721
|
-
registerWatchCallback(watchId, () => {
|
|
1722
|
-
// TODO
|
|
1723
|
-
// console.log('channel changed')
|
|
1724
|
-
});
|
|
1725
|
-
// @ts-ignore
|
|
1726
|
-
await FileSystemWorker.invoke(/* OutputChannel.open */'FileSystem.watchFile', watchId, /* path */uri);
|
|
1727
|
-
} catch {
|
|
1728
|
-
// ignore
|
|
1729
|
-
}
|
|
1730
|
-
};
|
|
1731
|
-
|
|
1732
1744
|
const isString = value => {
|
|
1733
1745
|
return typeof value === 'string';
|
|
1734
1746
|
};
|