funkscript 0.0.0-stage → 0.2.3
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/LICENSE +21 -0
- package/README.md +204 -2
- package/dist/Widget.tsx +9 -0
- package/dist/ast/types.d.ts +513 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +5 -0
- package/dist/ast/types.js.map +1 -0
- package/dist/ast/walk.d.ts +8 -0
- package/dist/ast/walk.d.ts.map +1 -0
- package/dist/ast/walk.js +23 -0
- package/dist/ast/walk.js.map +1 -0
- package/dist/cli/build-bun.d.ts +24 -0
- package/dist/cli/build-bun.d.ts.map +1 -0
- package/dist/cli/build-bun.js +190 -0
- package/dist/cli/build-bun.js.map +1 -0
- package/dist/cli/build-watch.d.ts +21 -0
- package/dist/cli/build-watch.d.ts.map +1 -0
- package/dist/cli/build-watch.js +244 -0
- package/dist/cli/build-watch.js.map +1 -0
- package/dist/cli/build.d.ts +4 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +338 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/check.d.ts +4 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +278 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/commands.d.ts +13 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +262 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/doc.d.ts +3 -0
- package/dist/cli/doc.d.ts.map +1 -0
- package/dist/cli/doc.js +71 -0
- package/dist/cli/doc.js.map +1 -0
- package/dist/cli/doctor.d.ts +3 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +121 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/emit.d.ts +4 -0
- package/dist/cli/emit.d.ts.map +1 -0
- package/dist/cli/emit.js +87 -0
- package/dist/cli/emit.js.map +1 -0
- package/dist/cli/explain.d.ts +3 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +103 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/fmt.d.ts +3 -0
- package/dist/cli/fmt.d.ts.map +1 -0
- package/dist/cli/fmt.js +146 -0
- package/dist/cli/fmt.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +186 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +10 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +412 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/io.d.ts +9 -0
- package/dist/cli/io.d.ts.map +1 -0
- package/dist/cli/io.js +113 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/output-collisions.d.ts +2 -0
- package/dist/cli/output-collisions.d.ts.map +1 -0
- package/dist/cli/output-collisions.js +39 -0
- package/dist/cli/output-collisions.js.map +1 -0
- package/dist/cli/pipeline-style.d.ts +3 -0
- package/dist/cli/pipeline-style.d.ts.map +1 -0
- package/dist/cli/pipeline-style.js +45 -0
- package/dist/cli/pipeline-style.js.map +1 -0
- package/dist/cli/repl.d.ts +37 -0
- package/dist/cli/repl.d.ts.map +1 -0
- package/dist/cli/repl.js +334 -0
- package/dist/cli/repl.js.map +1 -0
- package/dist/cli/run.d.ts +4 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +185 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/test.d.ts +3 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +124 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/tsc.d.ts +3 -0
- package/dist/cli/tsc.d.ts.map +1 -0
- package/dist/cli/tsc.js +143 -0
- package/dist/cli/tsc.js.map +1 -0
- package/dist/cli/typecheck.d.ts +23 -0
- package/dist/cli/typecheck.d.ts.map +1 -0
- package/dist/cli/typecheck.js +65 -0
- package/dist/cli/typecheck.js.map +1 -0
- package/dist/compiler/ast-inspection.d.ts +18 -0
- package/dist/compiler/ast-inspection.d.ts.map +1 -0
- package/dist/compiler/ast-inspection.js +96 -0
- package/dist/compiler/ast-inspection.js.map +1 -0
- package/dist/compiler/boolean-operators.d.ts +8 -0
- package/dist/compiler/boolean-operators.d.ts.map +1 -0
- package/dist/compiler/boolean-operators.js +84 -0
- package/dist/compiler/boolean-operators.js.map +1 -0
- package/dist/compiler/check.d.ts +87 -0
- package/dist/compiler/check.d.ts.map +1 -0
- package/dist/compiler/check.js +1830 -0
- package/dist/compiler/check.js.map +1 -0
- package/dist/compiler/diagnostics.d.ts +6 -0
- package/dist/compiler/diagnostics.d.ts.map +1 -0
- package/dist/compiler/diagnostics.js +136 -0
- package/dist/compiler/diagnostics.js.map +1 -0
- package/dist/compiler/effect-mutation-rule.d.ts +4 -0
- package/dist/compiler/effect-mutation-rule.d.ts.map +1 -0
- package/dist/compiler/effect-mutation-rule.js +348 -0
- package/dist/compiler/effect-mutation-rule.js.map +1 -0
- package/dist/compiler/entry-rules.d.ts +5 -0
- package/dist/compiler/entry-rules.d.ts.map +1 -0
- package/dist/compiler/entry-rules.js +89 -0
- package/dist/compiler/entry-rules.js.map +1 -0
- package/dist/compiler/imported-record-functions.d.ts +4 -0
- package/dist/compiler/imported-record-functions.d.ts.map +1 -0
- package/dist/compiler/imported-record-functions.js +706 -0
- package/dist/compiler/imported-record-functions.js.map +1 -0
- package/dist/compiler/imported-schemas.d.ts +21 -0
- package/dist/compiler/imported-schemas.d.ts.map +1 -0
- package/dist/compiler/imported-schemas.js +461 -0
- package/dist/compiler/imported-schemas.js.map +1 -0
- package/dist/compiler/incremental-build.d.ts +23 -0
- package/dist/compiler/incremental-build.d.ts.map +1 -0
- package/dist/compiler/incremental-build.js +90 -0
- package/dist/compiler/incremental-build.js.map +1 -0
- package/dist/compiler/incremental-dependencies.d.ts +7 -0
- package/dist/compiler/incremental-dependencies.d.ts.map +1 -0
- package/dist/compiler/incremental-dependencies.js +190 -0
- package/dist/compiler/incremental-dependencies.js.map +1 -0
- package/dist/compiler/js-interop-nullability.d.ts +9 -0
- package/dist/compiler/js-interop-nullability.d.ts.map +1 -0
- package/dist/compiler/js-interop-nullability.js +57 -0
- package/dist/compiler/js-interop-nullability.js.map +1 -0
- package/dist/compiler/module-resolution.d.ts +6 -0
- package/dist/compiler/module-resolution.d.ts.map +1 -0
- package/dist/compiler/module-resolution.js +44 -0
- package/dist/compiler/module-resolution.js.map +1 -0
- package/dist/compiler/modules/output-collisions.d.ts +2 -0
- package/dist/compiler/modules/output-collisions.d.ts.map +1 -0
- package/dist/compiler/modules/output-collisions.js +39 -0
- package/dist/compiler/modules/output-collisions.js.map +1 -0
- package/dist/compiler/modules/output-plan.d.ts +7 -0
- package/dist/compiler/modules/output-plan.d.ts.map +1 -0
- package/dist/compiler/modules/output-plan.js +37 -0
- package/dist/compiler/modules/output-plan.js.map +1 -0
- package/dist/compiler/modules/resolution.d.ts +8 -0
- package/dist/compiler/modules/resolution.d.ts.map +1 -0
- package/dist/compiler/modules/resolution.js +48 -0
- package/dist/compiler/modules/resolution.js.map +1 -0
- package/dist/compiler/numeric-comparisons.d.ts +9 -0
- package/dist/compiler/numeric-comparisons.d.ts.map +1 -0
- package/dist/compiler/numeric-comparisons.js +153 -0
- package/dist/compiler/numeric-comparisons.js.map +1 -0
- package/dist/compiler/optional-arguments.d.ts +11 -0
- package/dist/compiler/optional-arguments.d.ts.map +1 -0
- package/dist/compiler/optional-arguments.js +246 -0
- package/dist/compiler/optional-arguments.js.map +1 -0
- package/dist/compiler/package-fingerprint.d.ts +7 -0
- package/dist/compiler/package-fingerprint.d.ts.map +1 -0
- package/dist/compiler/package-fingerprint.js +178 -0
- package/dist/compiler/package-fingerprint.js.map +1 -0
- package/dist/compiler/package-record-contracts.d.ts +5 -0
- package/dist/compiler/package-record-contracts.d.ts.map +1 -0
- package/dist/compiler/package-record-contracts.js +126 -0
- package/dist/compiler/package-record-contracts.js.map +1 -0
- package/dist/compiler/pipeline-companions.d.ts +18 -0
- package/dist/compiler/pipeline-companions.d.ts.map +1 -0
- package/dist/compiler/pipeline-companions.js +1042 -0
- package/dist/compiler/pipeline-companions.js.map +1 -0
- package/dist/compiler/pipelines/catalog.d.ts +15 -0
- package/dist/compiler/pipelines/catalog.d.ts.map +1 -0
- package/dist/compiler/pipelines/catalog.js +55 -0
- package/dist/compiler/pipelines/catalog.js.map +1 -0
- package/dist/compiler/pipelines/companions.d.ts +18 -0
- package/dist/compiler/pipelines/companions.d.ts.map +1 -0
- package/dist/compiler/pipelines/companions.js +1042 -0
- package/dist/compiler/pipelines/companions.js.map +1 -0
- package/dist/compiler/pipelines/resolution.d.ts +38 -0
- package/dist/compiler/pipelines/resolution.d.ts.map +1 -0
- package/dist/compiler/pipelines/resolution.js +571 -0
- package/dist/compiler/pipelines/resolution.js.map +1 -0
- package/dist/compiler/project-config.d.ts +28 -0
- package/dist/compiler/project-config.d.ts.map +1 -0
- package/dist/compiler/project-config.js +155 -0
- package/dist/compiler/project-config.js.map +1 -0
- package/dist/compiler/providers.d.ts +4 -0
- package/dist/compiler/providers.d.ts.map +1 -0
- package/dist/compiler/providers.js +101 -0
- package/dist/compiler/providers.js.map +1 -0
- package/dist/compiler/record-contracts.d.ts +6 -0
- package/dist/compiler/record-contracts.d.ts.map +1 -0
- package/dist/compiler/record-contracts.js +41 -0
- package/dist/compiler/record-contracts.js.map +1 -0
- package/dist/compiler/rules/control-flow.d.ts +10 -0
- package/dist/compiler/rules/control-flow.d.ts.map +1 -0
- package/dist/compiler/rules/control-flow.js +19 -0
- package/dist/compiler/rules/control-flow.js.map +1 -0
- package/dist/compiler/rules/diagnostic.d.ts +4 -0
- package/dist/compiler/rules/diagnostic.d.ts.map +1 -0
- package/dist/compiler/rules/diagnostic.js +2 -0
- package/dist/compiler/rules/diagnostic.js.map +1 -0
- package/dist/compiler/rules/module-scope-refs.d.ts +5 -0
- package/dist/compiler/rules/module-scope-refs.d.ts.map +1 -0
- package/dist/compiler/rules/module-scope-refs.js +47 -0
- package/dist/compiler/rules/module-scope-refs.js.map +1 -0
- package/dist/compiler/schemas/analysis.d.ts +13 -0
- package/dist/compiler/schemas/analysis.d.ts.map +1 -0
- package/dist/compiler/schemas/analysis.js +24 -0
- package/dist/compiler/schemas/analysis.js.map +1 -0
- package/dist/compiler/schemas/imported-record-functions.d.ts +4 -0
- package/dist/compiler/schemas/imported-record-functions.d.ts.map +1 -0
- package/dist/compiler/schemas/imported-record-functions.js +706 -0
- package/dist/compiler/schemas/imported-record-functions.js.map +1 -0
- package/dist/compiler/schemas/imported-schemas.d.ts +21 -0
- package/dist/compiler/schemas/imported-schemas.d.ts.map +1 -0
- package/dist/compiler/schemas/imported-schemas.js +461 -0
- package/dist/compiler/schemas/imported-schemas.js.map +1 -0
- package/dist/compiler/source-map.d.ts +6 -0
- package/dist/compiler/source-map.d.ts.map +1 -0
- package/dist/compiler/source-map.js +127 -0
- package/dist/compiler/source-map.js.map +1 -0
- package/dist/compiler/typescript-context.d.ts +33 -0
- package/dist/compiler/typescript-context.d.ts.map +1 -0
- package/dist/compiler/typescript-context.js +200 -0
- package/dist/compiler/typescript-context.js.map +1 -0
- package/dist/compiler.d.ts +77 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +497 -0
- package/dist/compiler.js.map +1 -0
- package/dist/emitter/assemblyscript.d.ts +5 -0
- package/dist/emitter/assemblyscript.d.ts.map +1 -0
- package/dist/emitter/assemblyscript.js +979 -0
- package/dist/emitter/assemblyscript.js.map +1 -0
- package/dist/emitter/declarations.d.ts +46 -0
- package/dist/emitter/declarations.d.ts.map +1 -0
- package/dist/emitter/declarations.js +739 -0
- package/dist/emitter/declarations.js.map +1 -0
- package/dist/emitter/emitter.d.ts +165 -0
- package/dist/emitter/emitter.d.ts.map +1 -0
- package/dist/emitter/emitter.js +2448 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/emitter/imports.d.ts +6 -0
- package/dist/emitter/imports.d.ts.map +1 -0
- package/dist/emitter/imports.js +73 -0
- package/dist/emitter/imports.js.map +1 -0
- package/dist/emitter/indent.d.ts +3 -0
- package/dist/emitter/indent.d.ts.map +1 -0
- package/dist/emitter/indent.js +31 -0
- package/dist/emitter/indent.js.map +1 -0
- package/dist/emitter/jsx.d.ts +20 -0
- package/dist/emitter/jsx.d.ts.map +1 -0
- package/dist/emitter/jsx.js +82 -0
- package/dist/emitter/jsx.js.map +1 -0
- package/dist/emitter/local-bindings.d.ts +6 -0
- package/dist/emitter/local-bindings.d.ts.map +1 -0
- package/dist/emitter/local-bindings.js +32 -0
- package/dist/emitter/local-bindings.js.map +1 -0
- package/dist/emitter/match.d.ts +56 -0
- package/dist/emitter/match.d.ts.map +1 -0
- package/dist/emitter/match.js +1287 -0
- package/dist/emitter/match.js.map +1 -0
- package/dist/emitter/pipeline-catalog.d.ts +15 -0
- package/dist/emitter/pipeline-catalog.d.ts.map +1 -0
- package/dist/emitter/pipeline-catalog.js +55 -0
- package/dist/emitter/pipeline-catalog.js.map +1 -0
- package/dist/emitter/pipeline-resolution.d.ts +38 -0
- package/dist/emitter/pipeline-resolution.d.ts.map +1 -0
- package/dist/emitter/pipeline-resolution.js +571 -0
- package/dist/emitter/pipeline-resolution.js.map +1 -0
- package/dist/emitter/runtime-helpers.d.ts +10 -0
- package/dist/emitter/runtime-helpers.d.ts.map +1 -0
- package/dist/emitter/runtime-helpers.js +22 -0
- package/dist/emitter/runtime-helpers.js.map +1 -0
- package/dist/emitter/schemas.d.ts +36 -0
- package/dist/emitter/schemas.d.ts.map +1 -0
- package/dist/emitter/schemas.js +766 -0
- package/dist/emitter/schemas.js.map +1 -0
- package/dist/emitter/statements.d.ts +23 -0
- package/dist/emitter/statements.d.ts.map +1 -0
- package/dist/emitter/statements.js +216 -0
- package/dist/emitter/statements.js.map +1 -0
- package/dist/emitter/tagged-match.d.ts +23 -0
- package/dist/emitter/tagged-match.d.ts.map +1 -0
- package/dist/emitter/tagged-match.js +109 -0
- package/dist/emitter/tagged-match.js.map +1 -0
- package/dist/emitter/types.d.ts +22 -0
- package/dist/emitter/types.d.ts.map +1 -0
- package/dist/emitter/types.js +231 -0
- package/dist/emitter/types.js.map +1 -0
- package/dist/errors.d.ts +39 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +98 -0
- package/dist/errors.js.map +1 -0
- package/dist/formatter/comments.d.ts +25 -0
- package/dist/formatter/comments.d.ts.map +1 -0
- package/dist/formatter/comments.js +283 -0
- package/dist/formatter/comments.js.map +1 -0
- package/dist/formatter/index.d.ts +71 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +1113 -0
- package/dist/formatter/index.js.map +1 -0
- package/dist/formatter/operator-precedence.d.ts +3 -0
- package/dist/formatter/operator-precedence.d.ts.map +1 -0
- package/dist/formatter/operator-precedence.js +27 -0
- package/dist/formatter/operator-precedence.js.map +1 -0
- package/dist/formatter/prettier.d.ts +7 -0
- package/dist/formatter/prettier.d.ts.map +1 -0
- package/dist/formatter/prettier.js +51 -0
- package/dist/formatter/prettier.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/interop/callback.d.ts +38 -0
- package/dist/interop/callback.d.ts.map +1 -0
- package/dist/interop/callback.js +130 -0
- package/dist/interop/callback.js.map +1 -0
- package/dist/interop/index.d.ts +6 -0
- package/dist/interop/index.d.ts.map +1 -0
- package/dist/interop/index.js +6 -0
- package/dist/interop/index.js.map +1 -0
- package/dist/interop/js.d.ts +16 -0
- package/dist/interop/js.d.ts.map +1 -0
- package/dist/interop/js.js +35 -0
- package/dist/interop/js.js.map +1 -0
- package/dist/interop/record.d.ts +9 -0
- package/dist/interop/record.d.ts.map +1 -0
- package/dist/interop/record.js +18 -0
- package/dist/interop/record.js.map +1 -0
- package/dist/interop/valibot.d.ts +9 -0
- package/dist/interop/valibot.d.ts.map +1 -0
- package/dist/interop/valibot.js +94 -0
- package/dist/interop/valibot.js.map +1 -0
- package/dist/interop/zod.d.ts +45 -0
- package/dist/interop/zod.d.ts.map +1 -0
- package/dist/interop/zod.js +143 -0
- package/dist/interop/zod.js.map +1 -0
- package/dist/lexer/lexer.d.ts +65 -0
- package/dist/lexer/lexer.d.ts.map +1 -0
- package/dist/lexer/lexer.js +1335 -0
- package/dist/lexer/lexer.js.map +1 -0
- package/dist/lexer/tokens.d.ts +96 -0
- package/dist/lexer/tokens.d.ts.map +1 -0
- package/dist/lexer/tokens.js +150 -0
- package/dist/lexer/tokens.js.map +1 -0
- package/dist/lsp/code-action-worker.d.ts +2 -0
- package/dist/lsp/code-action-worker.d.ts.map +1 -0
- package/dist/lsp/code-action-worker.js +17 -0
- package/dist/lsp/code-action-worker.js.map +1 -0
- package/dist/lsp/completion.d.ts +11 -0
- package/dist/lsp/completion.d.ts.map +1 -0
- package/dist/lsp/completion.js +260 -0
- package/dist/lsp/completion.js.map +1 -0
- package/dist/lsp/definition.d.ts +42 -0
- package/dist/lsp/definition.d.ts.map +1 -0
- package/dist/lsp/definition.js +1074 -0
- package/dist/lsp/definition.js.map +1 -0
- package/dist/lsp/diagnostics-worker.d.ts +2 -0
- package/dist/lsp/diagnostics-worker.d.ts.map +1 -0
- package/dist/lsp/diagnostics-worker.js +169 -0
- package/dist/lsp/diagnostics-worker.js.map +1 -0
- package/dist/lsp/docs.d.ts +37 -0
- package/dist/lsp/docs.d.ts.map +1 -0
- package/dist/lsp/docs.js +830 -0
- package/dist/lsp/docs.js.map +1 -0
- package/dist/lsp/error-channel.d.ts +3 -0
- package/dist/lsp/error-channel.d.ts.map +1 -0
- package/dist/lsp/error-channel.js +48 -0
- package/dist/lsp/error-channel.js.map +1 -0
- package/dist/lsp/hover.d.ts +5 -0
- package/dist/lsp/hover.d.ts.map +1 -0
- package/dist/lsp/hover.js +651 -0
- package/dist/lsp/hover.js.map +1 -0
- package/dist/lsp/imports.d.ts +5 -0
- package/dist/lsp/imports.d.ts.map +1 -0
- package/dist/lsp/imports.js +317 -0
- package/dist/lsp/imports.js.map +1 -0
- package/dist/lsp/index.d.ts +16 -0
- package/dist/lsp/index.d.ts.map +1 -0
- package/dist/lsp/index.js +17 -0
- package/dist/lsp/index.js.map +1 -0
- package/dist/lsp/inlay-hints.d.ts +3 -0
- package/dist/lsp/inlay-hints.d.ts.map +1 -0
- package/dist/lsp/inlay-hints.js +236 -0
- package/dist/lsp/inlay-hints.js.map +1 -0
- package/dist/lsp/interop-rename.d.ts +26 -0
- package/dist/lsp/interop-rename.d.ts.map +1 -0
- package/dist/lsp/interop-rename.js +346 -0
- package/dist/lsp/interop-rename.js.map +1 -0
- package/dist/lsp/match-arms.d.ts +3 -0
- package/dist/lsp/match-arms.d.ts.map +1 -0
- package/dist/lsp/match-arms.js +341 -0
- package/dist/lsp/match-arms.js.map +1 -0
- package/dist/lsp/navigation.d.ts +23 -0
- package/dist/lsp/navigation.d.ts.map +1 -0
- package/dist/lsp/navigation.js +430 -0
- package/dist/lsp/navigation.js.map +1 -0
- package/dist/lsp/parsed-documents.d.ts +25 -0
- package/dist/lsp/parsed-documents.d.ts.map +1 -0
- package/dist/lsp/parsed-documents.js +47 -0
- package/dist/lsp/parsed-documents.js.map +1 -0
- package/dist/lsp/rename-worker.d.ts +2 -0
- package/dist/lsp/rename-worker.d.ts.map +1 -0
- package/dist/lsp/rename-worker.js +27 -0
- package/dist/lsp/rename-worker.js.map +1 -0
- package/dist/lsp/server.d.ts +78 -0
- package/dist/lsp/server.d.ts.map +1 -0
- package/dist/lsp/server.js +1098 -0
- package/dist/lsp/server.js.map +1 -0
- package/dist/lsp/thunk-pipeline.d.ts +4 -0
- package/dist/lsp/thunk-pipeline.d.ts.map +1 -0
- package/dist/lsp/thunk-pipeline.js +95 -0
- package/dist/lsp/thunk-pipeline.js.map +1 -0
- package/dist/lsp/validation.d.ts +8 -0
- package/dist/lsp/validation.d.ts.map +1 -0
- package/dist/lsp/validation.js +124 -0
- package/dist/lsp/validation.js.map +1 -0
- package/dist/lsp/workspace.d.ts +8 -0
- package/dist/lsp/workspace.d.ts.map +1 -0
- package/dist/lsp/workspace.js +70 -0
- package/dist/lsp/workspace.js.map +1 -0
- package/dist/math.ts +1 -0
- package/dist/parser/declarations.d.ts +21 -0
- package/dist/parser/declarations.d.ts.map +1 -0
- package/dist/parser/declarations.js +626 -0
- package/dist/parser/declarations.js.map +1 -0
- package/dist/parser/errors.d.ts +9 -0
- package/dist/parser/errors.d.ts.map +1 -0
- package/dist/parser/errors.js +11 -0
- package/dist/parser/errors.js.map +1 -0
- package/dist/parser/index.d.ts +9 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +9 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/jsx.d.ts +5 -0
- package/dist/parser/jsx.d.ts.map +1 -0
- package/dist/parser/jsx.js +188 -0
- package/dist/parser/jsx.js.map +1 -0
- package/dist/parser/operator-expressions.d.ts +16 -0
- package/dist/parser/operator-expressions.d.ts.map +1 -0
- package/dist/parser/operator-expressions.js +146 -0
- package/dist/parser/operator-expressions.js.map +1 -0
- package/dist/parser/parser.d.ts +104 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +1216 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/patterns.d.ts +9 -0
- package/dist/parser/patterns.d.ts.map +1 -0
- package/dist/parser/patterns.js +292 -0
- package/dist/parser/patterns.js.map +1 -0
- package/dist/parser/pipeline-expressions.d.ts +10 -0
- package/dist/parser/pipeline-expressions.d.ts.map +1 -0
- package/dist/parser/pipeline-expressions.js +57 -0
- package/dist/parser/pipeline-expressions.js.map +1 -0
- package/dist/parser/scope.d.ts +17 -0
- package/dist/parser/scope.d.ts.map +1 -0
- package/dist/parser/scope.js +56 -0
- package/dist/parser/scope.js.map +1 -0
- package/dist/parser/statements.d.ts +13 -0
- package/dist/parser/statements.d.ts.map +1 -0
- package/dist/parser/statements.js +737 -0
- package/dist/parser/statements.js.map +1 -0
- package/dist/parser/types.d.ts +13 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +371 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/plugins/bun-preload.d.ts +4 -0
- package/dist/plugins/bun-preload.d.ts.map +1 -0
- package/dist/plugins/bun-preload.js +18 -0
- package/dist/plugins/bun-preload.js.map +1 -0
- package/dist/plugins/bun.d.ts +115 -0
- package/dist/plugins/bun.d.ts.map +1 -0
- package/dist/plugins/bun.js +240 -0
- package/dist/plugins/bun.js.map +1 -0
- package/dist/plugins/esbuild.d.ts +45 -0
- package/dist/plugins/esbuild.d.ts.map +1 -0
- package/dist/plugins/esbuild.js +184 -0
- package/dist/plugins/esbuild.js.map +1 -0
- package/dist/plugins/type-view.d.ts +30 -0
- package/dist/plugins/type-view.d.ts.map +1 -0
- package/dist/plugins/type-view.js +245 -0
- package/dist/plugins/type-view.js.map +1 -0
- package/dist/plugins/vite.d.ts +56 -0
- package/dist/plugins/vite.d.ts.map +1 -0
- package/dist/plugins/vite.js +182 -0
- package/dist/plugins/vite.js.map +1 -0
- package/dist/service.ts +3 -0
- package/dist/service.ts.map +1 -0
- package/dist/testing/index.d.ts +24 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +56 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tooling/doc.d.ts +82 -0
- package/dist/tooling/doc.d.ts.map +1 -0
- package/dist/tooling/doc.js +624 -0
- package/dist/tooling/doc.js.map +1 -0
- package/dist/tooling/idiomatic.d.ts +20 -0
- package/dist/tooling/idiomatic.d.ts.map +1 -0
- package/dist/tooling/idiomatic.js +154 -0
- package/dist/tooling/idiomatic.js.map +1 -0
- package/dist/tooling/migrate.d.ts +62 -0
- package/dist/tooling/migrate.d.ts.map +1 -0
- package/dist/tooling/migrate.js +608 -0
- package/dist/tooling/migrate.js.map +1 -0
- package/dist/tooling/pipeline-style.d.ts +12 -0
- package/dist/tooling/pipeline-style.d.ts.map +1 -0
- package/dist/tooling/pipeline-style.js +208 -0
- package/dist/tooling/pipeline-style.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +25 -0
- package/dist/version.js.map +1 -0
- package/package.json +128 -4
- package/src/ast/types.ts +753 -0
- package/src/ast/walk.ts +35 -0
- package/src/cli/build-bun.ts +249 -0
- package/src/cli/build-watch.ts +299 -0
- package/src/cli/build.ts +450 -0
- package/src/cli/check.ts +342 -0
- package/src/cli/commands.ts +301 -0
- package/src/cli/doc.ts +81 -0
- package/src/cli/doctor.ts +173 -0
- package/src/cli/emit.ts +138 -0
- package/src/cli/explain.ts +127 -0
- package/src/cli/fmt.ts +170 -0
- package/src/cli/index.ts +227 -0
- package/src/cli/init.ts +491 -0
- package/src/cli/io.ts +150 -0
- package/src/cli/pipeline-style.ts +55 -0
- package/src/cli/repl.ts +443 -0
- package/src/cli/run.ts +238 -0
- package/src/cli/test.ts +148 -0
- package/src/cli/tsc.ts +207 -0
- package/src/cli/typecheck.ts +100 -0
- package/src/compiler/ast-inspection.ts +121 -0
- package/src/compiler/boolean-operators.ts +108 -0
- package/src/compiler/check.ts +2763 -0
- package/src/compiler/diagnostics.ts +179 -0
- package/src/compiler/effect-mutation-rule.ts +407 -0
- package/src/compiler/entry-rules.ts +116 -0
- package/src/compiler/incremental-build.ts +131 -0
- package/src/compiler/incremental-dependencies.ts +200 -0
- package/src/compiler/js-interop-nullability.ts +67 -0
- package/src/compiler/modules/output-collisions.ts +48 -0
- package/src/compiler/modules/output-plan.ts +46 -0
- package/src/compiler/modules/resolution.ts +56 -0
- package/src/compiler/numeric-comparisons.ts +213 -0
- package/src/compiler/optional-arguments.ts +335 -0
- package/src/compiler/package-fingerprint.ts +216 -0
- package/src/compiler/package-record-contracts.ts +156 -0
- package/src/compiler/pipelines/catalog.ts +1128 -0
- package/src/compiler/pipelines/companions.ts +1279 -0
- package/src/compiler/pipelines/resolution.ts +684 -0
- package/src/compiler/project-config.ts +221 -0
- package/src/compiler/record-contracts.ts +46 -0
- package/src/compiler/rules/control-flow.ts +57 -0
- package/src/compiler/rules/diagnostic.ts +11 -0
- package/src/compiler/rules/module-scope-refs.ts +63 -0
- package/src/compiler/schemas/analysis.ts +45 -0
- package/src/compiler/schemas/imported-record-functions.ts +984 -0
- package/src/compiler/schemas/imported-schemas.ts +761 -0
- package/src/compiler/source-map.ts +165 -0
- package/src/compiler/typescript-context.ts +250 -0
- package/src/compiler.ts +865 -0
- package/src/emitter/assemblyscript.ts +1220 -0
- package/src/emitter/declarations.ts +916 -0
- package/src/emitter/emitter.ts +3128 -0
- package/src/emitter/imports.ts +89 -0
- package/src/emitter/indent.ts +39 -0
- package/src/emitter/jsx.ts +122 -0
- package/src/emitter/local-bindings.ts +40 -0
- package/src/emitter/match.ts +1631 -0
- package/src/emitter/runtime-helpers.ts +31 -0
- package/src/emitter/schemas.ts +969 -0
- package/src/emitter/statements.ts +310 -0
- package/src/emitter/tagged-match.ts +171 -0
- package/src/emitter/types.ts +289 -0
- package/src/errors.ts +115 -0
- package/src/formatter/comments.ts +350 -0
- package/src/formatter/index.ts +1457 -0
- package/src/formatter/operator-precedence.ts +36 -0
- package/src/formatter/prettier.ts +61 -0
- package/src/index.ts +16 -0
- package/src/interop/callback.ts +188 -0
- package/src/interop/js.ts +66 -0
- package/src/interop/record.ts +36 -0
- package/src/interop/valibot.ts +141 -0
- package/src/interop/zod.ts +219 -0
- package/src/lexer/lexer.ts +1521 -0
- package/src/lexer/tokens.ts +174 -0
- package/src/lsp/code-action-worker.ts +31 -0
- package/src/lsp/completion.ts +343 -0
- package/src/lsp/definition.ts +1165 -0
- package/src/lsp/diagnostics-worker.ts +198 -0
- package/src/lsp/docs.ts +864 -0
- package/src/lsp/error-channel.ts +63 -0
- package/src/lsp/hover.ts +803 -0
- package/src/lsp/imports.ts +380 -0
- package/src/lsp/index.ts +55 -0
- package/src/lsp/inlay-hints.ts +308 -0
- package/src/lsp/interop-rename.ts +454 -0
- package/src/lsp/match-arms.ts +400 -0
- package/src/lsp/navigation.ts +553 -0
- package/src/lsp/parsed-documents.ts +64 -0
- package/src/lsp/rename-worker.ts +40 -0
- package/src/lsp/server.ts +1437 -0
- package/src/lsp/thunk-pipeline.ts +117 -0
- package/src/lsp/validation.ts +147 -0
- package/src/lsp/workspace.ts +74 -0
- package/src/parser/declarations.ts +808 -0
- package/src/parser/errors.ts +18 -0
- package/src/parser/jsx.ts +253 -0
- package/src/parser/operator-expressions.ts +170 -0
- package/src/parser/parser.ts +1565 -0
- package/src/parser/patterns.ts +342 -0
- package/src/parser/pipeline-expressions.ts +77 -0
- package/src/parser/scope.ts +69 -0
- package/src/parser/statements.ts +831 -0
- package/src/parser/types.ts +453 -0
- package/src/plugins/bun-preload.ts +25 -0
- package/src/plugins/bun.ts +448 -0
- package/src/plugins/esbuild.ts +308 -0
- package/src/plugins/type-view.ts +326 -0
- package/src/plugins/vite.ts +294 -0
- package/src/testing/index.ts +72 -0
- package/src/tooling/doc.ts +786 -0
- package/src/tooling/idiomatic.ts +202 -0
- package/src/tooling/pipeline-style.ts +248 -0
- package/src/version.ts +27 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { type Position, type Span } from "../ast/types.js";
|
|
2
|
+
|
|
3
|
+
export enum TokenType {
|
|
4
|
+
// Layout
|
|
5
|
+
INDENT = "INDENT",
|
|
6
|
+
DEDENT = "DEDENT",
|
|
7
|
+
NEWLINE = "NEWLINE",
|
|
8
|
+
EOF = "EOF",
|
|
9
|
+
|
|
10
|
+
// Literals
|
|
11
|
+
NUMBER = "NUMBER",
|
|
12
|
+
STRING = "STRING",
|
|
13
|
+
TS_CODE = "TS_CODE",
|
|
14
|
+
AS_CODE = "AS_CODE",
|
|
15
|
+
STRING_PART = "STRING_PART",
|
|
16
|
+
TEMPLATE_STRING = "TEMPLATE_STRING",
|
|
17
|
+
TEMPLATE_PART = "TEMPLATE_PART",
|
|
18
|
+
INTERPOLATION_START = "INTERPOLATION_START",
|
|
19
|
+
INTERPOLATION_END = "INTERPOLATION_END",
|
|
20
|
+
|
|
21
|
+
// Identifiers
|
|
22
|
+
IDENTIFIER = "IDENTIFIER",
|
|
23
|
+
UPPER_IDENTIFIER = "UPPER_IDENTIFIER",
|
|
24
|
+
|
|
25
|
+
// Keywords
|
|
26
|
+
AND = "and",
|
|
27
|
+
AS = "as",
|
|
28
|
+
DEFAULT = "default",
|
|
29
|
+
EFFECT = "effect",
|
|
30
|
+
ERROR = "error",
|
|
31
|
+
EXPORT = "export",
|
|
32
|
+
FALSE = "false",
|
|
33
|
+
FROM = "from",
|
|
34
|
+
IMPORT = "import",
|
|
35
|
+
JS = "js",
|
|
36
|
+
MATCH = "match",
|
|
37
|
+
CATCH = "catch",
|
|
38
|
+
MUT = "mut",
|
|
39
|
+
NOT = "not",
|
|
40
|
+
OR = "or",
|
|
41
|
+
PAR = "par",
|
|
42
|
+
SCHEMA = "schema",
|
|
43
|
+
SERVICE = "service",
|
|
44
|
+
TRUE = "true",
|
|
45
|
+
TS = "ts",
|
|
46
|
+
WHEN = "when",
|
|
47
|
+
|
|
48
|
+
// Operators & Delimiters
|
|
49
|
+
ARROW = "=>",
|
|
50
|
+
LARROW = "<-",
|
|
51
|
+
PIPE = "|>",
|
|
52
|
+
THUNK_PIPE = "|>>",
|
|
53
|
+
BAR = "|",
|
|
54
|
+
AMP = "&",
|
|
55
|
+
UNDERSCORE = "_",
|
|
56
|
+
TYPED_HOLE = "???",
|
|
57
|
+
QUESTION = "?",
|
|
58
|
+
EQ = "=",
|
|
59
|
+
VALUE_EQ = "#=",
|
|
60
|
+
VALUE_NEQ = "#!",
|
|
61
|
+
REF_EQ = "@=",
|
|
62
|
+
REF_NEQ = "@!",
|
|
63
|
+
PLUS = "+",
|
|
64
|
+
MINUS = "-",
|
|
65
|
+
STAR = "*",
|
|
66
|
+
SLASH = "/",
|
|
67
|
+
PERCENT = "%",
|
|
68
|
+
STARSTAR = "**",
|
|
69
|
+
COLON = ":",
|
|
70
|
+
COMMA = ",",
|
|
71
|
+
DOT = ".",
|
|
72
|
+
DOTDOTDOT = "...",
|
|
73
|
+
LPAREN = "(",
|
|
74
|
+
RPAREN = ")",
|
|
75
|
+
LBRACE = "{",
|
|
76
|
+
RBRACE = "}",
|
|
77
|
+
LBRACKET = "[",
|
|
78
|
+
RBRACKET = "]",
|
|
79
|
+
LT = "<",
|
|
80
|
+
GT = ">",
|
|
81
|
+
LTE = "<=",
|
|
82
|
+
GTE = ">=",
|
|
83
|
+
|
|
84
|
+
// JSX Tokens
|
|
85
|
+
JSX_TAG_OPEN = "JSX_TAG_OPEN",
|
|
86
|
+
JSX_TAG_CLOSE = "JSX_TAG_CLOSE",
|
|
87
|
+
JSX_SLASH_CLOSE = "JSX_SLASH_CLOSE",
|
|
88
|
+
JSX_CLOSING_TAG_OPEN = "JSX_CLOSING_TAG_OPEN",
|
|
89
|
+
JSX_ATTRIBUTE_NAME = "JSX_ATTRIBUTE_NAME",
|
|
90
|
+
JSX_TEXT = "JSX_TEXT",
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface Token {
|
|
94
|
+
type: TokenType;
|
|
95
|
+
value: string;
|
|
96
|
+
span: Span;
|
|
97
|
+
/** Start of the trimmed payload inside a verbatim block. */
|
|
98
|
+
contentStart?: Position;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const KEYWORDS: Record<string, TokenType> = {
|
|
102
|
+
and: TokenType.AND,
|
|
103
|
+
default: TokenType.DEFAULT,
|
|
104
|
+
effect: TokenType.EFFECT,
|
|
105
|
+
error: TokenType.ERROR,
|
|
106
|
+
export: TokenType.EXPORT,
|
|
107
|
+
false: TokenType.FALSE,
|
|
108
|
+
from: TokenType.FROM,
|
|
109
|
+
import: TokenType.IMPORT,
|
|
110
|
+
js: TokenType.JS,
|
|
111
|
+
match: TokenType.MATCH,
|
|
112
|
+
catch: TokenType.CATCH,
|
|
113
|
+
mut: TokenType.MUT,
|
|
114
|
+
not: TokenType.NOT,
|
|
115
|
+
or: TokenType.OR,
|
|
116
|
+
par: TokenType.PAR,
|
|
117
|
+
schema: TokenType.SCHEMA,
|
|
118
|
+
service: TokenType.SERVICE,
|
|
119
|
+
true: TokenType.TRUE,
|
|
120
|
+
ts: TokenType.TS,
|
|
121
|
+
when: TokenType.WHEN,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const BANNED_KEYWORDS: Record<string, string> = {
|
|
125
|
+
fn: "FunkScript functions use the arrow syntax: 'name = (args) => body'.",
|
|
126
|
+
extern:
|
|
127
|
+
"FunkScript has retired 'extern service'. Declare interfaces using 'service Name' and implement them in a Layer using 'js' for foreign calls.",
|
|
128
|
+
let: "FunkScript has no 'let'; use 'name = value' for immutable bindings, or 'mut name = value' for local mutable drafts.",
|
|
129
|
+
var: "FunkScript has no 'var'; use 'name = value' for immutable bindings, or 'mut name = value' for local mutable drafts.",
|
|
130
|
+
const: "FunkScript bindings are const by default; write 'name = value'.",
|
|
131
|
+
function: "FunkScript functions use the arrow syntax: '(args) => body'.",
|
|
132
|
+
class:
|
|
133
|
+
"FunkScript has no classes; use 'schema' for data, 'error' for errors, and 'service' for services.",
|
|
134
|
+
return:
|
|
135
|
+
"FunkScript uses '=> value' for explicit returns in function and effect blocks; replace 'return x' with '=> x'. See docs/syntax.md#311-explicit-returns-and-conditional-execution.",
|
|
136
|
+
throw:
|
|
137
|
+
"FunkScript has no 'throw'; recoverable failures use Effect typed errors, and defects use 'Effect.die' or '|> orDie'.",
|
|
138
|
+
try: "FunkScript has no 'try/catch'; use typed errors in the E channel or 'Effect.tryPromise'.",
|
|
139
|
+
finally:
|
|
140
|
+
"Use 'Effect.ensuring' or 'Effect.acquireRelease' for deterministic finalizers.",
|
|
141
|
+
async: "FunkScript has no 'async/await'; use 'effect' blocks with '<-'.",
|
|
142
|
+
await:
|
|
143
|
+
"FunkScript has no 'await'; execute effects inside 'effect' blocks using '<-'.",
|
|
144
|
+
null: "FunkScript has no 'null'; use Option.none() or Option<T> for optional values.",
|
|
145
|
+
undefined: "FunkScript has no 'undefined'; use Option<T> or explicit types.",
|
|
146
|
+
if: "FunkScript has no 'if'; use 'match' for both pattern matching and boolean branching.",
|
|
147
|
+
else: "FunkScript has no 'else'; use '| _ =>' in 'match'.",
|
|
148
|
+
switch: "FunkScript has no 'switch'; use 'match'.",
|
|
149
|
+
for: "FunkScript has no 'for' loops; use Array pipelines (map, filter) or Effect.forEach.",
|
|
150
|
+
while:
|
|
151
|
+
"FunkScript has no 'while' loops; use Effect.repeat, Schedule, or recursion.",
|
|
152
|
+
type: "FunkScript replaces 'type' with 'schema' (export schema Name = ...).",
|
|
153
|
+
data: "FunkScript uses 'schema' for all data modeling and tagged unions.",
|
|
154
|
+
interface: "FunkScript has no 'interface'; use 'schema' or 'service'.",
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const BANNED_SYMBOLS: Record<string, string> = {
|
|
158
|
+
"&&": "FunkScript logical AND is 'and'.",
|
|
159
|
+
"||": "FunkScript logical OR is 'or'.",
|
|
160
|
+
"!": "FunkScript logical NOT is 'not'.",
|
|
161
|
+
"==": "FunkScript equality uses '#=' for value equality or '@=' for reference identity.",
|
|
162
|
+
"!=": "FunkScript inequality uses '#!' for value inequality or '@!' for reference identity.",
|
|
163
|
+
"===": "FunkScript reference identity uses '@='.",
|
|
164
|
+
"!==": "FunkScript reference inequality uses '@!'.",
|
|
165
|
+
"??": "FunkScript has no nullish coalescing; model absence with Option instead.",
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// JSX token constants for direct imports
|
|
169
|
+
export const JsxTagOpen = TokenType.JSX_TAG_OPEN;
|
|
170
|
+
export const JsxTagClose = TokenType.JSX_TAG_CLOSE;
|
|
171
|
+
export const JsxSlashClose = TokenType.JSX_SLASH_CLOSE;
|
|
172
|
+
export const JsxClosingTagOpen = TokenType.JSX_CLOSING_TAG_OPEN;
|
|
173
|
+
export const JsxAttributeName = TokenType.JSX_ATTRIBUTE_NAME;
|
|
174
|
+
export const JsxText = TokenType.JSX_TEXT;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { parentPort } from "node:worker_threads";
|
|
2
|
+
import type {
|
|
3
|
+
CodeActionParams,
|
|
4
|
+
TextDocumentItem,
|
|
5
|
+
} from "vscode-languageserver/node";
|
|
6
|
+
import { FunScriptLspServer } from "./server.js";
|
|
7
|
+
|
|
8
|
+
const server = new FunScriptLspServer();
|
|
9
|
+
parentPort?.on(
|
|
10
|
+
"message",
|
|
11
|
+
({
|
|
12
|
+
id,
|
|
13
|
+
doc,
|
|
14
|
+
params,
|
|
15
|
+
}: {
|
|
16
|
+
id: number;
|
|
17
|
+
doc: TextDocumentItem;
|
|
18
|
+
params: CodeActionParams;
|
|
19
|
+
}) => {
|
|
20
|
+
try {
|
|
21
|
+
server.setRenameWorkerDocuments([doc]);
|
|
22
|
+
parentPort?.postMessage({
|
|
23
|
+
id,
|
|
24
|
+
result: server.onCodeActionHandler(params),
|
|
25
|
+
});
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error("code-action-worker failed:", error);
|
|
28
|
+
parentPort?.postMessage({ id, result: [] });
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
);
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CompletionItemKind,
|
|
3
|
+
type CompletionItem,
|
|
4
|
+
type Position,
|
|
5
|
+
type Range,
|
|
6
|
+
} from "vscode-languageserver/node";
|
|
7
|
+
import {
|
|
8
|
+
PIPELINE_COMPANION_CATALOG,
|
|
9
|
+
pipelineCompanionCandidates,
|
|
10
|
+
} from "../compiler/pipelines/catalog.js";
|
|
11
|
+
import { DOC_CATALOG, getAllDocKeywords } from "./docs.js";
|
|
12
|
+
|
|
13
|
+
export interface IndexedDocument {
|
|
14
|
+
uri: string;
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const PRIMARY_DISAMBIGUATION_MODULES = new Set([
|
|
19
|
+
"Array",
|
|
20
|
+
"Config",
|
|
21
|
+
"DateTime",
|
|
22
|
+
"Duration",
|
|
23
|
+
"Effect",
|
|
24
|
+
"HttpClientRequest",
|
|
25
|
+
"HttpServerResponse",
|
|
26
|
+
"Layer",
|
|
27
|
+
"Option",
|
|
28
|
+
"Record",
|
|
29
|
+
"Result",
|
|
30
|
+
"Schedule",
|
|
31
|
+
"Schema",
|
|
32
|
+
"Stream",
|
|
33
|
+
"String",
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const DEFERRED_PIPELINE_CONSTRUCTORS: ReadonlyArray<{
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly detail: string;
|
|
39
|
+
readonly documentation: string;
|
|
40
|
+
}> = [
|
|
41
|
+
{
|
|
42
|
+
name: "sync",
|
|
43
|
+
detail: "Deferred Effect.sync(() => expr)",
|
|
44
|
+
documentation:
|
|
45
|
+
"Wraps a synchronous expression in a lazy Effect thunk (`Effect<A>`).",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "try",
|
|
49
|
+
detail: "Deferred Effect.try(() => expr)",
|
|
50
|
+
documentation:
|
|
51
|
+
"Wraps a throwing synchronous expression in a lazy Effect (`Effect<A, UnknownException>`).",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "promise",
|
|
55
|
+
detail: "Deferred Effect.promise(() => expr)",
|
|
56
|
+
documentation:
|
|
57
|
+
"Wraps an infallible Promise-returning expression in a lazy Effect (`Effect<A>`).",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "tryPromise",
|
|
61
|
+
detail: "Deferred Effect.tryPromise(() => expr)",
|
|
62
|
+
documentation:
|
|
63
|
+
"Wraps a Promise-returning expression in a lazy Effect (`Effect<A, UnknownException>`).",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "suspend",
|
|
67
|
+
detail: "Deferred Effect.suspend(() => expr)",
|
|
68
|
+
documentation:
|
|
69
|
+
"Lazily evaluates and flattens an Effect-returning expression (`Effect<A, E, R>`).",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "failSync",
|
|
73
|
+
detail: "Deferred Effect.failSync(() => expr)",
|
|
74
|
+
documentation:
|
|
75
|
+
"Lazily computes an error value and fails on the Effect error channel (`Effect<never, E>`).",
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
function escapeRegExp(value: string): string {
|
|
80
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Builds completion candidates from the current open workspace snapshot. */
|
|
84
|
+
export function complete(
|
|
85
|
+
source: string,
|
|
86
|
+
uri: string,
|
|
87
|
+
position: Position,
|
|
88
|
+
documents: IndexedDocument[],
|
|
89
|
+
pipelineAnalysis?: { source: string; inputs: Array<[number, string]> },
|
|
90
|
+
): CompletionItem[] {
|
|
91
|
+
const lines = source.split("\n");
|
|
92
|
+
const line = lines[position.line] ?? "";
|
|
93
|
+
const before = line.slice(0, position.character);
|
|
94
|
+
const priorSource =
|
|
95
|
+
lines.slice(0, position.line).join("\n") +
|
|
96
|
+
(position.line > 0 ? "\n" : "") +
|
|
97
|
+
before;
|
|
98
|
+
const match = before.match(/[\w$.-]*$/);
|
|
99
|
+
const typedPrefix = match?.[0] ?? "";
|
|
100
|
+
const member = /([A-Za-z_$][\w$]*)\.$/.exec(before)?.[1];
|
|
101
|
+
const prefix = member ? "" : typedPrefix;
|
|
102
|
+
const start = position.character - (member ? 0 : prefix.length);
|
|
103
|
+
const range: Range = {
|
|
104
|
+
start: { line: position.line, character: start },
|
|
105
|
+
end: position,
|
|
106
|
+
};
|
|
107
|
+
const items = new Map<string, CompletionItem>();
|
|
108
|
+
const add = (
|
|
109
|
+
label: string,
|
|
110
|
+
kind: CompletionItemKind,
|
|
111
|
+
detail: string,
|
|
112
|
+
documentation?: string,
|
|
113
|
+
) => {
|
|
114
|
+
if (prefix && !label.toLowerCase().startsWith(prefix.toLowerCase())) return;
|
|
115
|
+
if (label === member) return;
|
|
116
|
+
items.set(label, {
|
|
117
|
+
label,
|
|
118
|
+
kind,
|
|
119
|
+
detail,
|
|
120
|
+
...(documentation ? { documentation } : {}),
|
|
121
|
+
textEdit: { range, newText: label },
|
|
122
|
+
sortText: label.toLowerCase(),
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
if (member) {
|
|
127
|
+
const escapedMember = escapeRegExp(member);
|
|
128
|
+
const schema = new RegExp(
|
|
129
|
+
`(?:schema\\s+)?${escapedMember}\\s*=\\s*\\{([\\s\\S]*?)\\n\\}`,
|
|
130
|
+
"m",
|
|
131
|
+
).exec(source);
|
|
132
|
+
if (schema)
|
|
133
|
+
for (const field of schema[1].matchAll(
|
|
134
|
+
/^\s*([A-Za-z_$][\w$]*)\s*:\s*([^,\n}]+)/gm,
|
|
135
|
+
))
|
|
136
|
+
add(field[1], CompletionItemKind.Field, field[2].trim());
|
|
137
|
+
const variants = new RegExp(
|
|
138
|
+
`schema\\s+${escapedMember}\\s*=([\\s\\S]*?)(?:\\n\\S|$)`,
|
|
139
|
+
"m",
|
|
140
|
+
).exec(source);
|
|
141
|
+
if (variants)
|
|
142
|
+
for (const variant of variants[1].matchAll(/\|\s*([A-Z][A-Za-z0-9_$]*)/g))
|
|
143
|
+
add(variant[1], CompletionItemKind.EnumMember, `${member} variant`);
|
|
144
|
+
if (member === "Effect")
|
|
145
|
+
for (const key of getAllDocKeywords().filter((key) =>
|
|
146
|
+
key.startsWith("Effect."),
|
|
147
|
+
)) {
|
|
148
|
+
const doc = DOC_CATALOG[key];
|
|
149
|
+
add(
|
|
150
|
+
key.slice(7),
|
|
151
|
+
CompletionItemKind.Function,
|
|
152
|
+
doc.signature,
|
|
153
|
+
doc.summary,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
const visible = new Set<string>();
|
|
158
|
+
for (const doc of documents) {
|
|
159
|
+
if (doc.uri === uri) {
|
|
160
|
+
for (const found of priorSource.matchAll(
|
|
161
|
+
/^\s*(?!export\s)(?:mut\s+)?([a-z_$][\w$]*)\s*(?:=|:)/gm,
|
|
162
|
+
))
|
|
163
|
+
visible.add(found[1]);
|
|
164
|
+
for (const found of doc.text.matchAll(
|
|
165
|
+
/^\s*export\s+(?:(?:schema|error|service)\s+)?([A-Za-z_$][\w$]*)\s*(?:=|\(|:)/gm,
|
|
166
|
+
))
|
|
167
|
+
visible.add(found[1]);
|
|
168
|
+
for (const found of doc.text.matchAll(
|
|
169
|
+
/\b(?:export\s+)?(?:schema|error|service)\s+([A-Z][\w$]*)/g,
|
|
170
|
+
))
|
|
171
|
+
visible.add(found[1]);
|
|
172
|
+
} else {
|
|
173
|
+
const base = doc.uri
|
|
174
|
+
.replace(/\.(funx?|tsx?)$/, "")
|
|
175
|
+
.split(/[\\/]/)
|
|
176
|
+
.pop();
|
|
177
|
+
if (
|
|
178
|
+
base &&
|
|
179
|
+
new RegExp(
|
|
180
|
+
`from\\s+["'][^"']*${escapeRegExp(base)}(?:\\.(?:funx?|tsx?))?["']`,
|
|
181
|
+
).test(source)
|
|
182
|
+
) {
|
|
183
|
+
for (const found of doc.text.matchAll(
|
|
184
|
+
/^\s*export\s+(?:(?:schema|error|service)\s+)?([A-Za-z_$][\w$]*)/gm,
|
|
185
|
+
))
|
|
186
|
+
visible.add(found[1]);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const deferredPipelineContext = /\|>>\s*(?:[\w.]*)$/.test(before);
|
|
191
|
+
const pipelineContext =
|
|
192
|
+
!deferredPipelineContext && /\|>\s*(?:[\w.]*)$/.test(before);
|
|
193
|
+
const jsxContext = /<\s*[A-Za-z_$\w]*$/.test(before);
|
|
194
|
+
if (!deferredPipelineContext) {
|
|
195
|
+
for (const name of visible)
|
|
196
|
+
add(name, CompletionItemKind.Variable, "Workspace symbol");
|
|
197
|
+
add("Effect", CompletionItemKind.Module, "Effect API namespace");
|
|
198
|
+
for (const [name, doc] of Object.entries(DOC_CATALOG)) {
|
|
199
|
+
if (doc.category === "effect" && !pipelineContext) continue;
|
|
200
|
+
add(
|
|
201
|
+
name,
|
|
202
|
+
doc.category === "keyword"
|
|
203
|
+
? CompletionItemKind.Keyword
|
|
204
|
+
: doc.category === "effect"
|
|
205
|
+
? CompletionItemKind.Function
|
|
206
|
+
: CompletionItemKind.Class,
|
|
207
|
+
doc.signature,
|
|
208
|
+
doc.summary,
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (deferredPipelineContext) {
|
|
213
|
+
for (const ctor of DEFERRED_PIPELINE_CONSTRUCTORS) {
|
|
214
|
+
const label = typedPrefix.startsWith("Effect.")
|
|
215
|
+
? `Effect.${ctor.name}`
|
|
216
|
+
: ctor.name;
|
|
217
|
+
if (
|
|
218
|
+
typedPrefix &&
|
|
219
|
+
!label.toLowerCase().startsWith(typedPrefix.toLowerCase())
|
|
220
|
+
)
|
|
221
|
+
continue;
|
|
222
|
+
items.set(label, {
|
|
223
|
+
label,
|
|
224
|
+
kind: CompletionItemKind.Function,
|
|
225
|
+
detail: ctor.detail,
|
|
226
|
+
documentation: ctor.documentation,
|
|
227
|
+
textEdit: { range, newText: label },
|
|
228
|
+
sortText: `0-${label.toLowerCase()}`,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (pipelineContext) {
|
|
233
|
+
const pipeOffset = priorSource.lastIndexOf("|>");
|
|
234
|
+
const cachedPrefixMatches =
|
|
235
|
+
pipelineAnalysis &&
|
|
236
|
+
pipeOffset >= 0 &&
|
|
237
|
+
pipelineAnalysis.source.slice(0, pipeOffset).trimEnd() ===
|
|
238
|
+
priorSource.slice(0, pipeOffset).trimEnd();
|
|
239
|
+
let inputCompanion: string | undefined;
|
|
240
|
+
if (cachedPrefixMatches) {
|
|
241
|
+
const cachedPipe = pipelineAnalysis.source.indexOf("|>", pipeOffset);
|
|
242
|
+
let stageOffset = cachedPipe + 2;
|
|
243
|
+
while (/\s/.test(pipelineAnalysis.source[stageOffset] ?? ""))
|
|
244
|
+
stageOffset++;
|
|
245
|
+
inputCompanion = pipelineAnalysis.inputs.find(
|
|
246
|
+
([offset]) => offset === stageOffset,
|
|
247
|
+
)?.[1];
|
|
248
|
+
}
|
|
249
|
+
if (inputCompanion && inputCompanion in PIPELINE_COMPANION_CATALOG) {
|
|
250
|
+
for (const operation of PIPELINE_COMPANION_CATALOG[
|
|
251
|
+
inputCompanion as keyof typeof PIPELINE_COMPANION_CATALOG
|
|
252
|
+
]) {
|
|
253
|
+
if (
|
|
254
|
+
typedPrefix &&
|
|
255
|
+
!operation.toLowerCase().startsWith(typedPrefix.toLowerCase())
|
|
256
|
+
)
|
|
257
|
+
continue;
|
|
258
|
+
const doc = DOC_CATALOG[`${inputCompanion}.${operation}`];
|
|
259
|
+
items.set(operation, {
|
|
260
|
+
label: operation,
|
|
261
|
+
kind: CompletionItemKind.Function,
|
|
262
|
+
detail: doc
|
|
263
|
+
? `${inputCompanion} pipeline operation — ${doc.signature}`
|
|
264
|
+
: `${inputCompanion} pipeline operation`,
|
|
265
|
+
documentation: doc
|
|
266
|
+
? `${doc.summary}\n\nSelected from pipeline input type (${inputCompanion}); compiles to \`${inputCompanion}.${operation}\`.`
|
|
267
|
+
: `Selected from the pipeline input type (${inputCompanion}); compiles to \`${inputCompanion}.${operation}\`.`,
|
|
268
|
+
textEdit: { range, newText: operation },
|
|
269
|
+
sortText: `0-${operation.toLowerCase()}`,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
const operations = new Set(
|
|
274
|
+
Object.values(PIPELINE_COMPANION_CATALOG).flat(),
|
|
275
|
+
);
|
|
276
|
+
for (const operation of operations) {
|
|
277
|
+
if (
|
|
278
|
+
typedPrefix &&
|
|
279
|
+
!operation.toLowerCase().startsWith(typedPrefix.toLowerCase())
|
|
280
|
+
)
|
|
281
|
+
continue;
|
|
282
|
+
const candidates = pipelineCompanionCandidates(operation);
|
|
283
|
+
if (candidates.length === 1) {
|
|
284
|
+
const module = candidates[0];
|
|
285
|
+
items.set(operation, {
|
|
286
|
+
label: operation,
|
|
287
|
+
kind: CompletionItemKind.Function,
|
|
288
|
+
detail: `${module} pipeline operation`,
|
|
289
|
+
documentation: `Unambiguous bare pipeline stage; compiles to \`${module}.${operation}\`.`,
|
|
290
|
+
textEdit: { range, newText: operation },
|
|
291
|
+
sortText: `0-${operation.toLowerCase()}`,
|
|
292
|
+
});
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (candidates.length < 2) continue;
|
|
296
|
+
for (const module of candidates) {
|
|
297
|
+
const label = `${module}.${operation}`;
|
|
298
|
+
if (!typedPrefix && !PRIMARY_DISAMBIGUATION_MODULES.has(module))
|
|
299
|
+
continue;
|
|
300
|
+
if (
|
|
301
|
+
typedPrefix &&
|
|
302
|
+
!label.toLowerCase().startsWith(typedPrefix.toLowerCase()) &&
|
|
303
|
+
!operation.toLowerCase().startsWith(typedPrefix.toLowerCase())
|
|
304
|
+
)
|
|
305
|
+
continue;
|
|
306
|
+
items.set(label, {
|
|
307
|
+
label,
|
|
308
|
+
kind: CompletionItemKind.Function,
|
|
309
|
+
detail: `Explicit pipeline stage — ${operation} is shared by ${candidates.join(", ")}`,
|
|
310
|
+
documentation: `Use \`${label}(...)\` to avoid an ambiguous bare pipeline stage.`,
|
|
311
|
+
textEdit: { range, newText: label },
|
|
312
|
+
sortText: `0-${label.toLowerCase()}`,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (/\.funx?$/.test(uri) && jsxContext)
|
|
319
|
+
for (const tag of [
|
|
320
|
+
"div",
|
|
321
|
+
"span",
|
|
322
|
+
"button",
|
|
323
|
+
"input",
|
|
324
|
+
"form",
|
|
325
|
+
"main",
|
|
326
|
+
"section",
|
|
327
|
+
"header",
|
|
328
|
+
"footer",
|
|
329
|
+
"ul",
|
|
330
|
+
"li",
|
|
331
|
+
"a",
|
|
332
|
+
"p",
|
|
333
|
+
"h1",
|
|
334
|
+
"h2",
|
|
335
|
+
])
|
|
336
|
+
add(tag, CompletionItemKind.Property, "JSX element");
|
|
337
|
+
}
|
|
338
|
+
return [...items.values()].sort(
|
|
339
|
+
(a, b) =>
|
|
340
|
+
String(a.sortText).localeCompare(String(b.sortText)) ||
|
|
341
|
+
a.label.localeCompare(b.label),
|
|
342
|
+
);
|
|
343
|
+
}
|