-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQUASHED: AUTO-COMMIT-demos-javascript-a.js,AUTO-COMMIT-src-components-widgets-lively-code-mirror-context-menu.js,AUTO-COMMIT-src-components-widgets-lively-code-mirror-context-menu.js.l4a,AUTO-COMMIT-test.html,
- Loading branch information
1 parent
5f78155
commit 38d73ac
Showing
3 changed files
with
92 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
// a.js | ||
"disable deepeval" | ||
export const value = 44; | ||
export const value = 44; | ||
|
||
|
||
function hello2() { | ||
var a = 3 + 4 | ||
} | ||
|
||
hello2() | ||
|
||
|
||
|
||
class Foo { | ||
|
||
|
||
hello2() { | ||
var a = 3 + 4 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"type":"Reference","version":"96c12edb6cf8db2fa65783aac87327d17261d16c","content":"import ContextMenu from 'src/client/contextmenu.js';\n\nexport default async function openMenu(astCapabilities, codeMirror, livelyCodeMirror) {\n\n function fa(name, ...modifiers) {\n return `<i class=\"fa fa-${name} ${modifiers.map(m => 'fa-' + m).join(' ')}\"></i>`;\n }\n \n /*MD ### Generate Submenus MD*/\n\n async function generateGenerationSubmenu() {\n\n // for now, classes can be generated everywhere\n // if this isn't wanted anymore, scope checks can be done as can be seen below\n let submenu = [['Class', () => {\n menu.remove();\n astCapabilities.generateClass();\n }, '→', fa('suitcase')]];\n\n const selectedPath = astCapabilities.getInnermostPathContainingSelection(astCapabilities.programPath, astCapabilities.firstSelection);\n \n //add testcase if in describe\n if (astCapabilities.isInDescribe(selectedPath)) {\n submenu.unshift(['Testcase', () => {\n menu.remove();\n astCapabilities.generateTestCase();\n }, '→', fa('suitcase')]);\n }\n \n //add getter / setter if directly in ClassBody or ObjectExpression\n if (astCapabilities.isDirectlyIn([\"ClassBody\", \"ObjectExpression\"], selectedPath)) {\n submenu.push(['Getter', () => {\n menu.remove();\n astCapabilities.generateGetter();\n }, '→', fa('suitcase')], ['Setter', () => {\n menu.remove();\n astCapabilities.generateSetter();\n }, '→', fa('suitcase')]);\n }\n\n return submenu;\n }\n\n async function generateImportSubmenu() {\n let { identName, functions, classes } = await astCapabilities.findImports();\n let submenu = [];\n if (!identName || functions.length == 0 && classes.length == 0) {\n submenu.push(['none', () => {\n menu.remove();\n }, '', '']);\n } else {\n functions.forEach(url => submenu.push([url.replace(lively4url, ''), () => {\n menu.remove();\n astCapabilities.addImport(url, identName, true);\n }, '-', fa('share-square-o')]));\n classes.forEach(cl => submenu.push([cl.name + \", \" + cl.url.replace(lively4url, ''), () => {\n menu.remove();\n astCapabilities.addImport(cl.url, cl.name, false);\n }, '-', fa('share-square-o')]));\n }\n return submenu;\n }\n\n /*MD ### Generate Factoring Menu MD*/\n\n const menuItems = [['selection to local variable', () => {\n menu.remove();\n astCapabilities.extractExpressionIntoLocalVariable();\n }, '→', fa('share-square-o', 'flip-horizontal')], ['inline variable', () => {\n menu.remove();\n astCapabilities.inlineLocalVariable();\n }, '→', fa('external-link', 'flip-vertical')], ['wrap into active expression', () => {\n menu.remove();\n astCapabilities.wrapExpressionIntoActiveExpression();\n }, '→', fa('suitcase')], ['Rename', () => {\n menu.remove();\n astCapabilities.rename();\n }, '→', fa('suitcase')], ['Swap then and else of conditional', () => {\n menu.remove();\n astCapabilities.rename();\n }, 'swap', fa('suitcase')], ['Extract Method', () => {\n menu.remove();\n astCapabilities.swapConditional()\n }, 'Alt+M', fa('suitcase'), {\n onSelect: () => {\n const selection = astCapabilities.selectMethodExtraction(astCapabilities.programPath, true);\n if (selection) {\n openMenu.changedSelectionInMenu = true;\n astCapabilities.selectPaths(selection.selectedPaths);\n } else {\n openMenu.changedSelectionInMenu = false;\n }\n },\n onDeselect: () => {\n if (openMenu.changedSelectionInMenu) {\n codeMirror.undoSelection();\n }\n }}], ['Generate HTML Accessors', () => {\n menu.remove();\n astCapabilities.generateHTMLAccessors();\n }, 'Alt+H', fa('suitcase')],\n ['Print References', () => {\n astCapabilities.printAllBindings();\n menu.remove();\n }, 'Alt+I', fa('suitcase')],\n [\n 'lively', [['lively.notify', () => {\n menu.remove();\n astCapabilities.livelyNotify();\n }, '+', fa('plus')],\n ['lively4url', () => {\n menu.remove();\n astCapabilities.lively4url();\n }, '+', fa('plus')],\n ]],\n ['Generate', generateGenerationSubmenu()], ['Import', generateImportSubmenu()]];\n var menuPosition = codeMirror.cursorCoords(false, \"window\");\n\n const menu = await ContextMenu.openIn(document.body, { clientX: menuPosition.left, clientY: menuPosition.bottom }, undefined, document.body, menuItems);\n menu.addEventListener(\"DOMNodeRemoved\", () => {\n livelyCodeMirror.focus();\n });\n}\n"} | ||
{"type":"Reference","version":"31c8137e1c3b60538c7788c7ec5a23760d40b0c7","content":"import ContextMenu from 'src/client/contextmenu.js';\n\nexport default async function openMenu(astCapabilities, codeMirror, livelyCodeMirror) {\n\n function fa(name, ...modifiers) {\n return `<i class=\"fa fa-${name} ${modifiers.map(m => 'fa-' + m).join(' ')}\"></i>`;\n }\n\n /*MD ### Generate Submenus MD*/\n\n async function generateGenerationSubmenu() {\n\n // for now, classes can be generated everywhere\n // if this isn't wanted anymore, scope checks can be done as can be seen below\n let submenu = [\n ['Class', () => {\n menu.remove();\n astCapabilities.generateClass();\n }, '→', fa('suitcase')]\n ];\n\n const selectedPath = astCapabilities.getInnermostPathContainingSelection(astCapabilities.programPath,\n astCapabilities.firstSelection);\n\n //add testcase if in describe\n if (astCapabilities.isInDescribe(selectedPath)) {\n submenu.unshift(['Testcase', () => {\n menu.remove();\n astCapabilities.generateTestCase();\n }, '→', fa('suitcase')]);\n }\n\n //add getter / setter if directly in ClassBody or ObjectExpression\n if (astCapabilities.isDirectlyIn([\"ClassBody\", \"ObjectExpression\"], selectedPath)) {\n submenu.push(['Getter', () => {\n menu.remove();\n astCapabilities.generateGetter();\n }, '→', fa('suitcase')], ['Setter', () => {\n menu.remove();\n astCapabilities.generateSetter();\n }, '→', fa('suitcase')]);\n }\n\n return submenu;\n }\n\n async function generateImportSubmenu() {\n let { identName, functions, classes } = await astCapabilities.findImports();\n let submenu = [];\n if (!identName || functions.length == 0 && classes.length == 0) {\n submenu.push(['none', () => {\n menu.remove();\n }, '', '']);\n } else {\n functions.forEach(url => submenu.push([url.replace(lively4url, ''), () => {\n menu.remove();\n astCapabilities.addImport(url, identName, true);\n }, '-', fa('share-square-o')]));\n classes.forEach(cl => submenu.push([cl.name + \", \" + cl.url.replace(lively4url, ''), () => {\n menu.remove();\n astCapabilities.addImport(cl.url, cl.name, false);\n }, '-', fa('share-square-o')]));\n }\n return submenu;\n }\n\n /*MD ### Generate Factoring Menu MD*/\n\n const menuItems = [\n ['selection to local variable', () => {\n menu.remove();\n astCapabilities.extractExpressionIntoLocalVariable();\n }, '→', fa('share-square-o', 'flip-horizontal')],\n ['inline variable', () => {\n menu.remove();\n astCapabilities.inlineLocalVariable();\n }, '→', fa('external-link', 'flip-vertical')],\n ['wrap into active expression', () => {\n menu.remove();\n astCapabilities.wrapExpressionIntoActiveExpression();\n }, '→', fa('suitcase')],\n ['Rename', () => {\n menu.remove();\n astCapabilities.rename();\n }, '→', fa('suitcase')],\n ['Swap then and else of conditional', () => {\n menu.remove();\n astCapabilities.swapConditional();\n }, 'swap', fa('suitcase')],\n ['Extract Method', () => {\n menu.remove();\n astCapabilities.extractMethod()\n }, 'Alt+M', fa('suitcase'), {\n onSelect: () => {\n debugger\n const selection = astCapabilities.selectMethodExtraction(astCapabilities.programPath, true);\n if (selection) {\n openMenu.changedSelectionInMenu = true;\n astCapabilities.selectPaths(selection.selectedPaths);\n } else {\n openMenu.changedSelectionInMenu = false;\n }\n },\n onDeselect: () => {\n debugger\n if (openMenu.changedSelectionInMenu) {\n codeMirror.undoSelection();\n }\n }\n }],\n ['Generate HTML Accessors', () => {\n menu.remove();\n astCapabilities.generateHTMLAccessors();\n }, 'Alt+H', fa('suitcase')],\n ['Print References', () => {\n astCapabilities.printAllBindings();\n menu.remove();\n }, 'Alt+I', fa('suitcase')],\n [\n 'lively', [\n ['lively.notify', () => {\n menu.remove();\n astCapabilities.livelyNotify();\n }, '+', fa('plus')],\n ['lively4url', () => {\n menu.remove();\n astCapabilities.lively4url();\n }, '+', fa('plus')],\n ]\n ],\n ['Generate', generateGenerationSubmenu()],\n ['Import', generateImportSubmenu()]\n ];\n var menuPosition = codeMirror.cursorCoords(false, \"window\");\n\n const menu = await ContextMenu.openIn(document.body, { clientX: menuPosition.left, clientY: menuPosition.bottom },\n undefined, document.body, menuItems);\n menu.addEventListener(\"DOMNodeRemoved\", () => {\n livelyCodeMirror.focus();\n });\n}\n"} |