MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / shareCommand

Function shareCommand

src/cm/commandRegistry.js:1354–1377  ·  view source on GitHub ↗
(view)

Source from the content-addressed store, hash-verified

1352}
1353
1354function shareCommand(view) {
1355 const resolvedView = resolveView(view);
1356 if (!resolvedView) return false;
1357
1358 const { state } = resolvedView;
1359 const ranges = state.selection.ranges;
1360 const segments = [];
1361
1362 ranges.forEach((range) => {
1363 if (range.empty) {
1364 const line = state.doc.lineAt(range.head);
1365 segments.push(state.doc.sliceString(line.from, line.to));
1366 return;
1367 }
1368
1369 segments.push(state.doc.sliceString(range.from, range.to));
1370 });
1371
1372 const textToShare = segments.join("\n");
1373
1374 system.shareText(textToShare, console.log, console.error);
1375
1376 return true;
1377}
1378
1379function selectWordCommand(view) {
1380 const resolvedView = resolveView(view);

Callers

nothing calls this directly

Calls 1

resolveViewFunction · 0.85

Tested by

no test coverage detected