Skip to content

Commit 4990891

Browse files
committed
keyboard shortcut for markdown comment
SQUASHED: AUTO-COMMIT-src-components-widgets-ast-capabilities.js,AUTO-COMMIT-src-components-widgets-lively-code-mirror.js,Merge-branch-gh-pages-of-https-github.com-LivelyKernel-lively4-core-into-gh-pages,updated-tip-of-the-day,
1 parent 15fda14 commit 4990891

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/components/widgets/ast-capabilities.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,20 @@ export default class ASTCapabilities {
397397
this.scrollTo(scrollInfo);
398398
}
399399

400+
insertMarkdownComment() {
401+
const { livelyCodeMirror: lcm, codeMirror: cm } = this.codeProvider;
402+
403+
const before = '/*MD ## ';
404+
const around = 'your text';
405+
const after = ' MD*/';
406+
const l4url = 'lively4url';
407+
const l4urlplus = l4url + ' + ';
408+
409+
const selections = cm.getSelections();
410+
cm.replaceSelections(selections.fill(before));
411+
cm.replaceSelections(selections.fill(after), "start");
412+
cm.replaceSelections(selections.fill(around), "around");
413+
}
400414
braveNewWorld() {
401415
const { livelyCodeMirror: lcm, codeMirror: cm } = this.codeProvider;
402416

src/components/widgets/lively-code-mirror.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ export default class LivelyCodeMirror extends HTMLElement {
372372
"Ctrl-Alt-G Ctrl-Alt-I": cm => this.astCapabilities(cm).then(ac => ac.generateIf('then')),
373373
"Shift-Alt-G Alt-I": cm => this.astCapabilities(cm).then(ac => ac.generateIf('else')),
374374

375+
// #KeyboardShortcut Alt-/ insert markdown comment
376+
"Alt-/": cm => this.astCapabilities(cm).then(ac => ac.insertMarkdownComment('condition')),
377+
375378
// #KeyboardShortcut Alt-M ast refactoring/autocomplete menu
376379
"Alt-M": cm => {
377380
if(this.isJavaScript){

src/components/widgets/lively-code-tip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class CodeTip extends Morph {
2424
}
2525

2626
this.tips = [
27-
"With 'Alt-Enter' you can access a powerful refactoring menu.",
27+
"With 'Alt-M' you can access a powerful refactoring menu.",
2828
"Press 'Next Tip' to get more advice!",
2929
"You can get a global context menu by clicking on the background or anywhere there is not a local context menu.",
3030
"Make your code simpler to understand with the extract method feature 'Alt+M'.",

0 commit comments

Comments
 (0)