History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-11510
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Eugene Zhuravlev
Reporter: Keith Lea
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Allow a JavaSourceTransformingCompiler to specify a method to map line/column numbers back to the original file

Created: 11 May 05 04:57   Updated: 23 Nov 06 15:43
Component/s: Compiling Project
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 3,326
Severity: Medium


 Description  « Hide
My plugin transforms source code at compilation time, but only slightly in most cases. When the resulting code won't compile, it's always because the original source code was incorrect. Compilation errors show up as errors in the transformed file, which causes the editor to open the transformed file. This is not so useful to the user, who would like to simply edit the file to fix the error, instead of figuring out where that position is in the original file.

I'd like a way, perhaps an extra interface that my compiler would implement, which would provide a means of translating line/column numbers in the transformed file, into line/column numbers in the original file (if applicable). I think an API like this would be useful:

public @Nullable TransformedFile transform(CompileContext ctx, VirtualFile file, VirtualFile output);

interface TransformedFile {
@Nullable Position getPositionInOriginalFile(Position p);
}

class Position { .. getLine, getColumn .. }

If getPositionInOriginalFile returns null, there is no corresponding position in the original file, and the error should be shown in the transformed file (like it is now).



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.