Fix KCL source ranges to know which source file they point to (#4418)
* Add ts_rs feature to work with indexmap * Add feature for schemars to work with indexmap * Add module ID to intern module paths * Update code to use new source range with three fields * Update generated files * Update docs * Fix wasm * Fix TS code to use new SourceRange * Fix TS tests to use new SourceRange and moduleId * Fix formatting * Fix to filter errors and source ranges to only show the top-level module * Fix to reuse module IDs * Fix to disallow empty path for import * Revert unneeded Self change * Rename field to be clearer * Fix parser tests * Update snapshots * Change to not serialize module_id of 0 * Update snapshots after adding default module_id * Move module_id functions to separate module * Fix tests for console errors * Proposal: module ID = 0 gets skipped when serializing tokens too (#4422) Just like in AST nodes. Also I think "is_top_level" communicates intention better than is_default --------- Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
This commit is contained in:
@ -1903,6 +1903,6 @@ describe('parsing errors', () => {
|
||||
const error = result as KCLError
|
||||
expect(error.kind).toBe('syntax')
|
||||
expect(error.msg).toBe('Unexpected token: (')
|
||||
expect(error.sourceRanges).toEqual([[27, 28]])
|
||||
expect(error.sourceRanges).toEqual([[27, 28, 0]])
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user