azawawi / farabi6 Goto Github PK
View Code? Open in Web Editor NEWExperimental in-browser Perl 6 Editor
License: Artistic License 2.0
Experimental in-browser Perl 6 Editor
License: Artistic License 2.0
This has already been implemented in Farabi (Perl 5). So the feature will be imported and enhancements
git pull
remote: Counting objects: 36, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 30 (delta 19), reused 23 (delta 12)
Unpacking objects: 100% (30/30), done.
From https://github.com/azawawi/farabi6
b049256..bcc3637 master -> origin/master
Updating b049256..bcc3637
Fast-forward
lib/Farabi6/files/farabi.js | 2 +-
lib/Farabi6/files/index.html | 17 +++++++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
Make a beautiful website that reflects what is Farabi6 ๐
http://azawawi.github.io/farabi6
Borrow ideas from... We need it to be catchy a bit ๐
http://semantic-ui.com/
Create a new directory structure with the META.json for a sample p6 module.
It would be cool to open a file. If the farabi6 has not been started on that port, send the file to be opened by that farabi6 instance. If not, start the farabi6 server and open that file ๐
The file can also be a directory so basically copy what vim does and do it in style ๐
perl6 --profile # with MoarVM
azawawi@azawawi-vm:~/farabi6$ perl6 --profile test_file_find.pl
Hello world
Wrote profiler output to profile-1412949521.65102.html
Display module information when the module item is clicked (i.e. not the link) in an infobox below the results.
When we have page state, an interesting idea is to give the programmer the ability to put code/text blocks in different orientations.
Add an option to install via Panda if it is not currently installed...
See
http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/
You need to panda install Debugger::UI::CommandLine
The command is:
perl6-debug-m your-script.pl
perl6-debug-m
lives in the same perl6 folder ~/rakudo/install/bin
?
for help<enter>
for single stepso
for step outbt
for backtrace and current file informationI hope this helps
regards
bowtie
panda install Farabi6
==> Fetching Farabi6
==> Building Farabi6
Mu()
resolve stage failed for Farabi6: Malformed UTF-8 string
in block at /home/kevin/rakudo/rakudo-star-2012.12/install/lib/parrot/4.10.0/languages/perl6/lib/Panda.pm:86
in method get at src/gen/CORE.setting:7599
in code at src/gen/CORE.setting:7620
in sub coro at src/gen/CORE.setting:5633
in method reify at src/gen/CORE.setting:5615
in method reify at src/gen/CORE.setting:5397
in method reify at src/gen/CORE.setting:5397
in method reify at src/gen/CORE.setting:5487
in method reify at src/gen/CORE.setting:5397
in method reify at src/gen/CORE.setting:5397
in method gimme at src/gen/CORE.setting:5775
in method eager at src/gen/CORE.setting:5754
in method eager at src/gen/CORE.setting:1189
in sub eager at src/gen/CORE.setting:6052
in method build-order at /home/kevin/rakudo/rakudo-star-2012.12/install/lib/parrot/4.10.0/languages/perl6/lib/Panda/Builder.pm:21
in method build at /home/kevin/rakudo/rakudo-star-2012.12/install/lib/parrot/4.10.0/languages/perl6/lib/Panda/Builder.pm:51
in method build-helper at /home/kevin/rakudo/rakudo-star-2012.12/install/lib/parrot/4.10.0/languages/perl6/lib/Pies.pm:50
in method resolve-helper at /home/kevin/rakudo/rakudo-star-2012.12/install/lib/parrot/4.10.0/languages/perl6/lib/Pies.pm:85
in method resolve at /home/kevin/rakudo/rakudo-star-2012.12/install/lib/parrot/4.10.0/languages/perl6/lib/Pies.pm:98
in any call_with_capture at src/gen/Metamodel.pm:2794
in block at src/gen/CORE.setting:541
in method resolve at /home/kevin/rakudo/rakudo-star-2012.12/install/lib/parrot/4.10.0/languages/perl6/lib/Panda.pm:84
in block at /home/kevin/rakudo/rakudo-star-2012.12/install/bin/panda:119
in method reify at src/gen/CORE.setting:5495
in method reify at src/gen/CORE.setting:5397
in method reify at src/gen/CORE.setting:5397
in method gimme at src/gen/CORE.setting:5775
in method eager at src/gen/CORE.setting:5754
in method eager at src/gen/CORE.setting:1189
in sub eager at src/gen/CORE.setting:6052
in sub MAIN at /home/kevin/rakudo/rakudo-star-2012.12/install/bin/panda:116
in block at /home/kevin/rakudo/rakudo-star-2012.12/install/bin/panda:112
At the time of this writing, all of CodeMirror 4.6 JavaScript editing component is included in Farabi6. And farabi6 is not utilizing/need all the modes or functionality of that package. It would be cool to do the following in a Perl 6 build script:
index.html
, test.html
and test.js
$FARABI_GIT_FOLDER/lib/Farabi6/files/assets/3rd-party/codemirror-v4.6
Multiple editor should be visible
CodeMirror 4.7 has just been released.
Of the interesting things is the simple mode add-on that allows you to define with ease new syntax highlighting modes.
Simple Mode Demo
http://codemirror.net/demo/simplemode.html
CodeMirror 4.7 Release Announcement
https://groups.google.com/forum/#!topic/codemirror/Ry_Mx8BGcQU
farabi6
should open its UI in the browser when called from the command line. If chromium is installed use --app mode? Most likely write something similar Browser::Open https://metacpan.org/source/CFRANKS/Browser-Open-0.04/lib/Browser/Open.pm
especially error messages have these. and especially if you're a beginner, you may end up seeing many error messages :)
this is interesting for the repl and execution in general:
if you have long-running code or even an infinitely looping piece of code, the web server farabi6 uses mustn't hang waiting for stuff to finish. Also,the user should be able to kill a run-away process from the web interface as well.
On MoarVM, Proc::Async would be a good choice to connect to a repl (not only because of killability) and distributing updates (status, output, ...) via EventSource would be a pretty neat thing to do
Currently we have a broken old implementation of inline syntax checking widgets that was prototyped in Farabi (Perl 5). The main problem with that is:
Example of the current broken behavior is found in:
http://codemirror.net/demo/widget.html
The new proposed lint implementation is found in:
http://codemirror.net/doc/manual.html#addon_lint
Farabi6 must start to load the correct CodeMirror editor mode for the opened file.. This should include the following:
It would be cool to have the following scenario:
farabi6 <filename><colon ":"><line-number>
# e.g.
farabi6 lib/Farabi6.pm6:115
This code will open Farabi6.pm6 and then go to the line #115
The github-style directory browser user interface should allow user-mounted directories to be viewed. Later an indexer process will index those user-mounted directories to make searching faster.
See https://github.com/perl6/nqp/blob/master/src/HLL/Compiler.nqp#L54
use v6;
use IO::Capture::Simple;
my $save_ctx;
my $comp = nqp::getcomp('perl6');
while 1
{
my $code = prompt("> ");
my ($out, $result);
try
{
capture_stdout_on($out);
$result = $comp.eval($code, :outer_ctx($save_ctx));
capture_stdout_off;
CATCH
{
default
{
capture_stdout_off;
say "Error: $_";
say $_.backtrace.Str;
}
}
}
say("result => " ~ $result) if defined $result;
say("stdout => " ~ $out) if defined $out;
}
# vim: ft=perl6
Need to hack htmlify.pl to generate json as moritz said
HTMLify sourcecode
https://github.com/perl6/doc/blob/master/htmlify.p6
CPU usage is 100% while waiting for a connection even before any HTTP connection...
Please see:
http://irclog.perlgeek.de/perl6/2014-10-20#i_9537662
From http://irclog.perlgeek.de/perl6/2014-10-15#i_9511445
so basically to achieve better syntax checking in farabi6, STD.pm viv should be used if possible otherwise fallback back to $*EXECUTABLE
can you enable the directory browser on file input please
also info only
perl6 -> rakudo is in path as perl6
p6 -> Niecza via a sh in ~/bin
I thought this would be helpful.
ps p6 is very pretty output
panda --list
provides a list of installed/dependency modules in the current installation
Similar to Perl 6 REPL right sidebar, one can implement a module search that enables searching as follows:
I dont know why but it can be a fun idea for all the world shamans ๐
Let us heal thy wounds with our Perl 6
pod after END
===SORRY!=== CHECK FAILED: Undefined routine '&END' called (line 7)
just an observation, for you
First culprit
https://github.com/supernovus/perl6-http-easy/blob/master/lib/HTTP/Easy.pm6#L71
[2014-10-12T06:15:03Z] GET /assets/mode-perl6.js HTTP/1.1
use of uninitialized value of type Any in numeric context in method run at lib/HTTP/Easy.pm6:71
No such method 'decode' for invocant of type 'Any'
in method run at lib/HTTP/Easy.pm6:74
in method run at ./lib/Farabi6.pm6:111
in sub MAIN at bin/farabi6:16
in block <unit> at bin/farabi6:16
The "profile" menu option under "build" submenu has been added and needs a download profile file option. Later we can think of a way of parsing the file or better getting a JSON file out of the perl6 --profile
command
We need to test Farabi6 HTTP methods especially in Farabi6.pm, Editor.pm6 and et al.
This is implemented but we need a more generic approach like naming the new editing buffer before or waiting until saved.
We should adopt Eclipse IDE style of syntax checking on buffer/file save since syntax checking is an expensive operation at the moment.
A storyboard is a timeline of files and misc output/images that is added.
New File should be changed to "Add..."
Open file should be changed to "Add Existing..."
This has been discussed in http://irclog.perlgeek.de/perl6/2014-10-13#i_9503397
Basically created a feature to add snippets if the module has been installed
By default we pull from the module's github repository:
example/snippets/task1.pl
example/snippets/task2.pl
example/snippets/task3.pl
21:52 azawawi take a look at http://pbrd.co/1w2zEvz plz
21:53 bbkr azawawi: nice thinking!
21:53 azawawi when the user clicks on the module on the right, we insert the snippets for the module selected
21:54 bbkr unfortunately SYNOPSIS is not easily exportable and is in various places (Readme.md, library POD) across different modules
21:54 azawawi now how can farabi6 determine that... i guess snippet.pl in root directory or something
21:54 azawawi and SYNOPSIS requires more parsing
21:54 azawawi which is prone to error
21:55 azawawi think of about, why did i panda install Module::XYZ....
21:55 azawawi 1. to use...
21:55 azawawi it :)
21:56 azawawi i will add an initial feature to pull the snippet.pl from the root directory or eg/snippet.pl
21:57 azawawi if it is there, that snippet is directly inserted into the farabi6 storyboard
21:58 azawawi why is javascript so popular?... the number of steps/tools to create a working example is minimal
21:58 pmurias it's so popular because it's in the browser
21:59 bbkr does p5 specify example/snippets directory name?
21:59 azawawi nope
21:59 tadzik azawawi: oh, I see. That's cool :)
22:00 azawawi bbkr: example/snippets/task1.pl example/snippets/task2.pl example/snippets/task3.pl # interesting
22:01 azawawi pmurias: true but the number of tools needed to make something work is a A) browser already there and B) an editor... easily obtained
22:04 bbkr azawawi: thought so :( and i don't think p6 does that either. directories like lib/ or t/ are just customary. I think the best bet is to look for common names such as example/ or snippets/ and offer to paste content from files there. however small number of p6 modules has those
I'm on the latest rakudo build using moarvm (built 5 minutes ago) installed with panda (also fresh)
the server starts fine, I get the editor to load almost.... then this
[2014-08-25T04:21:45Z] GET /farabi.css HTTP/1.1
[2014-08-25T04:21:46Z] GET /assets/codemirror/util/match-highlighter.js HTTP/1.1
[2014-08-25T04:21:46Z] GET /assets/codemirror/util/search.js HTTP/1.1
[2014-08-25T04:21:47Z] GET /assets/bootstrap/img/glyphicons-halflings.png HTTP/1.1
Malformed UTF-8
in method slurp at src/gen/m-CORE.setting:14419
in sub at lib/Farabi6.pm6:88
in method handler at lib/HTTP/Easy/PSGI.pm6:33
in method run at lib/HTTP/Easy.pm6:155
in method run at lib/Farabi6.pm6:107
in sub MAIN at /home/ezra/rakudo/install/languages/perl6/site/bin/farabi6:16
in block at /home/ezra/rakudo/install/languages/perl6/site/bin/farabi6:16
Hi Ahmad,
I thought I would add info here, for you :)
when I start running ~/GitHub/farabi6$ bin/farabi6
Farabi6 is going to serve files insecurely from lib/Farabi6/files :)
Farabi6 listens carefully at http://:3030
14:29 HTTP::Server::Simple::PSGI() started at :3030
14:29 GET / HTTP/1.1
14:29 GET /jquery-1.8.2.min.js HTTP/1.1
14:29 GET /assets/bootstrap/css/bootstrap.min.css HTTP/1.1
14:29 GET /assets/bootstrap/js/bootstrap.min.js HTTP/1.1
14:29 GET /assets/codemirror/util/dialog.css HTTP/1.1
14:29 GET /assets/codemirror/codemirror.js HTTP/1.1
14:29 GET /assets/codemirror/util/loadmode.js HTTP/1.1
14:29 GET /assets/codemirror/codemirror.css HTTP/1.1
14:29 GET /assets/codemirror/util/match-highlighter.js HTTP/1.1
14:29 GET /assets/codemirror/util/search.js HTTP/1.1
14:29 GET /assets/codemirror/util/dialog.js HTTP/1.1
14:29 GET /farabi.css HTTP/1.1
14:29 GET /assets/codemirror/util/searchcursor.js HTTP/1.1
14:30
Type check failed in assignment to '$uri'; expected 'Str' but got 'Nil'
in sub at ./lib/Farabi6.pm6:40
in method handler at lib/HTTP/Server/Simple/PSGI.pm6:58
in method net_server at lib/HTTP/Server/Simple.pm6:64
in method run at lib/HTTP/Server/Simple.pm6:34
in method run at ./lib/Farabi6.pm6:99
in sub MAIN at bin/farabi6:9
in block at bin/farabi6:1
runs then exits, cmd log above,
ps I like the new menu/info bar :)
Basically the algorithm to locate the location of the farabi.js is not working properly on a machine with a prefix ~/perl6/install on Mac OS X
A git cloned farabi6 will work while a panda installed farabi6 will not.
Please see:
http://irclog.perlgeek.de/perl6/2014-10-20#i_9537457
Another insight into the problem is:
http://irclog.perlgeek.de/perl6/2014-10-30#i_9587309
I think we need to investigate installing rakudo into ~/languages/...
Please see this as a starting point. Read the comments at the end.
https://github.com/sergot/p6-rosettacode-test/blob/master/test.p6
Initial proof of concept is found here
https://github.com/azawawi/farabi6/blob/master/test_rosettacode.pl
URLs of interest:
Currently CodeMirror, the JavaScript-based editing component in farabi6 does have any CodeMirror-maintained Perl 6 syntax highlighting mode. The mode that is currently maintained is based on the Perl mode and has a lot of problems. We need to fix it ASAP to make Perl 6 code look great on our platform. Once we have a good implementation, we should merge it with CodeMirror.
Perl 6 mode
https://github.com/azawawi/farabi6/blob/master/lib/Farabi6/files/assets/mode-perl6.js
Original Perl mode
https://github.com/codemirror/CodeMirror/blob/master/mode/perl/perl.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.