Ask HN: Are there any IDEs or editors that support editable views of code/text?

8 points by andywood ↗ HN
What I am imagining is this: The underlying file format does not change. You can specify some sort of bidirectional transformation, via regexes or maps or something. The editor presents you with an editable view of the text, with this transformation applied. When you make edits, the reverse transformation is applied to the underlying file.

Think of it as a vastly expanded version of git's 'change line feed' options. Your team likes tabs but you like spaces? Edit in spaces view - they never get into the file. Your team likes veryLongDescriptiveCamelCaseNames, but you like to kp it trs? Edit in terse view - the file is always camelCased.

I'm not really looking for a solution to one or both of these problems in particular, though. I'm really looking for an editor that even has a notion of "editable -views- of text" to begin with. Does this exist?

4 comments

[ 2.8 ms ] story [ 17.0 ms ] thread
You could implement the 2 transformations using any language you like, and then hook into your editor of choice's on-load/on-save API, to pipe the text through the external programs.
Aha! I had not thought to look for such a hook. Are they common? This is very close to what I'm looking for, thank you. Then, to toggle, I guess I would automate closing and reopening the file.

Edit: Oops. Now I'm thinking this would probably break all code analysis features. It would be nice if there was a notion of a 'view' that is very superficial and doesn't impact the code analysis.

All programmer editors should at least have some mechanism to notify you when loads/saves occur. But you might need to use whatever the editor's embedded scripting language is to do the actual child process launching and to do something non-standard with their output.

In Sublime Text for example, the above would be writing a Python class that handles some of these events:

https://www.sublimetext.com/docs/3/api_reference.html#sublim...

...probably by making use of the subprocess module from Python's standard library:

https://docs.python.org/3.3/library/subprocess.html