Provide more specific locations for nodes
- Dominant language
- Kotlin
- Stars
- 3.5k
- Forks
- 415
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 53
Description
`KSNode` currently has a `Location`, which can either be a non-existent location or a `FileLocation`. `FileLocation` only contains a _line number_ for a node, which clearly isn't enough to specifically identify the location of a node. At a minimum, a column number in the line for start of the node would be valuable for things like outputting error messages that show the user the exact location of the node, for example something like the following for an error on the `@Bar` `KSAnnotation` node:
```
fun foo(@Bar bar: String) {
^
```
Ideally a node's location should be a _span_ (start line, start column --> end line, end column) whenever possible, which would allow for things like deleting or modifying the source for that node as a whole. Absolute start/end offsets in the file could also work.
I know that the design of `Location` (a `sealed` type, with `FileLocation` being a `data class`) basically prevents implementing such changes to that type, meaning in all likelihood such a change would have to be implemented by doing something like creating a `LocationV2` or something to that effect and adding a new `locationV2` property to `KSNode`.
Contributor guide
Assessment
This issue has not been assessed yet.