This page is no longer maintained — Please continue to the home page at

Command line tools for refactoring

No replies
Samuel Robert Reid
Joined: 2008-12-17,
User offline. Last seen 1 year 22 weeks ago.

Would providing a higher-level library in the scala compiler project
make it easier for IDE developers to produce good scala tools? This
could be an API something like:

class IDESupport{
//Used by IDEs for "go-to-declaration", characterIndex refers to the
symbol to be used
getDeclaration(files:List[SourceFile], characterIndex: Int) :

//Used by IDEs for "find-usages"
findUsages(files:List[SourceFile], characterIndex: Int) :

//Used by IDEs for "rename symbol", returns a list of changes that
can be applied to the list of SourceFiles

renameSymbol(files:List[SourceFile],characterIndex:Int,newName:String) :

Is something like this already being done? Or would it have low value
since it could only be used for situations in which the code can pass
the compiler? Although it might be possible to also provide this level
of support for autocomplete and autocomplete-by-type...

This approach seems like it could make IDE plugins robust to changes in
the language, and provide some vital functionality. (Though it might
create other problem such as performance, etc.)

Also, I haven't implemented anything like the above, not sure how
difficult it would be. Do the AST nodes in scala contain references to
source locations, or is this discarded during the parse?

Sam Reid

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland