allison-casey / HyREPL

NREPL for Hy
MIT License
114 stars 15 forks source link

Lighttable support #14

Open Foxboron opened 9 years ago

Foxboron commented 9 years ago

It just stops responding after the initial workaround. Not sure why.

Foxboron commented 9 years ago
d4:data214:{:line-ending "\n", :name "core.clj", :type-name "Clojure", :path "/home/fox/Github/repltest/src/repltest/core.clj", :mime "text/x-clojure", :tags [:editor.clj :editor.clojure], :print-length 1000, :code "(+ 2 2)"}2:idi106e2:op15:editor.eval.clj7:session36:b8fc45a3-3b14-4882-a87a-b8e7f6757348e
d4:data101:{:results ({:meta {:line 1, :column 1, :end-line 1, :end-column 7}, :result "4"}), :ns repltest.core}2:idi106e2:op22:editor.eval.clj.result7:session36:b8fc45a3-3b14-4882-a87a-b8e7f6757348e
d2:idi106e7:session36:b8fc45a3-3b14-4882-a87a-b8e7f67573486:statusl4:doneee

Bencode interception

Foxboron commented 9 years ago

I should note that shit suddenly works.

in: {'op': 'clone'}
out: {'status': ['done'], 'session': 'c7a1691f-4e0a-4caf-a112-6c1d06bdb2c5', 'new-session': '22e958d3-6672-4a5b-883c-ecf187a34515', 'id': None}
in: {'op': 'client.init', 'data': '{:settings {:name "localhost:1337", :remote true, :client-id 115}}', 'session': '22e958d3-6672-4a5b-883c-ecf187a34515', 'id': 115}
out: {'data': '{:remote true, :client-id 115, :name "localhost:1337", :dir "/home/fox/github/hyrepl", :type "lein-light-nrepl", :commands [:editor.eval.clj :editor.clj.doc :editor.cljs.doc :editor.clj.hints :editor.cljs.hints :docs.clj.search :docs.cljs.search :editor.eval.clj.sonar :editor.eval.clj.cancel :editor.eval.cljs :cljs.compile]}', 'status': ['done'], 'op': 'client.settings', 'session': 'c7a1691f-4e0a-4caf-a112-6c1d06bdb2c5', 'encoding': 'edn', 'id': 115}
in: {'op': 'editor.eval.clj', 'data': '{:mime "text/x-clojure", :tags [:editor.clj :editor.clojure], :type-name "Clojure", :line-ending "\\n", :ns repltest.core, :path "/home/fox/Github/repltest/src/repltest/core.clj", :print-length 1000, :name "core.clj", :code "(+ 2 2)"}', 'session': '22e958d3-6672-4a5b-883c-ecf187a34515', 'id': 106}
Unknown op editor.eval.clj called
out: {'status': ['done'], 'session': 'c7a1691f-4e0a-4caf-a112-6c1d06bdb2c5', 'id': 106}

Just have to make a new eval class that is able to return the same structure as lighttable expects

Foxboron commented 9 years ago

CLOOOSSSEEERRR

in: {'session': 'fc231371-77a6-48ae-b5b3-7d1b9468e288', 'data': '{:line-ending "\\n", :name "core.clj", :type-name "Clojure", :path "/home/fox/Github/repltest/src/repltest/core.clj", :mime "text/x-clojure", :tags [:editor.clj :editor.clojure], :print-length 1000, :code "(+ 2 2)\\n\\n(- 2 2)"}', 'op': 'editor.eval.clj', 'id': 77}
out: {'session': '9593a480-4182-4938-b729-7dea26587de4', 'results': ({'result': '4', 'meta': {'line': 1, 'column': 1, 'end-line': 1, 'end-column': 7}} {'result': '0', 'meta': {'line': 3, 'column': 1, 'end-line': 3, 'end-column': 7}}), 'op': 'editor.eval.clj', 'id': 77, 'ns': 'Hy'}
out: {'session': '9593a480-4182-4938-b729-7dea26587de4', 'status': ['done'], 'id': 77}
Foxboron commented 9 years ago

Evaling valid code works with https://github.com/Foxboron/HyREPL/commit/b3cd640b49ad8da5c280354ce87571cc01d8f54c

EDIT: Current approach to implement this is to use lighttable, open a lein repl, sudo tcpflow -i any -C -J port <port> and get the bencode information you need to implement the feature.

Annoying to work with, but it works!

farhaven commented 9 years ago

:+1: Awesome work :smile:

Foxboron commented 9 years ago

And tracebacks implemented. Completions are another story