@synnaxlabs/client 0.46.1 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/dist/client.cjs +21 -21
- package/dist/client.js +2730 -2689
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/src/access/client.d.ts.map +1 -0
- package/dist/src/access/external.d.ts.map +1 -0
- package/dist/src/access/index.d.ts.map +1 -0
- package/dist/src/access/payload.d.ts.map +1 -0
- package/dist/src/access/policy/client.d.ts.map +1 -0
- package/dist/src/access/policy/external.d.ts.map +1 -0
- package/dist/src/access/policy/index.d.ts.map +1 -0
- package/dist/src/access/policy/payload.d.ts.map +1 -0
- package/dist/src/access/policy/policy.spec.d.ts.map +1 -0
- package/dist/{arc → src/arc}/client.d.ts +17 -2
- package/dist/src/arc/client.d.ts.map +1 -0
- package/dist/src/arc/external.d.ts.map +1 -0
- package/dist/src/arc/index.d.ts.map +1 -0
- package/dist/src/arc/lsp.spec.d.ts +2 -0
- package/dist/src/arc/lsp.spec.d.ts.map +1 -0
- package/dist/{arc → src/arc}/payload.d.ts +11 -9
- package/dist/src/arc/payload.d.ts.map +1 -0
- package/dist/src/auth/auth.d.ts.map +1 -0
- package/dist/{auth → src/auth}/auth.spec.d.ts.map +1 -1
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/channel/batchRetriever.spec.d.ts.map +1 -0
- package/dist/src/channel/channel.spec.d.ts.map +1 -0
- package/dist/{channel → src/channel}/client.d.ts +8 -8
- package/dist/src/channel/client.d.ts.map +1 -0
- package/dist/src/channel/external.d.ts.map +1 -0
- package/dist/src/channel/index.d.ts.map +1 -0
- package/dist/src/channel/payload.d.ts +259 -0
- package/dist/src/channel/payload.d.ts.map +1 -0
- package/dist/{channel → src/channel}/retriever.d.ts +2 -1
- package/dist/src/channel/retriever.d.ts.map +1 -0
- package/dist/src/channel/writer.d.ts.map +1 -0
- package/dist/{client.d.ts → src/client.d.ts} +1 -1
- package/dist/src/client.d.ts.map +1 -0
- package/dist/{connection → src/connection}/checker.d.ts +1 -1
- package/dist/src/connection/checker.d.ts.map +1 -0
- package/dist/src/connection/connection.spec.d.ts.map +1 -0
- package/dist/src/connection/index.d.ts.map +1 -0
- package/dist/src/control/client.d.ts.map +1 -0
- package/dist/src/control/external.d.ts.map +1 -0
- package/dist/src/control/index.d.ts.map +1 -0
- package/dist/{control → src/control}/state.d.ts +1 -2
- package/dist/src/control/state.d.ts.map +1 -0
- package/dist/{control → src/control}/state.spec.d.ts.map +1 -1
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/{errors.spec.d.ts.map → src/errors.spec.d.ts.map} +1 -1
- package/dist/{framer → src/framer}/adapter.d.ts +1 -1
- package/dist/src/framer/adapter.d.ts.map +1 -0
- package/dist/src/framer/adapter.spec.d.ts.map +1 -0
- package/dist/src/framer/client.d.ts.map +1 -0
- package/dist/src/framer/client.spec.d.ts.map +1 -0
- package/dist/src/framer/codec.d.ts.map +1 -0
- package/dist/{framer → src/framer}/codec.spec.d.ts.map +1 -1
- package/dist/src/framer/deleter.d.ts.map +1 -0
- package/dist/src/framer/deleter.spec.d.ts.map +1 -0
- package/dist/{framer → src/framer}/external.d.ts +1 -0
- package/dist/src/framer/external.d.ts.map +1 -0
- package/dist/{framer → src/framer}/frame.d.ts +4 -4
- package/dist/src/framer/frame.d.ts.map +1 -0
- package/dist/{framer → src/framer}/frame.spec.d.ts.map +1 -1
- package/dist/src/framer/index.d.ts.map +1 -0
- package/dist/{framer → src/framer}/iterator.d.ts +1 -2
- package/dist/src/framer/iterator.d.ts.map +1 -0
- package/dist/src/framer/iterator.spec.d.ts.map +1 -0
- package/dist/src/framer/payload.d.ts +7 -0
- package/dist/src/framer/payload.d.ts.map +1 -0
- package/dist/src/framer/streamProxy.d.ts.map +1 -0
- package/dist/{framer → src/framer}/streamer.d.ts +106 -4
- package/dist/src/framer/streamer.d.ts.map +1 -0
- package/dist/src/framer/streamer.spec.d.ts.map +1 -0
- package/dist/{framer → src/framer}/writer.d.ts +133 -36
- package/dist/src/framer/writer.d.ts.map +1 -0
- package/dist/src/framer/writer.spec.d.ts.map +1 -0
- package/dist/src/hardware/client.d.ts.map +1 -0
- package/dist/src/hardware/device/client.d.ts.map +1 -0
- package/dist/src/hardware/device/device.spec.d.ts.map +1 -0
- package/dist/src/hardware/device/external.d.ts.map +1 -0
- package/dist/src/hardware/device/index.d.ts.map +1 -0
- package/dist/{hardware → src/hardware}/device/payload.d.ts +4 -4
- package/dist/src/hardware/device/payload.d.ts.map +1 -0
- package/dist/src/hardware/external.d.ts.map +1 -0
- package/dist/src/hardware/index.d.ts.map +1 -0
- package/dist/src/hardware/rack/client.d.ts.map +1 -0
- package/dist/src/hardware/rack/external.d.ts.map +1 -0
- package/dist/src/hardware/rack/index.d.ts.map +1 -0
- package/dist/{hardware → src/hardware}/rack/payload.d.ts +4 -4
- package/dist/src/hardware/rack/payload.d.ts.map +1 -0
- package/dist/src/hardware/rack/rack.spec.d.ts.map +1 -0
- package/dist/{hardware → src/hardware}/task/client.d.ts +1 -2
- package/dist/src/hardware/task/client.d.ts.map +1 -0
- package/dist/src/hardware/task/external.d.ts.map +1 -0
- package/dist/src/hardware/task/index.d.ts.map +1 -0
- package/dist/src/hardware/task/payload.d.ts.map +1 -0
- package/dist/src/hardware/task/task.spec.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +1 -1
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/label/client.d.ts.map +1 -0
- package/dist/src/label/external.d.ts.map +1 -0
- package/dist/src/label/index.d.ts.map +1 -0
- package/dist/{label → src/label}/label.spec.d.ts.map +1 -1
- package/dist/src/label/payload.d.ts.map +1 -0
- package/dist/src/ontology/client.d.ts.map +1 -0
- package/dist/src/ontology/external.d.ts.map +1 -0
- package/dist/src/ontology/group/client.d.ts.map +1 -0
- package/dist/src/ontology/group/external.d.ts.map +1 -0
- package/dist/src/ontology/group/group.spec.d.ts.map +1 -0
- package/dist/src/ontology/group/index.d.ts.map +1 -0
- package/dist/src/ontology/group/payload.d.ts.map +1 -0
- package/dist/src/ontology/index.d.ts.map +1 -0
- package/dist/src/ontology/ontology.spec.d.ts.map +1 -0
- package/dist/src/ontology/payload.d.ts.map +1 -0
- package/dist/src/ontology/writer.d.ts.map +1 -0
- package/dist/{ranger → src/ranger}/alias.d.ts +1 -1
- package/dist/src/ranger/alias.d.ts.map +1 -0
- package/dist/{ranger → src/ranger}/client.d.ts +1 -2
- package/dist/src/ranger/client.d.ts.map +1 -0
- package/dist/src/ranger/external.d.ts.map +1 -0
- package/dist/src/ranger/index.d.ts.map +1 -0
- package/dist/src/ranger/kv.d.ts.map +1 -0
- package/dist/{ranger → src/ranger}/payload.d.ts +1 -1
- package/dist/src/ranger/payload.d.ts.map +1 -0
- package/dist/src/ranger/ranger.spec.d.ts.map +1 -0
- package/dist/src/ranger/writer.d.ts.map +1 -0
- package/dist/src/status/client.d.ts.map +1 -0
- package/dist/src/status/external.d.ts.map +1 -0
- package/dist/src/status/index.d.ts.map +1 -0
- package/dist/{status → src/status}/payload.d.ts +2 -2
- package/dist/src/status/payload.d.ts.map +1 -0
- package/dist/src/status/status.spec.d.ts.map +1 -0
- package/dist/src/testutil/channels.d.ts.map +1 -0
- package/dist/src/testutil/client.d.ts.map +1 -0
- package/dist/src/testutil/telem.d.ts.map +1 -0
- package/dist/{transport.d.ts → src/transport.d.ts} +1 -2
- package/dist/src/transport.d.ts.map +1 -0
- package/dist/src/user/client.d.ts.map +1 -0
- package/dist/src/user/external.d.ts.map +1 -0
- package/dist/src/user/index.d.ts.map +1 -0
- package/dist/src/user/payload.d.ts.map +1 -0
- package/dist/src/user/retriever.d.ts.map +1 -0
- package/dist/{user → src/user}/user.spec.d.ts.map +1 -1
- package/dist/src/user/writer.d.ts.map +1 -0
- package/dist/src/util/decodeJSONString.d.ts.map +1 -0
- package/dist/src/util/parseWithoutKeyConversion.d.ts +3 -0
- package/dist/src/util/parseWithoutKeyConversion.d.ts.map +1 -0
- package/dist/src/util/retrieve.d.ts.map +1 -0
- package/dist/src/util/retrieve.spec.d.ts.map +1 -0
- package/dist/src/util/telem.d.ts +3 -0
- package/dist/src/util/telem.d.ts.map +1 -0
- package/dist/src/workspace/client.d.ts.map +1 -0
- package/dist/src/workspace/external.d.ts.map +1 -0
- package/dist/src/workspace/index.d.ts.map +1 -0
- package/dist/src/workspace/lineplot/client.d.ts.map +1 -0
- package/dist/src/workspace/lineplot/external.d.ts.map +1 -0
- package/dist/src/workspace/lineplot/index.d.ts.map +1 -0
- package/dist/src/workspace/lineplot/lineplot.spec.d.ts.map +1 -0
- package/dist/{workspace → src/workspace}/lineplot/payload.d.ts +1 -1
- package/dist/src/workspace/lineplot/payload.d.ts.map +1 -0
- package/dist/src/workspace/log/client.d.ts.map +1 -0
- package/dist/src/workspace/log/external.d.ts.map +1 -0
- package/dist/src/workspace/log/index.d.ts.map +1 -0
- package/dist/src/workspace/log/log.spec.d.ts.map +1 -0
- package/dist/{workspace → src/workspace}/log/payload.d.ts +1 -1
- package/dist/src/workspace/log/payload.d.ts.map +1 -0
- package/dist/{workspace → src/workspace}/payload.d.ts +1 -1
- package/dist/src/workspace/payload.d.ts.map +1 -0
- package/dist/src/workspace/schematic/client.d.ts.map +1 -0
- package/dist/src/workspace/schematic/external.d.ts.map +1 -0
- package/dist/src/workspace/schematic/index.d.ts.map +1 -0
- package/dist/{workspace → src/workspace}/schematic/payload.d.ts +1 -1
- package/dist/src/workspace/schematic/payload.d.ts.map +1 -0
- package/dist/src/workspace/schematic/schematic.spec.d.ts.map +1 -0
- package/dist/src/workspace/schematic/symbol/client.d.ts.map +1 -0
- package/dist/src/workspace/schematic/symbol/client.spec.d.ts.map +1 -0
- package/dist/src/workspace/schematic/symbol/external.d.ts.map +1 -0
- package/dist/src/workspace/schematic/symbol/index.d.ts.map +1 -0
- package/dist/src/workspace/schematic/symbol/payload.d.ts.map +1 -0
- package/dist/src/workspace/table/client.d.ts.map +1 -0
- package/dist/src/workspace/table/external.d.ts.map +1 -0
- package/dist/src/workspace/table/index.d.ts.map +1 -0
- package/dist/{workspace → src/workspace}/table/payload.d.ts +1 -1
- package/dist/src/workspace/table/payload.d.ts.map +1 -0
- package/dist/src/workspace/table/table.spec.d.ts.map +1 -0
- package/dist/src/workspace/workspace.spec.d.ts.map +1 -0
- package/examples/node/streamWrite.js +0 -1
- package/package.json +7 -7
- package/src/arc/client.ts +27 -2
- package/src/arc/lsp.spec.ts +852 -0
- package/src/arc/payload.ts +13 -8
- package/src/auth/auth.spec.ts +1 -1
- package/src/channel/batchRetriever.spec.ts +3 -2
- package/src/channel/channel.spec.ts +8 -22
- package/src/channel/client.ts +22 -14
- package/src/channel/payload.ts +25 -4
- package/src/channel/retriever.ts +2 -3
- package/src/client.ts +2 -4
- package/src/connection/checker.ts +3 -4
- package/src/connection/connection.spec.ts +1 -1
- package/src/control/state.ts +1 -3
- package/src/errors.ts +2 -2
- package/src/framer/adapter.spec.ts +1 -1
- package/src/framer/adapter.ts +1 -2
- package/src/framer/client.ts +0 -2
- package/src/framer/codec.spec.ts +11 -1
- package/src/framer/codec.ts +3 -2
- package/src/framer/deleter.spec.ts +1 -1
- package/src/framer/deleter.ts +1 -3
- package/src/framer/external.ts +1 -0
- package/src/framer/frame.spec.ts +1 -1
- package/src/framer/frame.ts +6 -5
- package/src/framer/iterator.spec.ts +1 -2
- package/src/framer/iterator.ts +3 -4
- package/src/framer/payload.ts +15 -0
- package/src/framer/streamer.spec.ts +15 -12
- package/src/framer/streamer.ts +1 -3
- package/src/framer/writer.spec.ts +1 -9
- package/src/framer/writer.ts +29 -35
- package/src/hardware/task/client.ts +9 -2
- package/src/index.ts +1 -1
- package/src/label/client.ts +1 -1
- package/src/ranger/alias.ts +1 -2
- package/src/ranger/client.ts +1 -2
- package/src/ranger/kv.ts +1 -2
- package/src/ranger/payload.ts +1 -2
- package/src/ranger/ranger.spec.ts +1 -2
- package/src/status/client.ts +1 -1
- package/src/status/payload.ts +4 -2
- package/src/transport.ts +1 -3
- package/src/user/writer.ts +1 -1
- package/src/util/parseWithoutKeyConversion.ts +1 -1
- package/src/util/telem.ts +1 -1
- package/src/workspace/lineplot/payload.ts +1 -1
- package/src/workspace/log/payload.ts +1 -1
- package/src/workspace/payload.ts +1 -1
- package/src/workspace/schematic/payload.ts +1 -1
- package/src/workspace/table/payload.ts +1 -1
- package/tsconfig.json +1 -1
- package/dist/access/client.d.ts.map +0 -1
- package/dist/access/external.d.ts.map +0 -1
- package/dist/access/index.d.ts.map +0 -1
- package/dist/access/payload.d.ts.map +0 -1
- package/dist/access/policy/client.d.ts.map +0 -1
- package/dist/access/policy/external.d.ts.map +0 -1
- package/dist/access/policy/index.d.ts.map +0 -1
- package/dist/access/policy/payload.d.ts.map +0 -1
- package/dist/access/policy/policy.spec.d.ts.map +0 -1
- package/dist/arc/client.d.ts.map +0 -1
- package/dist/arc/external.d.ts.map +0 -1
- package/dist/arc/index.d.ts.map +0 -1
- package/dist/arc/payload.d.ts.map +0 -1
- package/dist/auth/auth.d.ts.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/channel/batchRetriever.spec.d.ts.map +0 -1
- package/dist/channel/channel.spec.d.ts.map +0 -1
- package/dist/channel/client.d.ts.map +0 -1
- package/dist/channel/external.d.ts.map +0 -1
- package/dist/channel/index.d.ts.map +0 -1
- package/dist/channel/payload.d.ts +0 -150
- package/dist/channel/payload.d.ts.map +0 -1
- package/dist/channel/retriever.d.ts.map +0 -1
- package/dist/channel/writer.d.ts.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/connection/checker.d.ts.map +0 -1
- package/dist/connection/connection.spec.d.ts.map +0 -1
- package/dist/connection/index.d.ts.map +0 -1
- package/dist/control/client.d.ts.map +0 -1
- package/dist/control/external.d.ts.map +0 -1
- package/dist/control/index.d.ts.map +0 -1
- package/dist/control/state.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/framer/adapter.d.ts.map +0 -1
- package/dist/framer/adapter.spec.d.ts.map +0 -1
- package/dist/framer/client.d.ts.map +0 -1
- package/dist/framer/client.spec.d.ts.map +0 -1
- package/dist/framer/codec.d.ts.map +0 -1
- package/dist/framer/deleter.d.ts.map +0 -1
- package/dist/framer/deleter.spec.d.ts.map +0 -1
- package/dist/framer/external.d.ts.map +0 -1
- package/dist/framer/frame.d.ts.map +0 -1
- package/dist/framer/index.d.ts.map +0 -1
- package/dist/framer/iterator.d.ts.map +0 -1
- package/dist/framer/iterator.spec.d.ts.map +0 -1
- package/dist/framer/streamProxy.d.ts.map +0 -1
- package/dist/framer/streamer.d.ts.map +0 -1
- package/dist/framer/streamer.spec.d.ts.map +0 -1
- package/dist/framer/writer.d.ts.map +0 -1
- package/dist/framer/writer.spec.d.ts.map +0 -1
- package/dist/hardware/client.d.ts.map +0 -1
- package/dist/hardware/device/client.d.ts.map +0 -1
- package/dist/hardware/device/device.spec.d.ts.map +0 -1
- package/dist/hardware/device/external.d.ts.map +0 -1
- package/dist/hardware/device/index.d.ts.map +0 -1
- package/dist/hardware/device/payload.d.ts.map +0 -1
- package/dist/hardware/external.d.ts.map +0 -1
- package/dist/hardware/index.d.ts.map +0 -1
- package/dist/hardware/rack/client.d.ts.map +0 -1
- package/dist/hardware/rack/external.d.ts.map +0 -1
- package/dist/hardware/rack/index.d.ts.map +0 -1
- package/dist/hardware/rack/payload.d.ts.map +0 -1
- package/dist/hardware/rack/rack.spec.d.ts.map +0 -1
- package/dist/hardware/task/client.d.ts.map +0 -1
- package/dist/hardware/task/external.d.ts.map +0 -1
- package/dist/hardware/task/index.d.ts.map +0 -1
- package/dist/hardware/task/payload.d.ts.map +0 -1
- package/dist/hardware/task/task.spec.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/label/client.d.ts.map +0 -1
- package/dist/label/external.d.ts.map +0 -1
- package/dist/label/index.d.ts.map +0 -1
- package/dist/label/payload.d.ts.map +0 -1
- package/dist/ontology/client.d.ts.map +0 -1
- package/dist/ontology/external.d.ts.map +0 -1
- package/dist/ontology/group/client.d.ts.map +0 -1
- package/dist/ontology/group/external.d.ts.map +0 -1
- package/dist/ontology/group/group.spec.d.ts.map +0 -1
- package/dist/ontology/group/index.d.ts.map +0 -1
- package/dist/ontology/group/payload.d.ts.map +0 -1
- package/dist/ontology/index.d.ts.map +0 -1
- package/dist/ontology/ontology.spec.d.ts.map +0 -1
- package/dist/ontology/payload.d.ts.map +0 -1
- package/dist/ontology/writer.d.ts.map +0 -1
- package/dist/ranger/alias.d.ts.map +0 -1
- package/dist/ranger/client.d.ts.map +0 -1
- package/dist/ranger/external.d.ts.map +0 -1
- package/dist/ranger/index.d.ts.map +0 -1
- package/dist/ranger/kv.d.ts.map +0 -1
- package/dist/ranger/payload.d.ts.map +0 -1
- package/dist/ranger/ranger.spec.d.ts.map +0 -1
- package/dist/ranger/writer.d.ts.map +0 -1
- package/dist/status/client.d.ts.map +0 -1
- package/dist/status/external.d.ts.map +0 -1
- package/dist/status/index.d.ts.map +0 -1
- package/dist/status/payload.d.ts.map +0 -1
- package/dist/status/status.spec.d.ts.map +0 -1
- package/dist/testutil/channels.d.ts.map +0 -1
- package/dist/testutil/client.d.ts.map +0 -1
- package/dist/testutil/telem.d.ts.map +0 -1
- package/dist/transport.d.ts.map +0 -1
- package/dist/user/client.d.ts.map +0 -1
- package/dist/user/external.d.ts.map +0 -1
- package/dist/user/index.d.ts.map +0 -1
- package/dist/user/payload.d.ts.map +0 -1
- package/dist/user/retriever.d.ts.map +0 -1
- package/dist/user/writer.d.ts.map +0 -1
- package/dist/util/decodeJSONString.d.ts.map +0 -1
- package/dist/util/parseWithoutKeyConversion.d.ts +0 -3
- package/dist/util/parseWithoutKeyConversion.d.ts.map +0 -1
- package/dist/util/retrieve.d.ts.map +0 -1
- package/dist/util/retrieve.spec.d.ts.map +0 -1
- package/dist/util/telem.d.ts +0 -3
- package/dist/util/telem.d.ts.map +0 -1
- package/dist/workspace/client.d.ts.map +0 -1
- package/dist/workspace/external.d.ts.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/lineplot/client.d.ts.map +0 -1
- package/dist/workspace/lineplot/external.d.ts.map +0 -1
- package/dist/workspace/lineplot/index.d.ts.map +0 -1
- package/dist/workspace/lineplot/lineplot.spec.d.ts.map +0 -1
- package/dist/workspace/lineplot/payload.d.ts.map +0 -1
- package/dist/workspace/log/client.d.ts.map +0 -1
- package/dist/workspace/log/external.d.ts.map +0 -1
- package/dist/workspace/log/index.d.ts.map +0 -1
- package/dist/workspace/log/log.spec.d.ts.map +0 -1
- package/dist/workspace/log/payload.d.ts.map +0 -1
- package/dist/workspace/payload.d.ts.map +0 -1
- package/dist/workspace/schematic/client.d.ts.map +0 -1
- package/dist/workspace/schematic/external.d.ts.map +0 -1
- package/dist/workspace/schematic/index.d.ts.map +0 -1
- package/dist/workspace/schematic/payload.d.ts.map +0 -1
- package/dist/workspace/schematic/schematic.spec.d.ts.map +0 -1
- package/dist/workspace/schematic/symbol/client.d.ts.map +0 -1
- package/dist/workspace/schematic/symbol/client.spec.d.ts.map +0 -1
- package/dist/workspace/schematic/symbol/external.d.ts.map +0 -1
- package/dist/workspace/schematic/symbol/index.d.ts.map +0 -1
- package/dist/workspace/schematic/symbol/payload.d.ts.map +0 -1
- package/dist/workspace/table/client.d.ts.map +0 -1
- package/dist/workspace/table/external.d.ts.map +0 -1
- package/dist/workspace/table/index.d.ts.map +0 -1
- package/dist/workspace/table/payload.d.ts.map +0 -1
- package/dist/workspace/table/table.spec.d.ts.map +0 -1
- package/dist/workspace/workspace.spec.d.ts.map +0 -1
- /package/dist/{access → src/access}/client.d.ts +0 -0
- /package/dist/{access → src/access}/external.d.ts +0 -0
- /package/dist/{access → src/access}/index.d.ts +0 -0
- /package/dist/{access → src/access}/payload.d.ts +0 -0
- /package/dist/{access → src/access}/policy/client.d.ts +0 -0
- /package/dist/{access → src/access}/policy/external.d.ts +0 -0
- /package/dist/{access → src/access}/policy/index.d.ts +0 -0
- /package/dist/{access → src/access}/policy/payload.d.ts +0 -0
- /package/dist/{access → src/access}/policy/policy.spec.d.ts +0 -0
- /package/dist/{arc → src/arc}/external.d.ts +0 -0
- /package/dist/{arc → src/arc}/index.d.ts +0 -0
- /package/dist/{auth → src/auth}/auth.d.ts +0 -0
- /package/dist/{auth → src/auth}/auth.spec.d.ts +0 -0
- /package/dist/{auth → src/auth}/index.d.ts +0 -0
- /package/dist/{channel → src/channel}/batchRetriever.spec.d.ts +0 -0
- /package/dist/{channel → src/channel}/channel.spec.d.ts +0 -0
- /package/dist/{channel → src/channel}/external.d.ts +0 -0
- /package/dist/{channel → src/channel}/index.d.ts +0 -0
- /package/dist/{channel → src/channel}/writer.d.ts +0 -0
- /package/dist/{connection → src/connection}/connection.spec.d.ts +0 -0
- /package/dist/{connection → src/connection}/index.d.ts +0 -0
- /package/dist/{control → src/control}/client.d.ts +0 -0
- /package/dist/{control → src/control}/external.d.ts +0 -0
- /package/dist/{control → src/control}/index.d.ts +0 -0
- /package/dist/{control → src/control}/state.spec.d.ts +0 -0
- /package/dist/{errors.d.ts → src/errors.d.ts} +0 -0
- /package/dist/{errors.spec.d.ts → src/errors.spec.d.ts} +0 -0
- /package/dist/{framer → src/framer}/adapter.spec.d.ts +0 -0
- /package/dist/{framer → src/framer}/client.d.ts +0 -0
- /package/dist/{framer → src/framer}/client.spec.d.ts +0 -0
- /package/dist/{framer → src/framer}/codec.d.ts +0 -0
- /package/dist/{framer → src/framer}/codec.spec.d.ts +0 -0
- /package/dist/{framer → src/framer}/deleter.d.ts +0 -0
- /package/dist/{framer → src/framer}/deleter.spec.d.ts +0 -0
- /package/dist/{framer → src/framer}/frame.spec.d.ts +0 -0
- /package/dist/{framer → src/framer}/index.d.ts +0 -0
- /package/dist/{framer → src/framer}/iterator.spec.d.ts +0 -0
- /package/dist/{framer → src/framer}/streamProxy.d.ts +0 -0
- /package/dist/{framer → src/framer}/streamer.spec.d.ts +0 -0
- /package/dist/{framer → src/framer}/writer.spec.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/client.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/device/client.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/device/device.spec.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/device/external.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/device/index.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/external.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/index.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/rack/client.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/rack/external.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/rack/index.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/rack/rack.spec.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/task/external.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/task/index.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/task/payload.d.ts +0 -0
- /package/dist/{hardware → src/hardware}/task/task.spec.d.ts +0 -0
- /package/dist/{label → src/label}/client.d.ts +0 -0
- /package/dist/{label → src/label}/external.d.ts +0 -0
- /package/dist/{label → src/label}/index.d.ts +0 -0
- /package/dist/{label → src/label}/label.spec.d.ts +0 -0
- /package/dist/{label → src/label}/payload.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/client.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/external.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/group/client.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/group/external.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/group/group.spec.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/group/index.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/group/payload.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/index.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/ontology.spec.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/payload.d.ts +0 -0
- /package/dist/{ontology → src/ontology}/writer.d.ts +0 -0
- /package/dist/{ranger → src/ranger}/external.d.ts +0 -0
- /package/dist/{ranger → src/ranger}/index.d.ts +0 -0
- /package/dist/{ranger → src/ranger}/kv.d.ts +0 -0
- /package/dist/{ranger → src/ranger}/ranger.spec.d.ts +0 -0
- /package/dist/{ranger → src/ranger}/writer.d.ts +0 -0
- /package/dist/{status → src/status}/client.d.ts +0 -0
- /package/dist/{status → src/status}/external.d.ts +0 -0
- /package/dist/{status → src/status}/index.d.ts +0 -0
- /package/dist/{status → src/status}/status.spec.d.ts +0 -0
- /package/dist/{testutil → src/testutil}/channels.d.ts +0 -0
- /package/dist/{testutil → src/testutil}/client.d.ts +0 -0
- /package/dist/{testutil → src/testutil}/telem.d.ts +0 -0
- /package/dist/{user → src/user}/client.d.ts +0 -0
- /package/dist/{user → src/user}/external.d.ts +0 -0
- /package/dist/{user → src/user}/index.d.ts +0 -0
- /package/dist/{user → src/user}/payload.d.ts +0 -0
- /package/dist/{user → src/user}/retriever.d.ts +0 -0
- /package/dist/{user → src/user}/user.spec.d.ts +0 -0
- /package/dist/{user → src/user}/writer.d.ts +0 -0
- /package/dist/{util → src/util}/decodeJSONString.d.ts +0 -0
- /package/dist/{util → src/util}/retrieve.d.ts +0 -0
- /package/dist/{util → src/util}/retrieve.spec.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/client.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/external.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/index.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/lineplot/client.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/lineplot/external.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/lineplot/index.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/lineplot/lineplot.spec.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/log/client.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/log/external.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/log/index.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/log/log.spec.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/client.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/external.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/index.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/schematic.spec.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/symbol/client.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/symbol/client.spec.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/symbol/external.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/symbol/index.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/schematic/symbol/payload.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/table/client.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/table/external.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/table/index.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/table/table.spec.d.ts +0 -0
- /package/dist/{workspace → src/workspace}/workspace.spec.d.ts +0 -0
- /package/{eslint.config.js → eslint.config.ts} +0 -0
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
// Copyright 2025 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
10
|
+
import { type jsonRPC } from "@synnaxlabs/x";
|
|
11
|
+
import { describe, expect, it } from "vitest";
|
|
12
|
+
|
|
13
|
+
import { createTestClient } from "@/testutil/client";
|
|
14
|
+
|
|
15
|
+
describe("Arc LSP", () => {
|
|
16
|
+
it("should open an LSP stream and handle initialize request", async () => {
|
|
17
|
+
const client = createTestClient();
|
|
18
|
+
const stream = await client.arcs.openLSP();
|
|
19
|
+
|
|
20
|
+
// Send LSP initialize request (raw JSON, no Content-Length headers)
|
|
21
|
+
const initializeRequest: jsonRPC.Request = {
|
|
22
|
+
jsonrpc: "2.0",
|
|
23
|
+
id: 1,
|
|
24
|
+
method: "initialize",
|
|
25
|
+
params: {
|
|
26
|
+
processId: null,
|
|
27
|
+
clientInfo: {
|
|
28
|
+
name: "test-client",
|
|
29
|
+
version: "1.0.0",
|
|
30
|
+
},
|
|
31
|
+
rootUri: null,
|
|
32
|
+
capabilities: {},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
stream.send({
|
|
37
|
+
content: JSON.stringify(initializeRequest),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Receive response (raw JSON, no Content-Length headers)
|
|
41
|
+
const [res, err] = await stream.receive();
|
|
42
|
+
expect(err).toBeNull();
|
|
43
|
+
if (!res) throw new Error("Expected response");
|
|
44
|
+
|
|
45
|
+
// Parse raw JSON response directly
|
|
46
|
+
const msg = JSON.parse(res.content) as jsonRPC.Response;
|
|
47
|
+
expect(msg.jsonrpc).toBe("2.0");
|
|
48
|
+
expect(msg.id).toBe(1);
|
|
49
|
+
|
|
50
|
+
// Check for error response
|
|
51
|
+
if ("error" in msg) throw new Error(`LSP error: ${msg.error.message}`);
|
|
52
|
+
|
|
53
|
+
expect("result" in msg).toBe(true);
|
|
54
|
+
|
|
55
|
+
// Verify capabilities are present
|
|
56
|
+
if ("result" in msg) {
|
|
57
|
+
const result = msg.result as Record<string, unknown>;
|
|
58
|
+
expect(result).toHaveProperty("capabilities");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
stream.closeSend();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("should handle textDocument/didOpen notification", async () => {
|
|
65
|
+
const client = createTestClient();
|
|
66
|
+
const stream = await client.arcs.openLSP();
|
|
67
|
+
|
|
68
|
+
// First initialize
|
|
69
|
+
const initializeRequest: jsonRPC.Request = {
|
|
70
|
+
jsonrpc: "2.0",
|
|
71
|
+
id: 1,
|
|
72
|
+
method: "initialize",
|
|
73
|
+
params: {
|
|
74
|
+
processId: null,
|
|
75
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
76
|
+
rootUri: null,
|
|
77
|
+
capabilities: {},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
82
|
+
const [initResponse, initErr] = await stream.receive();
|
|
83
|
+
expect(initErr).toBeNull();
|
|
84
|
+
expect(initResponse).not.toBeNull();
|
|
85
|
+
if (!initResponse) throw new Error("Expected response");
|
|
86
|
+
|
|
87
|
+
// Parse raw JSON response
|
|
88
|
+
const initMsg = JSON.parse(initResponse.content) as jsonRPC.Response;
|
|
89
|
+
expect(initMsg.id).toBe(1);
|
|
90
|
+
|
|
91
|
+
// Check for error response
|
|
92
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
93
|
+
|
|
94
|
+
// Send initialized notification
|
|
95
|
+
const initializedNotification: jsonRPC.Request = {
|
|
96
|
+
jsonrpc: "2.0",
|
|
97
|
+
method: "initialized",
|
|
98
|
+
params: {},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
stream.send({ content: JSON.stringify(initializedNotification) });
|
|
102
|
+
|
|
103
|
+
// Send didOpen notification
|
|
104
|
+
const didOpenNotification: jsonRPC.Request = {
|
|
105
|
+
jsonrpc: "2.0",
|
|
106
|
+
method: "textDocument/didOpen",
|
|
107
|
+
params: {
|
|
108
|
+
textDocument: {
|
|
109
|
+
uri: "file:///test.arc",
|
|
110
|
+
languageId: "arc",
|
|
111
|
+
version: 1,
|
|
112
|
+
text: "let x = 1 + 2;",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
stream.send({ content: JSON.stringify(didOpenNotification) });
|
|
118
|
+
|
|
119
|
+
// Notifications don't get responses, but we might get diagnostics back
|
|
120
|
+
// Wait a bit to see if we get any messages
|
|
121
|
+
const diagnosticsPromise = stream.receive();
|
|
122
|
+
const timeoutPromise = new Promise((resolve) =>
|
|
123
|
+
setTimeout(() => resolve(null), 100),
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const result = await Promise.race([diagnosticsPromise, timeoutPromise]);
|
|
127
|
+
|
|
128
|
+
if (result && Array.isArray(result)) {
|
|
129
|
+
const [diagResponse, diagErr] = result;
|
|
130
|
+
if (diagResponse && !diagErr) {
|
|
131
|
+
// Parse raw JSON notification
|
|
132
|
+
const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
|
|
133
|
+
expect(diagMsg.jsonrpc).toBe("2.0");
|
|
134
|
+
if ("method" in diagMsg)
|
|
135
|
+
expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
stream.closeSend();
|
|
140
|
+
client.close();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("should handle hover request", async () => {
|
|
144
|
+
const client = createTestClient();
|
|
145
|
+
const stream = await client.arcs.openLSP();
|
|
146
|
+
|
|
147
|
+
// Initialize
|
|
148
|
+
const initializeRequest: jsonRPC.Request = {
|
|
149
|
+
jsonrpc: "2.0",
|
|
150
|
+
id: 1,
|
|
151
|
+
method: "initialize",
|
|
152
|
+
params: {
|
|
153
|
+
processId: null,
|
|
154
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
155
|
+
rootUri: null,
|
|
156
|
+
capabilities: { textDocument: { hover: { dynamicRegistration: true } } },
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
161
|
+
const [initRes] = await stream.receive();
|
|
162
|
+
expect(initRes).not.toBeNull();
|
|
163
|
+
if (!initRes) throw new Error("Expected response");
|
|
164
|
+
|
|
165
|
+
const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
|
|
166
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
167
|
+
|
|
168
|
+
// Send initialized notification
|
|
169
|
+
stream.send({
|
|
170
|
+
content: JSON.stringify({
|
|
171
|
+
jsonrpc: "2.0",
|
|
172
|
+
method: "initialized",
|
|
173
|
+
params: {},
|
|
174
|
+
}),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Open a document
|
|
178
|
+
stream.send({
|
|
179
|
+
content: JSON.stringify({
|
|
180
|
+
jsonrpc: "2.0",
|
|
181
|
+
method: "textDocument/didOpen",
|
|
182
|
+
params: {
|
|
183
|
+
textDocument: {
|
|
184
|
+
uri: "file:///test.arc",
|
|
185
|
+
languageId: "arc",
|
|
186
|
+
version: 1,
|
|
187
|
+
text: "let x = 1 + 2;",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
}),
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Wait for and consume the publishDiagnostics notification
|
|
194
|
+
const [diagResponse] = await stream.receive();
|
|
195
|
+
expect(diagResponse).not.toBeNull();
|
|
196
|
+
|
|
197
|
+
// Request hover information
|
|
198
|
+
const hoverRequest: jsonRPC.Request = {
|
|
199
|
+
jsonrpc: "2.0",
|
|
200
|
+
id: 2,
|
|
201
|
+
method: "textDocument/hover",
|
|
202
|
+
params: {
|
|
203
|
+
textDocument: { uri: "file:///test.arc" },
|
|
204
|
+
position: { line: 0, character: 4 },
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
stream.send({ content: JSON.stringify(hoverRequest) });
|
|
209
|
+
|
|
210
|
+
const [hoverResponse, hoverErr] = await stream.receive();
|
|
211
|
+
expect(hoverErr).toBeNull();
|
|
212
|
+
expect(hoverResponse).not.toBeNull();
|
|
213
|
+
if (!hoverResponse) throw new Error("Expected response");
|
|
214
|
+
|
|
215
|
+
// Parse raw JSON response
|
|
216
|
+
const responseMsg = JSON.parse(hoverResponse.content) as jsonRPC.Response;
|
|
217
|
+
expect(responseMsg.jsonrpc).toBe("2.0");
|
|
218
|
+
expect(responseMsg.id).toBe(2);
|
|
219
|
+
|
|
220
|
+
// Check for error response
|
|
221
|
+
if ("error" in responseMsg)
|
|
222
|
+
throw new Error(`LSP error: ${responseMsg.error.message}`);
|
|
223
|
+
|
|
224
|
+
stream.closeSend();
|
|
225
|
+
client.close();
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("should handle multiple concurrent messages", async () => {
|
|
229
|
+
const client = createTestClient();
|
|
230
|
+
const stream = await client.arcs.openLSP();
|
|
231
|
+
|
|
232
|
+
const receivedMessages: jsonRPC.Response[] = [];
|
|
233
|
+
|
|
234
|
+
// Initialize
|
|
235
|
+
const initializeRequest: jsonRPC.Request = {
|
|
236
|
+
jsonrpc: "2.0",
|
|
237
|
+
id: 1,
|
|
238
|
+
method: "initialize",
|
|
239
|
+
params: {
|
|
240
|
+
processId: null,
|
|
241
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
242
|
+
rootUri: null,
|
|
243
|
+
capabilities: {},
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
248
|
+
const [initResponse] = await stream.receive();
|
|
249
|
+
if (!initResponse) throw new Error("Expected response");
|
|
250
|
+
const initMsg = JSON.parse(initResponse.content) as jsonRPC.Response;
|
|
251
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
252
|
+
|
|
253
|
+
receivedMessages.push(initMsg);
|
|
254
|
+
|
|
255
|
+
// Send multiple requests with different IDs
|
|
256
|
+
const requests = [
|
|
257
|
+
{
|
|
258
|
+
jsonrpc: "2.0",
|
|
259
|
+
id: 10,
|
|
260
|
+
method: "workspace/symbol",
|
|
261
|
+
params: { query: "test" },
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
jsonrpc: "2.0",
|
|
265
|
+
id: 11,
|
|
266
|
+
method: "textDocument/documentSymbol",
|
|
267
|
+
params: { textDocument: { uri: "file:///test.arc" } },
|
|
268
|
+
},
|
|
269
|
+
];
|
|
270
|
+
|
|
271
|
+
for (const req of requests) stream.send({ content: JSON.stringify(req) });
|
|
272
|
+
|
|
273
|
+
// Receive responses (order may vary)
|
|
274
|
+
for (let i = 0; i < requests.length; i++) {
|
|
275
|
+
const [response] = await stream.receive();
|
|
276
|
+
if (!response) throw new Error("Expected response");
|
|
277
|
+
const msg = JSON.parse(response.content) as jsonRPC.Response;
|
|
278
|
+
if ("error" in msg) throw new Error(`LSP error: ${msg.error.message}`);
|
|
279
|
+
|
|
280
|
+
receivedMessages.push(msg);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Should have init response + 2 request responses
|
|
284
|
+
expect(receivedMessages.length).toBeGreaterThanOrEqual(3);
|
|
285
|
+
|
|
286
|
+
// Verify all responses have correct structure
|
|
287
|
+
for (const msg of receivedMessages) {
|
|
288
|
+
expect(msg.jsonrpc).toBe("2.0");
|
|
289
|
+
expect(msg.id).toBeDefined();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
stream.closeSend();
|
|
293
|
+
client.close();
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it("should properly encode and decode JSON-RPC messages without headers", async () => {
|
|
297
|
+
const client = createTestClient();
|
|
298
|
+
const stream = await client.arcs.openLSP();
|
|
299
|
+
|
|
300
|
+
// Test that our message format is just JSON without Content-Length headers
|
|
301
|
+
const testMessage: jsonRPC.Request = {
|
|
302
|
+
jsonrpc: "2.0",
|
|
303
|
+
id: 999,
|
|
304
|
+
method: "test/method",
|
|
305
|
+
params: { data: "test" },
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const messageContent = JSON.stringify(testMessage);
|
|
309
|
+
|
|
310
|
+
// Send raw JSON (no headers)
|
|
311
|
+
stream.send({ content: messageContent });
|
|
312
|
+
|
|
313
|
+
// The server should respond (even if it's an error for unknown method)
|
|
314
|
+
const [response, err] = await stream.receive();
|
|
315
|
+
expect(err).toBeNull();
|
|
316
|
+
expect(response).not.toBeNull();
|
|
317
|
+
if (!response) throw new Error("Expected response");
|
|
318
|
+
|
|
319
|
+
// Response should be parseable JSON
|
|
320
|
+
const parsed = JSON.parse(response.content) as jsonRPC.Response;
|
|
321
|
+
expect(parsed.jsonrpc).toBe("2.0");
|
|
322
|
+
expect(parsed.id).toBe(999);
|
|
323
|
+
|
|
324
|
+
// This test expects an error response for unknown method
|
|
325
|
+
if ("error" in parsed) expect(parsed.error).toBeDefined();
|
|
326
|
+
|
|
327
|
+
stream.closeSend();
|
|
328
|
+
client.close();
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it("should provide semantic tokens for Arc code", async () => {
|
|
332
|
+
const client = createTestClient();
|
|
333
|
+
const stream = await client.arcs.openLSP();
|
|
334
|
+
|
|
335
|
+
// Initialize with semantic tokens capability
|
|
336
|
+
const initializeRequest: jsonRPC.Request = {
|
|
337
|
+
jsonrpc: "2.0",
|
|
338
|
+
id: 1,
|
|
339
|
+
method: "initialize",
|
|
340
|
+
params: {
|
|
341
|
+
processId: null,
|
|
342
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
343
|
+
rootUri: null,
|
|
344
|
+
capabilities: {
|
|
345
|
+
textDocument: {
|
|
346
|
+
semanticTokens: {
|
|
347
|
+
dynamicRegistration: true,
|
|
348
|
+
requests: { full: true },
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
356
|
+
const [initRes] = await stream.receive();
|
|
357
|
+
expect(initRes).not.toBeNull();
|
|
358
|
+
if (!initRes) throw new Error("Expected response");
|
|
359
|
+
|
|
360
|
+
const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
|
|
361
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
362
|
+
|
|
363
|
+
// Verify server advertises semantic tokens support
|
|
364
|
+
if ("result" in initMsg) {
|
|
365
|
+
const result = initMsg.result as Record<string, unknown>;
|
|
366
|
+
const capabilities = result.capabilities as Record<string, unknown>;
|
|
367
|
+
expect(capabilities).toHaveProperty("semanticTokensProvider");
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Send initialized notification
|
|
371
|
+
stream.send({
|
|
372
|
+
content: JSON.stringify({
|
|
373
|
+
jsonrpc: "2.0",
|
|
374
|
+
method: "initialized",
|
|
375
|
+
params: {},
|
|
376
|
+
}),
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// Open a document with Arc code
|
|
380
|
+
const arcCode = "func add(x i32, y i32) i32 {\n return x + y\n}";
|
|
381
|
+
stream.send({
|
|
382
|
+
content: JSON.stringify({
|
|
383
|
+
jsonrpc: "2.0",
|
|
384
|
+
method: "textDocument/didOpen",
|
|
385
|
+
params: {
|
|
386
|
+
textDocument: {
|
|
387
|
+
uri: "file:///test.arc",
|
|
388
|
+
languageId: "arc",
|
|
389
|
+
version: 1,
|
|
390
|
+
text: arcCode,
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
}),
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// Wait for diagnostics
|
|
397
|
+
await stream.receive();
|
|
398
|
+
|
|
399
|
+
// Request semantic tokens
|
|
400
|
+
const semanticTokensRequest: jsonRPC.Request = {
|
|
401
|
+
jsonrpc: "2.0",
|
|
402
|
+
id: 2,
|
|
403
|
+
method: "textDocument/semanticTokens/full",
|
|
404
|
+
params: {
|
|
405
|
+
textDocument: { uri: "file:///test.arc" },
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
stream.send({ content: JSON.stringify(semanticTokensRequest) });
|
|
410
|
+
|
|
411
|
+
const [tokenResponse, tokenErr] = await stream.receive();
|
|
412
|
+
expect(tokenErr).toBeNull();
|
|
413
|
+
expect(tokenResponse).not.toBeNull();
|
|
414
|
+
if (!tokenResponse) throw new Error("Expected response");
|
|
415
|
+
|
|
416
|
+
const tokenMsg = JSON.parse(tokenResponse.content) as jsonRPC.Response;
|
|
417
|
+
expect(tokenMsg.jsonrpc).toBe("2.0");
|
|
418
|
+
expect(tokenMsg.id).toBe(2);
|
|
419
|
+
|
|
420
|
+
if ("error" in tokenMsg) throw new Error(`LSP error: ${tokenMsg.error.message}`);
|
|
421
|
+
|
|
422
|
+
// Verify semantic tokens are returned
|
|
423
|
+
if ("result" in tokenMsg) {
|
|
424
|
+
const result = tokenMsg.result as Record<string, unknown>;
|
|
425
|
+
expect(result).toHaveProperty("data");
|
|
426
|
+
const data = result.data as number[];
|
|
427
|
+
expect(Array.isArray(data)).toBe(true);
|
|
428
|
+
// Should have tokens (encoded as [deltaLine, deltaStart, length, type, modifiers] * N)
|
|
429
|
+
expect(data.length).toBeGreaterThan(0);
|
|
430
|
+
// Tokens should be in groups of 5
|
|
431
|
+
expect(data.length % 5).toBe(0);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
stream.closeSend();
|
|
435
|
+
client.close();
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
describe("Block Expression Wrapping", () => {
|
|
439
|
+
it("should handle block URI with metadata", async () => {
|
|
440
|
+
const client = createTestClient();
|
|
441
|
+
const stream = await client.arcs.openLSP();
|
|
442
|
+
|
|
443
|
+
// Initialize
|
|
444
|
+
const initializeRequest: jsonRPC.Request = {
|
|
445
|
+
jsonrpc: "2.0",
|
|
446
|
+
id: 1,
|
|
447
|
+
method: "initialize",
|
|
448
|
+
params: {
|
|
449
|
+
processId: null,
|
|
450
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
451
|
+
rootUri: null,
|
|
452
|
+
capabilities: {},
|
|
453
|
+
},
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
457
|
+
const [initRes] = await stream.receive();
|
|
458
|
+
expect(initRes).not.toBeNull();
|
|
459
|
+
if (!initRes) throw new Error("Expected response");
|
|
460
|
+
|
|
461
|
+
const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
|
|
462
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
463
|
+
|
|
464
|
+
// Send initialized notification
|
|
465
|
+
stream.send({
|
|
466
|
+
content: JSON.stringify({
|
|
467
|
+
jsonrpc: "2.0",
|
|
468
|
+
method: "initialized",
|
|
469
|
+
params: {},
|
|
470
|
+
}),
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// Create metadata for block expression
|
|
474
|
+
const metadata = { is_block: true };
|
|
475
|
+
const encoded = btoa(JSON.stringify(metadata));
|
|
476
|
+
const blockURI = `arc://block/test123#${encoded}`;
|
|
477
|
+
|
|
478
|
+
// Open a document with block URI containing a simple expression
|
|
479
|
+
const blockExpression = "return x * 2";
|
|
480
|
+
stream.send({
|
|
481
|
+
content: JSON.stringify({
|
|
482
|
+
jsonrpc: "2.0",
|
|
483
|
+
method: "textDocument/didOpen",
|
|
484
|
+
params: {
|
|
485
|
+
textDocument: {
|
|
486
|
+
uri: blockURI,
|
|
487
|
+
languageId: "arc",
|
|
488
|
+
version: 1,
|
|
489
|
+
text: blockExpression,
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
}),
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// Should receive diagnostics
|
|
496
|
+
const [diagResponse, diagErr] = await stream.receive();
|
|
497
|
+
expect(diagErr).toBeNull();
|
|
498
|
+
expect(diagResponse).not.toBeNull();
|
|
499
|
+
if (!diagResponse) throw new Error("Expected diagnostics");
|
|
500
|
+
|
|
501
|
+
const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
|
|
502
|
+
expect(diagMsg.jsonrpc).toBe("2.0");
|
|
503
|
+
if ("method" in diagMsg) {
|
|
504
|
+
expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
|
|
505
|
+
if ("params" in diagMsg) {
|
|
506
|
+
const params = diagMsg.params as Record<string, unknown>;
|
|
507
|
+
expect(params.uri).toBe(blockURI);
|
|
508
|
+
// Expression should be wrapped and parsed successfully
|
|
509
|
+
const diagnostics = params.diagnostics as unknown[];
|
|
510
|
+
// May have diagnostics about undefined 'x', but should parse successfully
|
|
511
|
+
expect(Array.isArray(diagnostics)).toBe(true);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
stream.closeSend();
|
|
516
|
+
client.close();
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
it("should provide correct diagnostics for block with syntax error", async () => {
|
|
520
|
+
const client = createTestClient();
|
|
521
|
+
const stream = await client.arcs.openLSP();
|
|
522
|
+
|
|
523
|
+
// Initialize
|
|
524
|
+
const initializeRequest: jsonRPC.Request = {
|
|
525
|
+
jsonrpc: "2.0",
|
|
526
|
+
id: 1,
|
|
527
|
+
method: "initialize",
|
|
528
|
+
params: {
|
|
529
|
+
processId: null,
|
|
530
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
531
|
+
rootUri: null,
|
|
532
|
+
capabilities: {},
|
|
533
|
+
},
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
537
|
+
const [initRes] = await stream.receive();
|
|
538
|
+
expect(initRes).not.toBeNull();
|
|
539
|
+
if (!initRes) throw new Error("Expected response");
|
|
540
|
+
|
|
541
|
+
const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
|
|
542
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
543
|
+
|
|
544
|
+
// Send initialized notification
|
|
545
|
+
stream.send({
|
|
546
|
+
content: JSON.stringify({
|
|
547
|
+
jsonrpc: "2.0",
|
|
548
|
+
method: "initialized",
|
|
549
|
+
params: {},
|
|
550
|
+
}),
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
// Create block URI
|
|
554
|
+
const metadata = { is_block: true };
|
|
555
|
+
const encoded = btoa(JSON.stringify(metadata));
|
|
556
|
+
const blockURI = `arc://block/syntax-error#${encoded}`;
|
|
557
|
+
|
|
558
|
+
// Open a document with invalid syntax
|
|
559
|
+
const invalidExpression = "return x +";
|
|
560
|
+
stream.send({
|
|
561
|
+
content: JSON.stringify({
|
|
562
|
+
jsonrpc: "2.0",
|
|
563
|
+
method: "textDocument/didOpen",
|
|
564
|
+
params: {
|
|
565
|
+
textDocument: {
|
|
566
|
+
uri: blockURI,
|
|
567
|
+
languageId: "arc",
|
|
568
|
+
version: 1,
|
|
569
|
+
text: invalidExpression,
|
|
570
|
+
},
|
|
571
|
+
},
|
|
572
|
+
}),
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
// Should receive diagnostics with syntax error
|
|
576
|
+
const [diagResponse, diagErr] = await stream.receive();
|
|
577
|
+
expect(diagErr).toBeNull();
|
|
578
|
+
expect(diagResponse).not.toBeNull();
|
|
579
|
+
if (!diagResponse) throw new Error("Expected diagnostics");
|
|
580
|
+
|
|
581
|
+
const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
|
|
582
|
+
if ("method" in diagMsg && "params" in diagMsg) {
|
|
583
|
+
expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
|
|
584
|
+
const params = diagMsg.params as Record<string, unknown>;
|
|
585
|
+
const diagnostics = params.diagnostics as Array<{
|
|
586
|
+
range: { start: { line: number; character: number } };
|
|
587
|
+
message: string;
|
|
588
|
+
severity: number;
|
|
589
|
+
}>;
|
|
590
|
+
|
|
591
|
+
// Should have at least one diagnostic
|
|
592
|
+
expect(diagnostics.length).toBeGreaterThan(0);
|
|
593
|
+
|
|
594
|
+
// Position should be mapped correctly (line 0 for original expression)
|
|
595
|
+
// Note: Parse errors may not be position-mapped correctly yet
|
|
596
|
+
// This is a known limitation - for now we just verify diagnostics exist
|
|
597
|
+
const firstDiag = diagnostics[0];
|
|
598
|
+
console.log("Diagnostic position:", firstDiag.range.start);
|
|
599
|
+
// expect(firstDiag.range.start.line).toBe(0);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
stream.closeSend();
|
|
603
|
+
client.close();
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
it("should handle multi-line block expressions", async () => {
|
|
607
|
+
const client = createTestClient();
|
|
608
|
+
const stream = await client.arcs.openLSP();
|
|
609
|
+
|
|
610
|
+
// Initialize
|
|
611
|
+
const initializeRequest: jsonRPC.Request = {
|
|
612
|
+
jsonrpc: "2.0",
|
|
613
|
+
id: 1,
|
|
614
|
+
method: "initialize",
|
|
615
|
+
params: {
|
|
616
|
+
processId: null,
|
|
617
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
618
|
+
rootUri: null,
|
|
619
|
+
capabilities: {},
|
|
620
|
+
},
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
624
|
+
const [initRes] = await stream.receive();
|
|
625
|
+
expect(initRes).not.toBeNull();
|
|
626
|
+
if (!initRes) throw new Error("Expected response");
|
|
627
|
+
|
|
628
|
+
const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
|
|
629
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
630
|
+
|
|
631
|
+
// Send initialized notification
|
|
632
|
+
stream.send({
|
|
633
|
+
content: JSON.stringify({
|
|
634
|
+
jsonrpc: "2.0",
|
|
635
|
+
method: "initialized",
|
|
636
|
+
params: {},
|
|
637
|
+
}),
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// Create block URI
|
|
641
|
+
const metadata = { is_block: true };
|
|
642
|
+
const encoded = btoa(JSON.stringify(metadata));
|
|
643
|
+
const blockURI = `arc://block/multiline#${encoded}`;
|
|
644
|
+
|
|
645
|
+
// Multi-line block expression
|
|
646
|
+
const multiLineExpression =
|
|
647
|
+
"let temp = x * 2\nlet result = temp + 1\nreturn result";
|
|
648
|
+
stream.send({
|
|
649
|
+
content: JSON.stringify({
|
|
650
|
+
jsonrpc: "2.0",
|
|
651
|
+
method: "textDocument/didOpen",
|
|
652
|
+
params: {
|
|
653
|
+
textDocument: {
|
|
654
|
+
uri: blockURI,
|
|
655
|
+
languageId: "arc",
|
|
656
|
+
version: 1,
|
|
657
|
+
text: multiLineExpression,
|
|
658
|
+
},
|
|
659
|
+
},
|
|
660
|
+
}),
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
// Should receive diagnostics
|
|
664
|
+
const [diagResponse, diagErr] = await stream.receive();
|
|
665
|
+
expect(diagErr).toBeNull();
|
|
666
|
+
expect(diagResponse).not.toBeNull();
|
|
667
|
+
if (!diagResponse) throw new Error("Expected diagnostics");
|
|
668
|
+
|
|
669
|
+
const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
|
|
670
|
+
if ("method" in diagMsg && "params" in diagMsg) {
|
|
671
|
+
expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
|
|
672
|
+
const params = diagMsg.params as Record<string, unknown>;
|
|
673
|
+
expect(params.uri).toBe(blockURI);
|
|
674
|
+
const diagnostics = params.diagnostics as unknown[];
|
|
675
|
+
// Should successfully parse multi-line expression
|
|
676
|
+
expect(Array.isArray(diagnostics)).toBe(true);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
stream.closeSend();
|
|
680
|
+
client.close();
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
it("should handle textDocument/didChange for block expressions", async () => {
|
|
684
|
+
const client = createTestClient();
|
|
685
|
+
const stream = await client.arcs.openLSP();
|
|
686
|
+
|
|
687
|
+
// Initialize
|
|
688
|
+
const initializeRequest: jsonRPC.Request = {
|
|
689
|
+
jsonrpc: "2.0",
|
|
690
|
+
id: 1,
|
|
691
|
+
method: "initialize",
|
|
692
|
+
params: {
|
|
693
|
+
processId: null,
|
|
694
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
695
|
+
rootUri: null,
|
|
696
|
+
capabilities: {},
|
|
697
|
+
},
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
701
|
+
const [initRes] = await stream.receive();
|
|
702
|
+
expect(initRes).not.toBeNull();
|
|
703
|
+
if (!initRes) throw new Error("Expected response");
|
|
704
|
+
|
|
705
|
+
const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
|
|
706
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
707
|
+
|
|
708
|
+
// Send initialized notification
|
|
709
|
+
stream.send({
|
|
710
|
+
content: JSON.stringify({
|
|
711
|
+
jsonrpc: "2.0",
|
|
712
|
+
method: "initialized",
|
|
713
|
+
params: {},
|
|
714
|
+
}),
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// Create block URI
|
|
718
|
+
const metadata = { is_block: true };
|
|
719
|
+
const encoded = btoa(JSON.stringify(metadata));
|
|
720
|
+
const blockURI = `arc://block/change-test#${encoded}`;
|
|
721
|
+
|
|
722
|
+
// Open initial document
|
|
723
|
+
stream.send({
|
|
724
|
+
content: JSON.stringify({
|
|
725
|
+
jsonrpc: "2.0",
|
|
726
|
+
method: "textDocument/didOpen",
|
|
727
|
+
params: {
|
|
728
|
+
textDocument: {
|
|
729
|
+
uri: blockURI,
|
|
730
|
+
languageId: "arc",
|
|
731
|
+
version: 1,
|
|
732
|
+
text: "return x",
|
|
733
|
+
},
|
|
734
|
+
},
|
|
735
|
+
}),
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// Receive initial diagnostics
|
|
739
|
+
await stream.receive();
|
|
740
|
+
|
|
741
|
+
// Send didChange to update the expression
|
|
742
|
+
stream.send({
|
|
743
|
+
content: JSON.stringify({
|
|
744
|
+
jsonrpc: "2.0",
|
|
745
|
+
method: "textDocument/didChange",
|
|
746
|
+
params: {
|
|
747
|
+
textDocument: {
|
|
748
|
+
uri: blockURI,
|
|
749
|
+
version: 2,
|
|
750
|
+
},
|
|
751
|
+
contentChanges: [
|
|
752
|
+
{
|
|
753
|
+
text: "return x + y",
|
|
754
|
+
},
|
|
755
|
+
],
|
|
756
|
+
},
|
|
757
|
+
}),
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
// Should receive updated diagnostics
|
|
761
|
+
const [changeDiagResponse, changeDiagErr] = await stream.receive();
|
|
762
|
+
expect(changeDiagErr).toBeNull();
|
|
763
|
+
expect(changeDiagResponse).not.toBeNull();
|
|
764
|
+
if (!changeDiagResponse) throw new Error("Expected diagnostics");
|
|
765
|
+
|
|
766
|
+
const changeDiagMsg = JSON.parse(changeDiagResponse.content) as jsonRPC.Message;
|
|
767
|
+
if ("method" in changeDiagMsg && "params" in changeDiagMsg) {
|
|
768
|
+
expect(changeDiagMsg.method).toBe("textDocument/publishDiagnostics");
|
|
769
|
+
const params = changeDiagMsg.params as Record<string, unknown>;
|
|
770
|
+
expect(params.uri).toBe(blockURI);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
stream.closeSend();
|
|
774
|
+
client.close();
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
it("should reject non-block URIs without metadata", async () => {
|
|
778
|
+
const client = createTestClient();
|
|
779
|
+
const stream = await client.arcs.openLSP();
|
|
780
|
+
|
|
781
|
+
// Initialize
|
|
782
|
+
const initializeRequest: jsonRPC.Request = {
|
|
783
|
+
jsonrpc: "2.0",
|
|
784
|
+
id: 1,
|
|
785
|
+
method: "initialize",
|
|
786
|
+
params: {
|
|
787
|
+
processId: null,
|
|
788
|
+
clientInfo: { name: "test-client", version: "1.0.0" },
|
|
789
|
+
rootUri: null,
|
|
790
|
+
capabilities: {},
|
|
791
|
+
},
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
stream.send({ content: JSON.stringify(initializeRequest) });
|
|
795
|
+
const [initRes] = await stream.receive();
|
|
796
|
+
expect(initRes).not.toBeNull();
|
|
797
|
+
if (!initRes) throw new Error("Expected response");
|
|
798
|
+
|
|
799
|
+
const initMsg = JSON.parse(initRes.content) as jsonRPC.Response;
|
|
800
|
+
if ("error" in initMsg) throw new Error(`LSP error: ${initMsg.error.message}`);
|
|
801
|
+
|
|
802
|
+
// Send initialized notification
|
|
803
|
+
stream.send({
|
|
804
|
+
content: JSON.stringify({
|
|
805
|
+
jsonrpc: "2.0",
|
|
806
|
+
method: "initialized",
|
|
807
|
+
params: {},
|
|
808
|
+
}),
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
// Try to open a block URI without metadata fragment
|
|
812
|
+
const invalidBlockURI = "arc://block/no-metadata";
|
|
813
|
+
|
|
814
|
+
// Open a document with invalid block expression (missing wrapping)
|
|
815
|
+
const blockExpression = "return x * 2";
|
|
816
|
+
stream.send({
|
|
817
|
+
content: JSON.stringify({
|
|
818
|
+
jsonrpc: "2.0",
|
|
819
|
+
method: "textDocument/didOpen",
|
|
820
|
+
params: {
|
|
821
|
+
textDocument: {
|
|
822
|
+
uri: invalidBlockURI,
|
|
823
|
+
languageId: "arc",
|
|
824
|
+
version: 1,
|
|
825
|
+
text: blockExpression,
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
}),
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
// Should receive diagnostics with parse errors (not wrapped)
|
|
832
|
+
const [diagResponse, diagErr] = await stream.receive();
|
|
833
|
+
expect(diagErr).toBeNull();
|
|
834
|
+
expect(diagResponse).not.toBeNull();
|
|
835
|
+
if (!diagResponse) throw new Error("Expected diagnostics");
|
|
836
|
+
|
|
837
|
+
const diagMsg = JSON.parse(diagResponse.content) as jsonRPC.Message;
|
|
838
|
+
if ("method" in diagMsg && "params" in diagMsg) {
|
|
839
|
+
expect(diagMsg.method).toBe("textDocument/publishDiagnostics");
|
|
840
|
+
const params = diagMsg.params as Record<string, unknown>;
|
|
841
|
+
const diagnostics = params.diagnostics as Array<{ severity: number }>;
|
|
842
|
+
|
|
843
|
+
// Should have error diagnostics because expression isn't wrapped
|
|
844
|
+
const errors = diagnostics.filter((d) => d.severity === 1); // Error severity
|
|
845
|
+
expect(errors.length).toBeGreaterThan(0);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
stream.closeSend();
|
|
849
|
+
client.close();
|
|
850
|
+
});
|
|
851
|
+
});
|
|
852
|
+
});
|