ClojureScript

Source map column mapping is off by one

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

tools.reader uses 1 for the starting index of the line and columns.

`(meta (reader/read (readers/source-logging-push-back-reader (java.io.PushbackReader. (java.io.StringReader. "+")))))
=> {:end-column 1, :end-line 1, :column 1, :line 1, :source "+"}`

Sourcemaps use 0 for the starting index. So we need to decrement the :column as well as the :line when making the sourcemap map. Also, the comment regarding line numbers and 0- vs 1- indexing is reversed.

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: