Live data from Hacker News

Xi-Editor Retrospective

raphlinus.github.io

61–70 of 162 posts

Re: Xi-Editor Retrospective

#61
post #59

Earlier quoted context omitted.

I think it had a lot of goals that matched I'd like from my text editor: * Using native technologies * Fast * Modular and extensible * Open source

And I'm not disputing that. But one goal eclipses all others: * Usable

That is correct, hence why I never used Xi. But if it did end up usable I could imagine myself switching to it.

Re: Xi-Editor Retrospective

#62
post #22

Am I the only one on HN which thought this was a bad idea all around from the beginning? I remember that people were very enthusiastic back then because of the Rust hype and the author's pedigree, so critics were quickly silenced. For me, picking Rust and the JSON-based IPC were huge red flags and this post-mortem confirms that. But what I find odd is that many are still not willing to accept the conclusion that usin…

I wasn't there when xi-editor started, but writing a text editor in Rust and splitting the backend from the front-end still seems like a good idea. Why? You could compile Rust to Web-assembly -- getting a more performant text editor than if it was written in Javascript -- and then develop your browser or native frontend in HTML/CSS/JS.

Re: Xi-Editor Retrospective

#63
post #22

Am I the only one on HN which thought this was a bad idea all around from the beginning? I remember that people were very enthusiastic back then because of the Rust hype and the author's pedigree, so critics were quickly silenced. For me, picking Rust and the JSON-based IPC were huge red flags and this post-mortem confirms that. But what I find odd is that many are still not willing to accept the conclusion that usin…

> For me, picking Rust and the JSON-based IPC were huge red flags and this post-mortem confirms that. But what I find odd is that many are still not willing to accept the conclusion that using Rust for a UI-intensive app is a bad idea.

This postmortem says Rust was, and still is, a great fit for the problem domain for which it was used.

Where do you reach the conclusion that Rust is bad for UI-intensive apps? That claim appears to have no relation to the post-mortem as Xi didn't use Rust for the UI in the first place? Things might have been better if Rust was used for the UI if anything, as attempting to be native instead was one of the problem areas.

Re: Xi-Editor Retrospective

#64

Earlier quoted context omitted.

The thing is, that is the story of the existing big editors, and we know where that story goes.

No, where does it go? Are the big editors unsuccessful?

My first test of any text editor is to open something like 4-gigabytes log file with one gigabyte line. If editor works fast, it's good. So far very few editors pass this test, so most are not suitable for general use, only for some niche use like editing tiny text files.

Re: Xi-Editor Retrospective

#65
post #52

> And it [syntax highlighting] basically doesn’t fit nicely in the CRDT model at all, as that requires the ability to resolve arbitrarily divergent edits between the different processes (imagine that one goes offline for a bit, types a bit, then the language server comes back online and applies indentation). What's a rationale for having syntax highlighting server-side as opposed to client-side? I'm working on side p…

Your server generally has a better idea about the language than you do, presumably.

I would only think that's the case when the language of the file you're editing is unknown, so you would have to do some server-side analysis of the entire file and make an educated guess. For example, https://github.com/github/linguist. But if the language is known in advance, then you could send the grammar rules to the client.

Re: Xi-Editor Retrospective

#66
post #52

> And it [syntax highlighting] basically doesn’t fit nicely in the CRDT model at all, as that requires the ability to resolve arbitrarily divergent edits between the different processes (imagine that one goes offline for a bit, types a bit, then the language server comes back online and applies indentation). What's a rationale for having syntax highlighting server-side as opposed to client-side? I'm working on side p…

So, just syntax highlighting is not compelling to move out to a server. But part of my idea is that if you have async to hide server latency, so it's not slowing down typing, maybe you can do a much deeper analysis than just surface syntax. Right now you get basically instant coloring and then much slower but more accurate feedback that's generally comparable to an incremental recompile. I was thinking that a language server might be able to give you quick feedback on some aspects of your program before having to do all of it.

Perhaps an even better motivation is indentation. When I use editors with regex-based indentation (the norm), I'm regularly annoyed when it gets it wrong. Being able to budget a few milliseconds or tends of milliseconds to do indentation that exactly matches what rustfmt or gofmt would recommend would be worth it, imho.

Re: Xi-Editor Retrospective

#67

> There is no such thing as native GUI I understand why you were disillusioned with the performance of native GUIs. But in other areas, such as accessibility, nativeness absolutely does help. I'm guessing you know this; I just want to make sure other developers get this message. Here is a quite comprehensive list of the benefits of a native GUI for accessibility, particularly on macOS: https://news.ycombinator.com/it…

The accessibility APIs can be programmed against by anyone. If there is a way to make something like this accessible to screen readers in some useful way, it would likely involve specific accessibility work either way.

Not sure about other platforms, but I like the way macOS/iOS uses the accessibility metadata to look up UI elements for testing. So in order to "access" a button in a test, you have to do the accessibility work.

You need it to take automated screenshots too.

Re: Xi-Editor Retrospective

#68
post #28

Tangent/clarification: the regex slowness issue is almost certainly due to using Perl-style exponential time regexes (which are required by Sublime syntax definitions) rather than "regular languages". The syntect library mentioned uses fancy-regex, which is explicitly different than Rust's default regex crate, in that it supports regex constructs that require exponential backtracking: https://github.com/fancy-regex/f…

First, syntect can use both onig (an adaptation of Ruby regex, same as Sublime) and fancy-regex. The latter is yet another xi-instigated, and was motivated by trying to do a better job at this. Second, the design of fancy-regex is precisely to delegate to the regex crate when features like lookahead aren't needed. I had high hopes for the performance, but it turned out to be lackluster, a highly tuned backtracking en…

OK thanks for the clarifications. I responded to BurntSushi and others here:

https://lobste.rs/s/fq8uil/aho_corasick

https://news.ycombinator.com/item?id=23665341

I don't have experience with captures in re2c, but it's entirely automata-based, and they apparently implement something "fast" for captures and published it in this 2017 paper, so it's pretty new:

https://arxiv.org/abs/1907.08837

I'm sort of interested in benchmarking some Sublime-ish workloads with it, but I'm not sure I'll have time.

----

And the other claim from that comment is that while regular languages aren't powerful enough by themselves for syntax highlighting, you can add a trivial state machine on top of them (perhaps Vim-like), and get something more powerful and faster than Sublime's model.

I'd have to look at the captures vs. lookahead issue more closely, but the general claim is that I think Sublime has a bad parsing model based on a sloppy application of Perl-style regexes (e.g. if you are really forced to read every byte multiple times, that seems dumb, and can be avoided with regular languages)

Re: Xi-Editor Retrospective

#69
post #65

Earlier quoted context omitted.

Your server generally has a better idea about the language than you do, presumably.

I would only think that's the case when the language of the file you're editing is unknown, so you would have to do some server-side analysis of the entire file and make an educated guess. For example, https://github.com/github/linguist . But if the language is known in advance, then you could send the grammar rules to the client.

A server also means it still works when the language is not simple enough to condense into simple grammar rules :)

Re: Xi-Editor Retrospective

#70

Earlier quoted context omitted.

No, where does it go? Are the big editors unsuccessful?

My first test of any text editor is to open something like 4-gigabytes log file with one gigabyte line. If editor works fast, it's good. So far very few editors pass this test, so most are not suitable for general use, only for some niche use like editing tiny text files.

I am curious which editors pass this test, as pretty much everything I have tried chokes on long lines, even things like nano, vim, Sublime Text…
Post reply on HN