Coder Social home page Coder Social logo

console.js's Introduction

A javascript console implementation on top of ACE editor.

Dependencies

  • ace

Optional:

  • ace theme-textmate
  • ace mode-javascript

How to build our custom hacked ACE

Clone our custom repo

git clone git://github.com/rxaviers/ace.git

Branch console_hacks

cd ace
git checkout console_hacks

Build

npm install
node Makefile.dryice.js -m

Copy the built files to /libs

cd ..
cp ace/build/src-min/ace.js console.js/libs

Example

In the HTML:

<div id="shell"></div>

In the javascript:

new Shell("shell");

console.js's People

Contributors

rxaviers avatar varung avatar

Watchers

 avatar  avatar

console.js's Issues

multiline / arrow interaction

Desire:
when in multiline, should be able to press up/down/left/right to navigate within the multiline command.
i.e., disable history up/down while inside multiline.

Add autocomplete functionality

Add autocomplete functionality.

Spec

Usage:

new Autocomplete(editor, {
    source: function(request, responseCallback) {
        var partialWord = request.term;
        ...
        responseCallback( content ); // see datamodel below
    }
});

Datamodel (following jquery UI), is an array of objects (maps), containing two required properties:

  • A label property to display in the autocomplete list ("John Doe [email protected]").
    • this will be displayed as plain-textmac
  • A value property that ends up in the input field once selected ("[email protected]");
    • if undefined, same as label

Implementation & UI

Autocomplete will use jQuery UI's menu widget. Therefore, the dropdown menu will behave and look like the one in this demo.

  • NOTE: it does NOT implement the gray-auto-complete-with-the-first-option done in Chrome.

References

Chrome console

Issues:

  • Stops autocompleting on multi-line (after first Shift+Enter);
  • Do not autocomplete with Tab on multiple options;

Autocomplete shows/(keep showing) when:

  • Writing a word: YES
  • Navigating thru an incompleted word: NO
  • Backspace: YES

Autocomplete closes when:

  • ESC key: YES
  • Navigate Left/Right: YES

Autocompletes on:

  • Tab key: YES (*NOT on multiple options)
  • Up/Down + Enter: YES
  • Paste: YES

Cloud9 http://cloud9ide.com/

Issues:

  • Tab key duplicates completion: eg. funcTab gives funcfunction, NOT expected function;
  • Down key moves down in the editor, not in the autocomplete list;

Autocomplete shows/(keep showing) when:

  • Writing a word: YES
  • Navigating thru an incompleted word: NO
  • Backspace: YES

Autocomplete closes when:

  • ESC key: YES
  • Navigate Left/Right: YES

Autocompletes on:

  • Tab key: YES (*buggy)
  • Up/Down + Enter: YES
  • Paste: NO

ACE issue ajaxorg/ace#110

Caret appears in read-only section of text

The following could be nice:

  1. dark main caret remains at command prompt
  2. lighter caret appears where user clicks. In fact, if this caret can be controlled by keyboard, and have the usual shift select capabilities, so that you can copy text using keyboard and paste back at the prompt.

This may be implementable given ACE's ability to use multiple carets?

Make libs/ace customizations external

It would be better to keep changes/customizations to ACE code (libs/ace*) separate from console repository. One suggestion is to create a fork of ACE, do the changes there. Create a build. Then, make a reference to that as an external dependency.

Undo (Ctrl-Z) lets you go back to previous prompts

You can press ctrl-Z, and shift-ctrl-Z to undo/redo, but it lets you go back to previous prompts.
Upon pressing enter (not shift-enter), we need to clear the undo stack. This way you can undo/redo while editing one-line, but not multiple.

Wonder if we should have used one ACE for output, and another for input, right below it. That solution would have:

  1. allowed the cursor to remain visible on the input prompt
  2. prevent any possible undo/redo bugs, or any other violation of the read-only nature of text already inserted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.