(This idea came out of a discussion with my housemate Mark, who's doing some research into a Haskell system that needs to do things like this, over lunch a few days ago.)
Text editors have, at best, a rudimentary understanding of the syntax of programming languages: typically enough to do syntax highlighting, but nothing like as good as the compiler has. I think it'd be interesting to build an editor for (as an example) Python which included a full parser for the language, and was able to relate the textual input to the parse tree for the code.
The immediate advantage would be that editing operations could act on syntactic
elements rather than just on text: you could say "cut this function" or
"convert this tuple into a list" or "rename all variables called i
to j
".
It could also offer better interaction with the compiler or debugger
(particularly for on-the-fly code modification): where errors are currently
reported using line numbers, they could instead point at the specific syntactic
elements.
The Cornell Program Synthesizer project at Cornell University in 1980 had the same idea; have a look at their writeup for a better-fleshed-out description of what I meant.
I've had several comments on this idea of the form "my favourite editor is XYZ, and it already has all the features you mentioned". The features are just examples; it's the operations upon a parse tree rather than upon the textual representation of the language that I'm interested in, and I'm not aware of any editors for conventional programming languages that do this. (Graphical languages like the Lego Mindstorms programming environment do this, but that's a somewhat different case!)