Bug 4480 – JSON: include location range, not just line numbers, for everything
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-07-17T10:09:50Z
Last change time
2017-12-30T03:05:52Z
Assigned to
No Owner
Creator
|
Comments
Comment #0 by dhasenan — 2010-07-17T10:09:50Z
If you include the location range for everything in the json output, it's much easier to implement navigate-to-declaration in an IDE. For example, if there is code:
logger.trace(...);
json only outputs "line": 18.
But if it instead put: "range": { "start": {"line": 18, "col": 4}, "end": {"line": 18, "col": 16}}
Then it's easier for an IDE to find the identifier under the cursor.
Similarly, IDEs often allow you to "fold" code -- collapse a declaration so you don't have to see it, or collapse a function body or a block. Including a range means the IDE doesn't need to parse D.
Comment #1 by ricochet1k — 2012-02-23T20:38:09Z
DMD doesn't currently store line offset information, so this is a fairly invasive enhancement to do, although I agree it would be very nice to have this.