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:
Jonathan Tran
2024-11-07 11:23:41 -05:00
committed by GitHub
parent 30dfc167d3
commit 97705234c6
80 changed files with 1789 additions and 1246 deletions

View File

@ -610,7 +610,7 @@ describe('testing getArtifactsToUpdate', () => {
sweepId: '',
codeRef: {
pathToNode: [['body', '']],
range: [37, 64],
range: [37, 64, 0],
},
},
])
@ -622,7 +622,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceIds: [],
edgeIds: [],
codeRef: {
range: [231, 254],
range: [231, 254, 0],
pathToNode: [['body', '']],
},
},
@ -632,7 +632,7 @@ describe('testing getArtifactsToUpdate', () => {
planeId: expect.any(String),
sweepId: expect.any(String),
codeRef: {
range: [37, 64],
range: [37, 64, 0],
pathToNode: [['body', '']],
},
solid2dId: expect.any(String),
@ -645,7 +645,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceId: '',
edgeIds: [],
codeRef: {
range: [70, 86],
range: [70, 86, 0],
pathToNode: [['body', '']],
},
},
@ -655,7 +655,7 @@ describe('testing getArtifactsToUpdate', () => {
planeId: expect.any(String),
sweepId: expect.any(String),
codeRef: {
range: [37, 64],
range: [37, 64, 0],
pathToNode: [['body', '']],
},
solid2dId: expect.any(String),
@ -669,7 +669,7 @@ describe('testing getArtifactsToUpdate', () => {
edgeIds: [],
surfaceId: '',
codeRef: {
range: [260, 299],
range: [260, 299, 0],
pathToNode: [['body', '']],
},
},
@ -679,7 +679,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceId: expect.any(String),
edgeIds: expect.any(Array),
codeRef: {
range: [92, 119],
range: [92, 119, 0],
pathToNode: [['body', '']],
},
edgeCutId: expect.any(String),
@ -699,7 +699,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceId: expect.any(String),
edgeIds: expect.any(Array),
codeRef: {
range: [156, 203],
range: [156, 203, 0],
pathToNode: [['body', '']],
},
},
@ -710,7 +710,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceIds: expect.any(Array),
edgeIds: expect.any(Array),
codeRef: {
range: [231, 254],
range: [231, 254, 0],
pathToNode: [['body', '']],
},
},
@ -727,7 +727,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceId: expect.any(String),
edgeIds: expect.any(Array),
codeRef: {
range: [125, 150],
range: [125, 150, 0],
pathToNode: [['body', '']],
},
},
@ -738,7 +738,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceIds: expect.any(Array),
edgeIds: expect.any(Array),
codeRef: {
range: [231, 254],
range: [231, 254, 0],
pathToNode: [['body', '']],
},
},
@ -755,7 +755,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceId: expect.any(String),
edgeIds: expect.any(Array),
codeRef: {
range: [92, 119],
range: [92, 119, 0],
pathToNode: [['body', '']],
},
edgeCutId: expect.any(String),
@ -767,7 +767,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceIds: expect.any(Array),
edgeIds: expect.any(Array),
codeRef: {
range: [231, 254],
range: [231, 254, 0],
pathToNode: [['body', '']],
},
},
@ -784,7 +784,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceId: expect.any(String),
edgeIds: expect.any(Array),
codeRef: {
range: [70, 86],
range: [70, 86, 0],
pathToNode: [['body', '']],
},
},
@ -795,7 +795,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceIds: expect.any(Array),
edgeIds: expect.any(Array),
codeRef: {
range: [231, 254],
range: [231, 254, 0],
pathToNode: [['body', '']],
},
},
@ -813,7 +813,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceIds: expect.any(Array),
edgeIds: expect.any(Array),
codeRef: {
range: [231, 254],
range: [231, 254, 0],
pathToNode: [['body', '']],
},
},
@ -831,7 +831,7 @@ describe('testing getArtifactsToUpdate', () => {
surfaceIds: expect.any(Array),
edgeIds: expect.any(Array),
codeRef: {
range: [231, 254],
range: [231, 254, 0],
pathToNode: [['body', '']],
},
},