mogenslund / liquid Goto Github PK
View Code? Open in Web Editor NEWClojure Text Editor, for editing clojure code and markdown. Written entirely in Clojure with inspiration from Emacs and Vim.
License: Eclipse Public License 1.0
Clojure Text Editor, for editing clojure code and markdown. Written entirely in Clojure with inspiration from Emacs and Vim.
License: Eclipse Public License 1.0
As in #17 I was doing some editing in Liquid, this time in Terminology, and a spurious partial escape sequence was inserted into the text while I was moving the cursor.
I don't know how to recreate this this time, but it shows that it's probably not just a terminal bug.
Liquid displays the filename (with the complete absolute path) of the buffer in the lower left corner. At the right side of the filename information like row and column numbers as well as the current mode (INSERT, VISUAL, etc.) gets displayed. This is basically all fine, but if you work on a larger project which has a really (I mean really) deep directory structure and your monitor is only something like Full-HD and/or you want the liquid window displayed alongside something else, you will neither be able to see the complete filename, nor any of the other information described above anymore.
When switching buffers, it can also happen quickly that two lines will be used for one buffer entry.
All of this is not much of a show-stopper and might be a rare case, but maybe there is a way to improve the readability of really long paths/filenames? Something like only displaying the top and last directory together with the filename, so e.g. instead of
displaying
"/home/daisybytes/my/very/very/deeply/structured/terrible-project/sucks.txt"
maybe
"/home/.../terrible-project/sucks.txt"
"my/.../terrible-project/sucks.txt"
or something completely different could be displayed to shorten this down.
A very quick and dirty "solution" could also be to just switch around the information in the status line and show the file/path information on the right and the other things on the left. Then you might still run into the situation that the filename is too long, but at least the other things are still readable ๐
A relatively common thing I do is split a window to look at one part of a buffer, while editing another.
In Liquid I think the window view position is stored in the buffer, and so when I edit in either window both windows share the same view.
Would be good to have a view point for each window.
Hi,
In the cheat sheet there is "c-k" for killing the buffer. It does not work for me. So i tried to create new binding. But this freezes the app:
tested with two different configuration, one 1.1.0 on WSL Ubuntu
the second one 1.1.2 from windows powershell.
I split the window vertically then the top one horizontally, in the top right window I press C-f then C-g.
The file browser remains open and the focus moves to the bottom window.
Hi!
In view-handlers and input-handlers, processing loops are run within "futures". However, exceptions within futures are not caught anywhere and they cause silent failures. What's more, they cause the editor to quit but with a 60 second delay due to the known shutdown delay of the internal ExecutorService. If one doesn't know what's going on, this appears as if the editor has frozen.
I was thinking of adding an exception handler around the bodies within "future" calls which would do the following
(catch Exception e
(logging/log (with-out-str (stacktrace/print-cause-trace e)))
(editor/force-quit))
I'd probably wrap it in a macro (e.g. exit-on-exception).
What do you think? I can prepare a pull request, if you like.
The dk.salza.liq.modes.findfilemode should be more flexible in the following senses:
The mode should be able to take a callback function, which will operate on the found file or folder, so it can be used in a variety of situations, including:
If there are any choices in the typeahead the first one should be selected as default (At the moment of writing this, none is selected until "next-res" command executed C-k.)
The rules below for choosing a file should be implemented.
There are 4 cases:
The typed search content is the result (To create a new file although there is non empty typeahead results.)
If a folder is choosen, use C-k to navigate to that folder
Maybe related to changes for typeahead issue.
doall should force the sequence.
In my window manager, i3, the shape of the terminal changes over time, and so if I return to Liquid, it's all jumbled up. Can we just have a running autorefresh, or something similar?
The function
liq.modes.clojure-mode/goto-definition
should be improved. Right now it uses
(java.lang.ClassLoader/getSystemClassLoader)
to get a list of classpaths, which does not cover all cases.
Looking to (orchard.java.classpath/classpath)
might be an option. Maybe using orchard directly. To not conflict with the no-dependency philosophy an option could be to have a default function defined through a keyword in the state, which can be replaced with any other classlouder function.
I just tried 0.4 typed some stuff and then typed C-q to exit liquid. Afterwards I cannot use my bash anymore. No keytypes are recognized and it looks like this:
After trying some more I figured out I can type and commands will be evaluated, I just can not see what I typed.
I am using: GNU bash, Version 4.3.46(1)-release (x86_64-pc-linux-gnu) in mate.
If I "split below", then C-space, the typeahead opens in the new window, but the action is done only in the previous window, leaving the typeahead open in the new window.
The typeahead should open non-prompt buffers in whichever window the typeahead is used in.
How to replicate:
Start with something like this:
(defn hello
[]
(println "hello world!"))
Put cursor on last line, and ensure you are in normal-mode.
In rapid succession type the following characters. "d, d, i, enter".
The editor crashes.
(In Terminology, and using code not in this repository but shared by gists with @mogenslund .)
The setup is that I have both my parser mode assigned to "]", and also your simpler mode assigned to the "[" key.
I go into my mode and press "s", which takes to the next :string
, then I exit using tab. Then I hold down the down arrow. Then after about a second of scrolling through code, it goes into your mode.
I think somehow the down arrow is still (like in Kitty) polluting something, and feeding into the input... but I could be totally wrong.
It isn't clear to me how code formatting should be addressed within liquid. Is this something the use needs to add using one of the may clojure code formatting libraries and if so, is there a recommended library?
Hi there - A lot of people (like me!) have their terminal configured to use an in-between cursor rather than a block/box cursor:
In Liquid, when moving around, and when typing, there is an additional block that flashes, which is distracting.
I think it's because Liquid's own code draws a "fake" block cursor?
https://github.com/mogenslund/liquid/blob/master/src/liq/tty_output.cljc#L97
https://github.com/mogenslund/liquid/blob/master/src/liq/tty_output.cljc#L117
How about making it possible to optionally disable that?
The docstring for the function at the following link should come before the argument vector.
liquid/src/dk/salza/liq/editor.clj
Line 411 in 8d7f3a6
I ran some code using 'e', which then produced a long error message. Then I used C-space to go to the prompt buffer to look at the start of the message. But then when I press C-space to go back to the main window, the prompt is taken over by the typeahead.
Maybe I'm missing something?
Hello again. Managed to fire up your creation, already feeling the potential. Whoa.
The thing is, I use Colemak keyboard layout, so I want to redefine ALL the keys right away.
So I had to dive into the source code to see where those are defined. And those are hardcoded all over the different files.
Wouldn't it be better to extract them to edn config files?..
As shown in the attached screenshot, strings containing Japanese characters don't get displayed/colored correctly. I switched the color to yellow temporarily but the content between the quotes remains black, only a single character gets colored correctly if the caret is placed upon it.
Mogens' initial thoughts on Slack were:
mogenslund: "If I see correctly, the japanese characters occupy two columns. Since I in some cases clear the rest of the line in the terminal, to clean up the calculation gets wrong with these characters. I am pretty sure its is a view thing and that it is handled correctly in the buffer behind the view. [...] I guess handling these characters will be somewhat similar to handling the tab character.
This is a good example of why maybe you should use a parser in general!
In the following example if I press 'e' at -> it fails to evaluate the expression because of the bracket in the string.
(require '(clojure [zip :as zip]))
(->
(nth (iterate zip/next (zip/vector-zip (core/parser "(1 2 3)"))) 8)
(zip/replace "#(")
zip/root
)
Right now c p f
evaluates the current file as it is. It should be replaced by an evaluation of the code in the current buffer with input captured, just like c p p
, but with all the content as input.
To evaluate the file in raw form the keybinding c p F
should be made available.
Not sure what can be done about it, but throwing it out there.
Holding down an arrow key breaks the typeahead.
Using: Kitty on Linux, and liq.jar
I really like the idea of this product!
Thought it would be nice if I can provide the coordinates of the jar in my profile.clj so that it is available when I lein repl.
Large file: https://raw.githubusercontent.com/clojure/clojure/master/src/clj/clojure/core.clj
I'm not sure if there's an obvious way to speed this up.
In relative mode the typeahead-mode show the buffer near the cursor in the calling buffer.
It can be difficult to see the boundry. Maybe use some kind of backgroundcolor?
Also pressing tab should be disabled. It makes no sense in typeahead-mode.
Hello mogenslund )
I tried to read into your code, and it's too much to grokk at once.
I have an idea to watch how the code evolved from the start, but didn't manage to come up with an effective way to do that.
I ask your advice on this one. As well as a general advice on how to gain deeper understanding of your project's inner workings.
Thanks in advance,
larval clojurian.
I find the plain text on the website very hard to read!
Didn't manage to start using this on Windows.
Got lein installed via chocolatey.
Could you please provide a manual for leiningen users?..
You can borrow Paren-soup and make a web client:
https://github.com/oakes/paren-soup
This way it can be accessed easier and faster.
UXTerm in reverse video when entering commands flashes INSERT.
Using the goto-definition feature via gD on any symbol (in a clojure file) should take you to the definition of that symbol.
It works for some (most?) of the liquid internal parts, but not at all for other projects.
ensure-buffer-fun
in line 74 of editor.cljc
(works)highlight
in line 274 of editor.cljc
(doesn't work)ex04_api_design.clj
will not work.I did not add the sample project to the dependencies of any configuration file. I'd like this feature to work in the project I'm working on without much additional configuration.
I only have a Leiningen and clj alias in place to start liquid using either the project's profile.clj or deps.edn file.
In case I was using it the wrong way please advise ๐๐ป
Would make startup faster
Could you give some information on how you work on the editor?
Specifically, how could you run the editor and use a repl to interact with it?
in video https://drive.google.com/file/d/0B5Au3PxHCmgBM2MySHl4aUVWTEE/view
you say ijkl is for movement
however
in cheatsheet http://salza.dk/liquid/cheatsheet.html
it is written that hjkl is for movement
so which one is right?
Hi @mogenslund,
I'm reading your source code what is the reason that you use ref for editor? Why not atom or any other mutable reference type?
Thanks..
This might be as much a feature request as it is a bug, but the editor should say something along the lines of "This filepath does not exist, create it?" instead of crashing.
Right now, error messages and output show up in the smaller left-side window, and they format pretty poorly (as they expect more like a 50 column window).
Would it be possible to have a shortcut key that swaps the content of the main and eval window back and forth? That would make quick inspection of the eval window's content easier.
I think ideally, the main window wouldnt be word-wrapped into the eval windows' column width, but rather keep its main window column width formatting (makes for mental easier referencing if your code doesn't suddenly look all different due to wrapping), and truncating what is visible in the eval window.
But thanks for making liquid. Using LightTable right now, but interested in this one :-).
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.