chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
seancorfield 2020-11-11T03:04:55.265800Z

@mauricio.szabo Maybe you should port parinfer-plus to VS Code? 😉

mauricio.szabo 2020-11-11T13:00:01.266Z

@seancorfield I'm trying really :rolling_on_the_floor_laughing:. But the API is so limited and sometimes even buggy that my first experiments got me unpredictable results :(

sparkofreason 2020-11-11T15:53:12.266200Z

Which maybe goes back to my original thought. Is there some subset of effective parinfer features that is useful and more easily implemented?

mauricio.szabo 2020-11-11T17:23:33.266400Z

parinfer-rust is simply and easily implemented to be honest. You just have to get the state before the change and the state after the change, and then change the document with what parinfer-rust returns

sparkofreason 2020-11-11T20:52:39.266700Z

That sounds workable.

mauricio.szabo 2020-11-11T21:00:30.266900Z

Yes, but the problem is that VSCode API does not have 1. A way to capture the state before and after a change 2. A way to change current text 3. The only way to change text is by a FormattingEditProvider that only allows you to capture some changes - no backspace, for example, nor delete 4. onDidChangeTextDocument fires before the change is perceived by the TextEditor, so you can't know for example what's the current cursor position. Also, after FormattingEditProvider fires, if you issue changes to the document it'll fire "didChangeTextDocument" can fire again, so you have to catch this. 5. VSCode does not provide lots of APIs to, for example, by a "changes" object patch a text into another (also, there are at least 2 "changes" object, and they are incompatible between each other) These maybe are all workable in some way, but it's incredibly fragile. For example, you could hook onDidChange and run parinfer, accumulate the result, then apply then on edit provider, but there's still the case of multiple backspaces / deletions that will not fire the edit provider (and both smart-mode and paren-mode depends a lot on backspace)