3 ms·
More generally though, there's an argument to be made that line-wrapping should be a thing your editor does as part of the rendering process -- not a thing it e
by wallacoloo 6y ago
More generally though, there's an argument to be made that line-wrapping should be a thing your editor does as part of the rendering process -- not a thing it encodes into the actual source file.
Modern languages come with excellent auto-formatters which can make the code look nice at just about any line length. What we need to do is integrate the auto-formatting into the editor (likely via a language-server) so that it can adjust to the width of the editor dynamically instead of running it directly on the files at some width that's forced to be the same for every user of the codebase in every setting.
- williamdclt 6y agoWe could stop storing code as text, just store an AST and let the editor parse it and render it respecting the preference of the user (I think this is a terrible idea, but also got me thinking if there's something interesting there)
- falcolas 6y ago> We could stop storing code as text Why is this terrible? Syntax errors would no longer exist, it would allow editors to work directly with the AST and not text... I think this is a fine idea personally. Our current editors already try to do this - letting you work with syntax and not text - via smart completions, boilerplate templates, and syntax highlighting. Working with an AST directly is only taking it a step further (and better, it removes the reliance on context-insensitive regex based tooling in the editors).
- em-bee 6y agodidn't some variants of BASIC do this? smalltalk is storing the code together with the compiled result in an image, so it could do the same, but i am not aware of any implementation that does that.