spark-sql-language-server 0.0.1-beta.6 → 0.2.0-beta.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/out/sparksql-server-worker.js +1 -1
- package/out/sparksql-server-worker.js.map +1 -1
- package/out-tsc/assets/built-in-functions.d.ts +2 -0
- package/out-tsc/assets/built-in-functions.d.ts.map +1 -0
- package/out-tsc/assets/built-in-functions.js +4 -2
- package/out-tsc/assets/built-in-functions.js.map +1 -1
- package/out-tsc/completion-parser.d.ts +11 -0
- package/out-tsc/completion-parser.d.ts.map +1 -0
- package/out-tsc/completion-parser.js +148 -0
- package/out-tsc/completion-parser.js.map +1 -0
- package/out-tsc/constants.d.ts +9 -0
- package/out-tsc/constants.d.ts.map +1 -0
- package/out-tsc/constants.js +12 -0
- package/out-tsc/constants.js.map +1 -0
- package/out-tsc/cursor.d.ts +10 -0
- package/out-tsc/cursor.d.ts.map +1 -0
- package/out-tsc/cursor.js +3 -0
- package/out-tsc/cursor.js.map +1 -1
- package/out-tsc/execute-command.d.ts +7 -0
- package/out-tsc/execute-command.d.ts.map +1 -0
- package/out-tsc/execute-command.js +78 -0
- package/out-tsc/execute-command.js.map +1 -0
- package/out-tsc/execute-commands.d.ts +1 -0
- package/out-tsc/execute-commands.d.ts.map +1 -0
- package/out-tsc/execute-commands.js +3 -4
- package/out-tsc/execute-commands.js.map +1 -1
- package/out-tsc/formatter/boundary-writer.d.ts +30 -0
- package/out-tsc/formatter/boundary-writer.d.ts.map +1 -0
- package/out-tsc/formatter/boundary-writer.js +47 -0
- package/out-tsc/formatter/boundary-writer.js.map +1 -0
- package/out-tsc/formatter/core/comment-helper.d.ts +11 -0
- package/out-tsc/formatter/core/comment-helper.d.ts.map +1 -0
- package/out-tsc/formatter/core/comment-helper.js +139 -0
- package/out-tsc/formatter/core/comment-helper.js.map +1 -0
- package/out-tsc/formatter/core/edit-collector.d.ts +110 -0
- package/out-tsc/formatter/core/edit-collector.d.ts.map +1 -0
- package/out-tsc/formatter/core/edit-collector.js +159 -0
- package/out-tsc/formatter/core/edit-collector.js.map +1 -0
- package/out-tsc/formatter/core/formatting-context.d.ts +183 -0
- package/out-tsc/formatter/core/formatting-context.d.ts.map +1 -0
- package/out-tsc/formatter/core/formatting-context.js +294 -0
- package/out-tsc/formatter/core/formatting-context.js.map +1 -0
- package/out-tsc/formatter/core/index.d.ts +25 -0
- package/out-tsc/formatter/core/index.d.ts.map +1 -0
- package/out-tsc/formatter/core/index.js +57 -0
- package/out-tsc/formatter/core/index.js.map +1 -0
- package/out-tsc/formatter/core/pipeline/formatting-pipeline.d.ts +116 -0
- package/out-tsc/formatter/core/pipeline/formatting-pipeline.d.ts.map +1 -0
- package/out-tsc/formatter/core/pipeline/formatting-pipeline.js +237 -0
- package/out-tsc/formatter/core/pipeline/formatting-pipeline.js.map +1 -0
- package/out-tsc/formatter/core/pipeline/index.d.ts +12 -0
- package/out-tsc/formatter/core/pipeline/index.d.ts.map +1 -0
- package/out-tsc/formatter/core/pipeline/index.js +19 -0
- package/out-tsc/formatter/core/pipeline/index.js.map +1 -0
- package/out-tsc/formatter/core/pipeline/statement-separation.d.ts +5 -0
- package/out-tsc/formatter/core/pipeline/statement-separation.d.ts.map +1 -0
- package/out-tsc/formatter/core/pipeline/statement-separation.js +149 -0
- package/out-tsc/formatter/core/pipeline/statement-separation.js.map +1 -0
- package/out-tsc/formatter/core/rules/index.d.ts +11 -0
- package/out-tsc/formatter/core/rules/index.d.ts.map +1 -0
- package/out-tsc/formatter/core/rules/index.js +29 -0
- package/out-tsc/formatter/core/rules/index.js.map +1 -0
- package/out-tsc/formatter/core/rules/newline-rules.d.ts +169 -0
- package/out-tsc/formatter/core/rules/newline-rules.d.ts.map +1 -0
- package/out-tsc/formatter/core/rules/newline-rules.js +246 -0
- package/out-tsc/formatter/core/rules/newline-rules.js.map +1 -0
- package/out-tsc/formatter/core/rules/spacing-rules.d.ts +150 -0
- package/out-tsc/formatter/core/rules/spacing-rules.d.ts.map +1 -0
- package/out-tsc/formatter/core/rules/spacing-rules.js +219 -0
- package/out-tsc/formatter/core/rules/spacing-rules.js.map +1 -0
- package/out-tsc/formatter/core/strategy-bridge.d.ts +56 -0
- package/out-tsc/formatter/core/strategy-bridge.d.ts.map +1 -0
- package/out-tsc/formatter/core/strategy-bridge.js +159 -0
- package/out-tsc/formatter/core/strategy-bridge.js.map +1 -0
- package/out-tsc/formatter/core/strategy-interface.d.ts +123 -0
- package/out-tsc/formatter/core/strategy-interface.d.ts.map +1 -0
- package/out-tsc/formatter/core/strategy-interface.js +83 -0
- package/out-tsc/formatter/core/strategy-interface.js.map +1 -0
- package/out-tsc/formatter/core/token-helper.d.ts +12 -0
- package/out-tsc/formatter/core/token-helper.d.ts.map +1 -0
- package/out-tsc/formatter/core/token-helper.js +79 -0
- package/out-tsc/formatter/core/token-helper.js.map +1 -0
- package/out-tsc/formatter/core/unicode-utils.d.ts +107 -0
- package/out-tsc/formatter/core/unicode-utils.d.ts.map +1 -0
- package/out-tsc/formatter/core/unicode-utils.js +181 -0
- package/out-tsc/formatter/core/unicode-utils.js.map +1 -0
- package/out-tsc/formatter/core/whitespace-writer.d.ts +20 -0
- package/out-tsc/formatter/core/whitespace-writer.d.ts.map +1 -0
- package/out-tsc/formatter/core/whitespace-writer.js +86 -0
- package/out-tsc/formatter/core/whitespace-writer.js.map +1 -0
- package/out-tsc/formatter/formatter-adapter.d.ts +56 -0
- package/out-tsc/formatter/formatter-adapter.d.ts.map +1 -0
- package/out-tsc/formatter/formatter-adapter.js +719 -0
- package/out-tsc/formatter/formatter-adapter.js.map +1 -0
- package/out-tsc/formatter/index.d.ts +16 -0
- package/out-tsc/formatter/index.d.ts.map +1 -0
- package/out-tsc/formatter/index.js +43 -0
- package/out-tsc/formatter/index.js.map +1 -0
- package/out-tsc/formatter/pipe-step-classifier.d.ts +9 -0
- package/out-tsc/formatter/pipe-step-classifier.d.ts.map +1 -0
- package/out-tsc/formatter/pipe-step-classifier.js +49 -0
- package/out-tsc/formatter/pipe-step-classifier.js.map +1 -0
- package/out-tsc/formatter/state.d.ts +10 -0
- package/out-tsc/formatter/state.d.ts.map +1 -0
- package/out-tsc/formatter/state.js +12 -0
- package/out-tsc/formatter/state.js.map +1 -0
- package/out-tsc/formatter/strategies/block.strategy.d.ts +191 -0
- package/out-tsc/formatter/strategies/block.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/block.strategy.js +238 -0
- package/out-tsc/formatter/strategies/block.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/clause-head-body.strategy.d.ts +17 -0
- package/out-tsc/formatter/strategies/clause-head-body.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/clause-head-body.strategy.js +13 -0
- package/out-tsc/formatter/strategies/clause-head-body.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/alter-table-extended.strategy.d.ts +68 -0
- package/out-tsc/formatter/strategies/ddl/alter-table-extended.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/alter-table-extended.strategy.js +242 -0
- package/out-tsc/formatter/strategies/ddl/alter-table-extended.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/alter-table.strategy.d.ts +146 -0
- package/out-tsc/formatter/strategies/ddl/alter-table.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/alter-table.strategy.js +578 -0
- package/out-tsc/formatter/strategies/ddl/alter-table.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/create-table.strategy.d.ts +103 -0
- package/out-tsc/formatter/strategies/ddl/create-table.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/create-table.strategy.js +659 -0
- package/out-tsc/formatter/strategies/ddl/create-table.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/create-view-function.strategy.d.ts +64 -0
- package/out-tsc/formatter/strategies/ddl/create-view-function.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/create-view-function.strategy.js +402 -0
- package/out-tsc/formatter/strategies/ddl/create-view-function.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/drop-utility.strategy.d.ts +119 -0
- package/out-tsc/formatter/strategies/ddl/drop-utility.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/drop-utility.strategy.js +863 -0
- package/out-tsc/formatter/strategies/ddl/drop-utility.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/index.d.ts +17 -0
- package/out-tsc/formatter/strategies/ddl/index.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/index.js +57 -0
- package/out-tsc/formatter/strategies/ddl/index.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/namespace-catalog.strategy.d.ts +26 -0
- package/out-tsc/formatter/strategies/ddl/namespace-catalog.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/namespace-catalog.strategy.js +77 -0
- package/out-tsc/formatter/strategies/ddl/namespace-catalog.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/pipeline.strategy.d.ts +99 -0
- package/out-tsc/formatter/strategies/ddl/pipeline.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/pipeline.strategy.js +385 -0
- package/out-tsc/formatter/strategies/ddl/pipeline.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/set-reset-config.strategy.d.ts +48 -0
- package/out-tsc/formatter/strategies/ddl/set-reset-config.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/set-reset-config.strategy.js +145 -0
- package/out-tsc/formatter/strategies/ddl/set-reset-config.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/ddl/show-utility.strategy.d.ts +71 -0
- package/out-tsc/formatter/strategies/ddl/show-utility.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/ddl/show-utility.strategy.js +196 -0
- package/out-tsc/formatter/strategies/ddl/show-utility.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/dml/index.d.ts +10 -0
- package/out-tsc/formatter/strategies/dml/index.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/dml/index.js +35 -0
- package/out-tsc/formatter/strategies/dml/index.js.map +1 -0
- package/out-tsc/formatter/strategies/dml/insert-update-delete.strategy.d.ts +113 -0
- package/out-tsc/formatter/strategies/dml/insert-update-delete.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/dml/insert-update-delete.strategy.js +438 -0
- package/out-tsc/formatter/strategies/dml/insert-update-delete.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/dml/select-clause.strategy.d.ts +76 -0
- package/out-tsc/formatter/strategies/dml/select-clause.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/dml/select-clause.strategy.js +480 -0
- package/out-tsc/formatter/strategies/dml/select-clause.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/expression/function-call.strategy.d.ts +50 -0
- package/out-tsc/formatter/strategies/expression/function-call.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/expression/function-call.strategy.js +319 -0
- package/out-tsc/formatter/strategies/expression/function-call.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/expression/index.d.ts +18 -0
- package/out-tsc/formatter/strategies/expression/index.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/expression/index.js +51 -0
- package/out-tsc/formatter/strategies/expression/index.js.map +1 -0
- package/out-tsc/formatter/strategies/expression/logical-comparison.strategy.d.ts +55 -0
- package/out-tsc/formatter/strategies/expression/logical-comparison.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/expression/logical-comparison.strategy.js +266 -0
- package/out-tsc/formatter/strategies/expression/logical-comparison.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/expression/subquery-parenthesis.strategy.d.ts +38 -0
- package/out-tsc/formatter/strategies/expression/subquery-parenthesis.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/expression/subquery-parenthesis.strategy.js +397 -0
- package/out-tsc/formatter/strategies/expression/subquery-parenthesis.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/function-call.strategy.d.ts +80 -0
- package/out-tsc/formatter/strategies/function-call.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/function-call.strategy.js +136 -0
- package/out-tsc/formatter/strategies/function-call.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/index.d.ts +87 -0
- package/out-tsc/formatter/strategies/index.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/index.js +121 -0
- package/out-tsc/formatter/strategies/index.js.map +1 -0
- package/out-tsc/formatter/strategies/join.strategy.d.ts +31 -0
- package/out-tsc/formatter/strategies/join.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/join.strategy.js +29 -0
- package/out-tsc/formatter/strategies/join.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/keyword.strategy.d.ts +82 -0
- package/out-tsc/formatter/strategies/keyword.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/keyword.strategy.js +129 -0
- package/out-tsc/formatter/strategies/keyword.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/list.strategy.d.ts +159 -0
- package/out-tsc/formatter/strategies/list.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/list.strategy.js +193 -0
- package/out-tsc/formatter/strategies/list.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-aggregate.strategy.d.ts +24 -0
- package/out-tsc/formatter/strategies/pipe-aggregate.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-aggregate.strategy.js +47 -0
- package/out-tsc/formatter/strategies/pipe-aggregate.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-drop.strategy.d.ts +21 -0
- package/out-tsc/formatter/strategies/pipe-drop.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-drop.strategy.js +52 -0
- package/out-tsc/formatter/strategies/pipe-drop.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-extend.strategy.d.ts +21 -0
- package/out-tsc/formatter/strategies/pipe-extend.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-extend.strategy.js +45 -0
- package/out-tsc/formatter/strategies/pipe-extend.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-join.strategy.d.ts +22 -0
- package/out-tsc/formatter/strategies/pipe-join.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-join.strategy.js +42 -0
- package/out-tsc/formatter/strategies/pipe-join.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-pivot.strategy.d.ts +7 -0
- package/out-tsc/formatter/strategies/pipe-pivot.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-pivot.strategy.js +34 -0
- package/out-tsc/formatter/strategies/pipe-pivot.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-query-organization.strategy.d.ts +7 -0
- package/out-tsc/formatter/strategies/pipe-query-organization.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-query-organization.strategy.js +14 -0
- package/out-tsc/formatter/strategies/pipe-query-organization.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-sample.strategy.d.ts +7 -0
- package/out-tsc/formatter/strategies/pipe-sample.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-sample.strategy.js +18 -0
- package/out-tsc/formatter/strategies/pipe-sample.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-select.strategy.d.ts +22 -0
- package/out-tsc/formatter/strategies/pipe-select.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-select.strategy.js +51 -0
- package/out-tsc/formatter/strategies/pipe-select.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-set-operation.strategy.d.ts +7 -0
- package/out-tsc/formatter/strategies/pipe-set-operation.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-set-operation.strategy.js +30 -0
- package/out-tsc/formatter/strategies/pipe-set-operation.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-set.strategy.d.ts +21 -0
- package/out-tsc/formatter/strategies/pipe-set.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-set.strategy.js +52 -0
- package/out-tsc/formatter/strategies/pipe-set.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-step.strategy.d.ts +25 -0
- package/out-tsc/formatter/strategies/pipe-step.strategy.d.ts.map +1 -0
- package/out-tsc/{lib/SparkSqlParserVisitor.js → formatter/strategies/pipe-step.strategy.js} +1 -1
- package/out-tsc/formatter/strategies/pipe-step.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-unpivot.strategy.d.ts +7 -0
- package/out-tsc/formatter/strategies/pipe-unpivot.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-unpivot.strategy.js +33 -0
- package/out-tsc/formatter/strategies/pipe-unpivot.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/pipe-where.strategy.d.ts +21 -0
- package/out-tsc/formatter/strategies/pipe-where.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/pipe-where.strategy.js +44 -0
- package/out-tsc/formatter/strategies/pipe-where.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/procedure/case-statement.strategy.d.ts +20 -0
- package/out-tsc/formatter/strategies/procedure/case-statement.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/procedure/case-statement.strategy.js +132 -0
- package/out-tsc/formatter/strategies/procedure/case-statement.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/procedure/compound-statement.strategy.d.ts +43 -0
- package/out-tsc/formatter/strategies/procedure/compound-statement.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/procedure/compound-statement.strategy.js +174 -0
- package/out-tsc/formatter/strategies/procedure/compound-statement.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/procedure/handler.strategy.d.ts +23 -0
- package/out-tsc/formatter/strategies/procedure/handler.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/procedure/handler.strategy.js +81 -0
- package/out-tsc/formatter/strategies/procedure/handler.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/procedure/if-else.strategy.d.ts +19 -0
- package/out-tsc/formatter/strategies/procedure/if-else.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/procedure/if-else.strategy.js +80 -0
- package/out-tsc/formatter/strategies/procedure/if-else.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/procedure/index.d.ts +27 -0
- package/out-tsc/formatter/strategies/procedure/index.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/procedure/index.js +63 -0
- package/out-tsc/formatter/strategies/procedure/index.js.map +1 -0
- package/out-tsc/formatter/strategies/procedure/leave-iterate.strategy.d.ts +19 -0
- package/out-tsc/formatter/strategies/procedure/leave-iterate.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/procedure/leave-iterate.strategy.js +54 -0
- package/out-tsc/formatter/strategies/procedure/leave-iterate.strategy.js.map +1 -0
- package/out-tsc/formatter/strategies/procedure/loop.strategy.d.ts +71 -0
- package/out-tsc/formatter/strategies/procedure/loop.strategy.d.ts.map +1 -0
- package/out-tsc/formatter/strategies/procedure/loop.strategy.js +216 -0
- package/out-tsc/formatter/strategies/procedure/loop.strategy.js.map +1 -0
- package/out-tsc/formatter/strategy-based-formatter.d.ts +329 -0
- package/out-tsc/formatter/strategy-based-formatter.d.ts.map +1 -0
- package/out-tsc/formatter/strategy-based-formatter.js +3808 -0
- package/out-tsc/formatter/strategy-based-formatter.js.map +1 -0
- package/out-tsc/formatter/strategy-dispatcher.d.ts +24 -0
- package/out-tsc/formatter/strategy-dispatcher.d.ts.map +1 -0
- package/out-tsc/formatter/strategy-dispatcher.js +19 -0
- package/out-tsc/formatter/strategy-dispatcher.js.map +1 -0
- package/out-tsc/formatter/types.d.ts +2 -0
- package/out-tsc/formatter/types.d.ts.map +1 -0
- package/out-tsc/{lib/SparkSqlParserListener.js → formatter/types.js} +1 -1
- package/out-tsc/formatter/types.js.map +1 -0
- package/out-tsc/formatter/visitor/ddl/alter-table.d.ts +48 -0
- package/out-tsc/formatter/visitor/ddl/alter-table.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/ddl/alter-table.js +133 -0
- package/out-tsc/formatter/visitor/ddl/alter-table.js.map +1 -0
- package/out-tsc/formatter/visitor/ddl/create-table.d.ts +54 -0
- package/out-tsc/formatter/visitor/ddl/create-table.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/ddl/create-table.js +142 -0
- package/out-tsc/formatter/visitor/ddl/create-table.js.map +1 -0
- package/out-tsc/formatter/visitor/ddl/create-view.d.ts +27 -0
- package/out-tsc/formatter/visitor/ddl/create-view.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/ddl/create-view.js +61 -0
- package/out-tsc/formatter/visitor/ddl/create-view.js.map +1 -0
- package/out-tsc/formatter/visitor/ddl/drop.d.ts +30 -0
- package/out-tsc/formatter/visitor/ddl/drop.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/ddl/drop.js +69 -0
- package/out-tsc/formatter/visitor/ddl/drop.js.map +1 -0
- package/out-tsc/formatter/visitor/ddl/index.d.ts +10 -0
- package/out-tsc/formatter/visitor/ddl/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/ddl/index.js +26 -0
- package/out-tsc/formatter/visitor/ddl/index.js.map +1 -0
- package/out-tsc/formatter/visitor/dml/delete.d.ts +26 -0
- package/out-tsc/formatter/visitor/dml/delete.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/dml/delete.js +38 -0
- package/out-tsc/formatter/visitor/dml/delete.js.map +1 -0
- package/out-tsc/formatter/visitor/dml/index.d.ts +10 -0
- package/out-tsc/formatter/visitor/dml/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/dml/index.js +26 -0
- package/out-tsc/formatter/visitor/dml/index.js.map +1 -0
- package/out-tsc/formatter/visitor/dml/insert.d.ts +42 -0
- package/out-tsc/formatter/visitor/dml/insert.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/dml/insert.js +112 -0
- package/out-tsc/formatter/visitor/dml/insert.js.map +1 -0
- package/out-tsc/formatter/visitor/dml/merge.d.ts +40 -0
- package/out-tsc/formatter/visitor/dml/merge.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/dml/merge.js +67 -0
- package/out-tsc/formatter/visitor/dml/merge.js.map +1 -0
- package/out-tsc/formatter/visitor/dml/update.d.ts +33 -0
- package/out-tsc/formatter/visitor/dml/update.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/dml/update.js +49 -0
- package/out-tsc/formatter/visitor/dml/update.js.map +1 -0
- package/out-tsc/formatter/visitor/expression/arithmetic.d.ts +20 -0
- package/out-tsc/formatter/visitor/expression/arithmetic.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/expression/arithmetic.js +44 -0
- package/out-tsc/formatter/visitor/expression/arithmetic.js.map +1 -0
- package/out-tsc/formatter/visitor/expression/case-when.d.ts +41 -0
- package/out-tsc/formatter/visitor/expression/case-when.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/expression/case-when.js +94 -0
- package/out-tsc/formatter/visitor/expression/case-when.js.map +1 -0
- package/out-tsc/formatter/visitor/expression/comparison.d.ts +20 -0
- package/out-tsc/formatter/visitor/expression/comparison.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/expression/comparison.js +26 -0
- package/out-tsc/formatter/visitor/expression/comparison.js.map +1 -0
- package/out-tsc/formatter/visitor/expression/function-call.d.ts +20 -0
- package/out-tsc/formatter/visitor/expression/function-call.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/expression/function-call.js +33 -0
- package/out-tsc/formatter/visitor/expression/function-call.js.map +1 -0
- package/out-tsc/formatter/visitor/expression/index.d.ts +11 -0
- package/out-tsc/formatter/visitor/expression/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/expression/index.js +27 -0
- package/out-tsc/formatter/visitor/expression/index.js.map +1 -0
- package/out-tsc/formatter/visitor/expression/logical.d.ts +26 -0
- package/out-tsc/formatter/visitor/expression/logical.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/expression/logical.js +46 -0
- package/out-tsc/formatter/visitor/expression/logical.js.map +1 -0
- package/out-tsc/formatter/visitor/formatter-core.d.ts +79 -0
- package/out-tsc/formatter/visitor/formatter-core.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/formatter-core.js +211 -0
- package/out-tsc/formatter/visitor/formatter-core.js.map +1 -0
- package/out-tsc/formatter/visitor/index.d.ts +21 -0
- package/out-tsc/formatter/visitor/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/index.js +26 -0
- package/out-tsc/formatter/visitor/index.js.map +1 -0
- package/out-tsc/formatter/visitor/management/cache.d.ts +26 -0
- package/out-tsc/formatter/visitor/management/cache.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/management/cache.js +58 -0
- package/out-tsc/formatter/visitor/management/cache.js.map +1 -0
- package/out-tsc/formatter/visitor/management/index.d.ts +8 -0
- package/out-tsc/formatter/visitor/management/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/management/index.js +24 -0
- package/out-tsc/formatter/visitor/management/index.js.map +1 -0
- package/out-tsc/formatter/visitor/management/refresh.d.ts +26 -0
- package/out-tsc/formatter/visitor/management/refresh.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/management/refresh.js +55 -0
- package/out-tsc/formatter/visitor/management/refresh.js.map +1 -0
- package/out-tsc/formatter/visitor/pipeline/delta-live-tables.d.ts +31 -0
- package/out-tsc/formatter/visitor/pipeline/delta-live-tables.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/pipeline/delta-live-tables.js +46 -0
- package/out-tsc/formatter/visitor/pipeline/delta-live-tables.js.map +1 -0
- package/out-tsc/formatter/visitor/pipeline/index.d.ts +7 -0
- package/out-tsc/formatter/visitor/pipeline/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/pipeline/index.js +23 -0
- package/out-tsc/formatter/visitor/pipeline/index.js.map +1 -0
- package/out-tsc/formatter/visitor/query/cte.d.ts +34 -0
- package/out-tsc/formatter/visitor/query/cte.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/query/cte.js +54 -0
- package/out-tsc/formatter/visitor/query/cte.js.map +1 -0
- package/out-tsc/formatter/visitor/query/index.d.ts +11 -0
- package/out-tsc/formatter/visitor/query/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/query/index.js +27 -0
- package/out-tsc/formatter/visitor/query/index.js.map +1 -0
- package/out-tsc/formatter/visitor/query/query-organization.d.ts +25 -0
- package/out-tsc/formatter/visitor/query/query-organization.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/query/query-organization.js +75 -0
- package/out-tsc/formatter/visitor/query/query-organization.js.map +1 -0
- package/out-tsc/formatter/visitor/query/query.d.ts +22 -0
- package/out-tsc/formatter/visitor/query/query.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/query/query.js +30 -0
- package/out-tsc/formatter/visitor/query/query.js.map +1 -0
- package/out-tsc/formatter/visitor/query/select-clause.d.ts +17 -0
- package/out-tsc/formatter/visitor/query/select-clause.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/query/select-clause.js +35 -0
- package/out-tsc/formatter/visitor/query/select-clause.js.map +1 -0
- package/out-tsc/formatter/visitor/query/set-operation.d.ts +25 -0
- package/out-tsc/formatter/visitor/query/set-operation.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/query/set-operation.js +52 -0
- package/out-tsc/formatter/visitor/query/set-operation.js.map +1 -0
- package/out-tsc/formatter/visitor/statements/index.d.ts +7 -0
- package/out-tsc/formatter/visitor/statements/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/statements/index.js +23 -0
- package/out-tsc/formatter/visitor/statements/index.js.map +1 -0
- package/out-tsc/formatter/visitor/statements/program.d.ts +33 -0
- package/out-tsc/formatter/visitor/statements/program.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/statements/program.js +69 -0
- package/out-tsc/formatter/visitor/statements/program.js.map +1 -0
- package/out-tsc/formatter/visitor/types/complex-types.d.ts +24 -0
- package/out-tsc/formatter/visitor/types/complex-types.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/types/complex-types.js +47 -0
- package/out-tsc/formatter/visitor/types/complex-types.js.map +1 -0
- package/out-tsc/formatter/visitor/types/index.d.ts +8 -0
- package/out-tsc/formatter/visitor/types/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/types/index.js +24 -0
- package/out-tsc/formatter/visitor/types/index.js.map +1 -0
- package/out-tsc/formatter/visitor/types/primitive-types.d.ts +22 -0
- package/out-tsc/formatter/visitor/types/primitive-types.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/types/primitive-types.js +37 -0
- package/out-tsc/formatter/visitor/types/primitive-types.js.map +1 -0
- package/out-tsc/formatter/visitor/utils/context-helpers.d.ts +32 -0
- package/out-tsc/formatter/visitor/utils/context-helpers.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/utils/context-helpers.js +98 -0
- package/out-tsc/formatter/visitor/utils/context-helpers.js.map +1 -0
- package/out-tsc/formatter/visitor/utils/index.d.ts +11 -0
- package/out-tsc/formatter/visitor/utils/index.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/utils/index.js +45 -0
- package/out-tsc/formatter/visitor/utils/index.js.map +1 -0
- package/out-tsc/formatter/visitor/utils/keyword-formatting.d.ts +57 -0
- package/out-tsc/formatter/visitor/utils/keyword-formatting.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/utils/keyword-formatting.js +87 -0
- package/out-tsc/formatter/visitor/utils/keyword-formatting.js.map +1 -0
- package/out-tsc/formatter/visitor/utils/parenthesis-formatting.d.ts +53 -0
- package/out-tsc/formatter/visitor/utils/parenthesis-formatting.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/utils/parenthesis-formatting.js +88 -0
- package/out-tsc/formatter/visitor/utils/parenthesis-formatting.js.map +1 -0
- package/out-tsc/formatter/visitor/utils/space-compression.d.ts +55 -0
- package/out-tsc/formatter/visitor/utils/space-compression.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/utils/space-compression.js +71 -0
- package/out-tsc/formatter/visitor/utils/space-compression.js.map +1 -0
- package/out-tsc/formatter/visitor/utils/token-helpers.d.ts +64 -0
- package/out-tsc/formatter/visitor/utils/token-helpers.d.ts.map +1 -0
- package/out-tsc/formatter/visitor/utils/token-helpers.js +249 -0
- package/out-tsc/formatter/visitor/utils/token-helpers.js.map +1 -0
- package/out-tsc/index.d.ts +2 -1
- package/out-tsc/index.d.ts.map +1 -0
- package/out-tsc/index.js +3 -1
- package/out-tsc/index.js.map +1 -1
- package/out-tsc/lib/SparkSQLLexer.d.ts +557 -0
- package/out-tsc/lib/SparkSQLLexer.d.ts.map +1 -0
- package/out-tsc/lib/SparkSQLLexer.js +3676 -0
- package/out-tsc/lib/SparkSQLLexer.js.map +1 -0
- package/out-tsc/lib/SparkSQLParser.d.ts +7884 -0
- package/out-tsc/lib/SparkSQLParser.d.ts.map +1 -0
- package/out-tsc/lib/SparkSQLParser.js +45848 -0
- package/out-tsc/lib/SparkSQLParser.js.map +1 -0
- package/out-tsc/lib/SparkSQLParserListener.d.ts +5855 -0
- package/out-tsc/lib/SparkSQLParserListener.d.ts.map +1 -0
- package/out-tsc/lib/SparkSQLParserListener.js +4 -0
- package/out-tsc/lib/SparkSQLParserListener.js.map +1 -0
- package/out-tsc/lib/SparkSQLParserVisitor.d.ts +3674 -0
- package/out-tsc/lib/SparkSQLParserVisitor.d.ts.map +1 -0
- package/out-tsc/lib/SparkSQLParserVisitor.js +4 -0
- package/out-tsc/lib/SparkSQLParserVisitor.js.map +1 -0
- package/out-tsc/lineage.typing.d.ts +64 -0
- package/out-tsc/lineage.typing.d.ts.map +1 -0
- package/out-tsc/lineage.typing.js +3 -0
- package/out-tsc/lineage.typing.js.map +1 -0
- package/out-tsc/listeners/parse-error.listener.d.ts +3 -2
- package/out-tsc/listeners/parse-error.listener.d.ts.map +1 -0
- package/out-tsc/listeners/parse-error.listener.js +4 -4
- package/out-tsc/listeners/parse-error.listener.js.map +1 -1
- package/out-tsc/listeners/schema.listener.d.ts +32 -39
- package/out-tsc/listeners/schema.listener.d.ts.map +1 -0
- package/out-tsc/listeners/schema.listener.js +58 -100
- package/out-tsc/listeners/schema.listener.js.map +1 -1
- package/out-tsc/listeners/statement.listener.d.ts +263 -5
- package/out-tsc/listeners/statement.listener.d.ts.map +1 -0
- package/out-tsc/listeners/statement.listener.js +836 -11
- package/out-tsc/listeners/statement.listener.js.map +1 -1
- package/out-tsc/listeners/structure.listener.d.ts +70 -0
- package/out-tsc/listeners/structure.listener.d.ts.map +1 -0
- package/out-tsc/listeners/structure.listener.js +211 -0
- package/out-tsc/listeners/structure.listener.js.map +1 -0
- package/out-tsc/listeners/tokens-collector.listener.d.ts +27 -0
- package/out-tsc/listeners/tokens-collector.listener.d.ts.map +1 -0
- package/out-tsc/listeners/tokens-collector.listener.js +102 -0
- package/out-tsc/listeners/tokens-collector.listener.js.map +1 -0
- package/out-tsc/lsp-server.d.ts +79 -8
- package/out-tsc/lsp-server.d.ts.map +1 -0
- package/out-tsc/lsp-server.js +672 -237
- package/out-tsc/lsp-server.js.map +1 -1
- package/out-tsc/metadata.typing.d.ts +1 -0
- package/out-tsc/metadata.typing.d.ts.map +1 -0
- package/out-tsc/monaco-config.d.ts +219 -0
- package/out-tsc/monaco-config.d.ts.map +1 -0
- package/out-tsc/monaco-config.js +1032 -0
- package/out-tsc/monaco-config.js.map +1 -0
- package/out-tsc/parsing-warehouse.d.ts +8 -3
- package/out-tsc/parsing-warehouse.d.ts.map +1 -0
- package/out-tsc/parsing-warehouse.js +62 -6
- package/out-tsc/parsing-warehouse.js.map +1 -1
- package/out-tsc/protocol-translation.d.ts +12 -5
- package/out-tsc/protocol-translation.d.ts.map +1 -0
- package/out-tsc/protocol-translation.js +72 -19
- package/out-tsc/protocol-translation.js.map +1 -1
- package/out-tsc/public-apis.d.ts +1 -0
- package/out-tsc/public-apis.d.ts.map +1 -0
- package/out-tsc/schema-registry.d.ts +10 -7
- package/out-tsc/schema-registry.d.ts.map +1 -0
- package/out-tsc/schema-registry.js +87 -106
- package/out-tsc/schema-registry.js.map +1 -1
- package/out-tsc/server-worker.d.ts +1 -0
- package/out-tsc/server-worker.d.ts.map +1 -0
- package/out-tsc/server-worker.js +159 -44
- package/out-tsc/server-worker.js.map +1 -1
- package/out-tsc/tests/folding/block-comment-folding.test.d.ts +7 -0
- package/out-tsc/tests/folding/block-comment-folding.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/block-comment-folding.test.js +268 -0
- package/out-tsc/tests/folding/block-comment-folding.test.js.map +1 -0
- package/out-tsc/tests/folding/caching.test.d.ts +11 -0
- package/out-tsc/tests/folding/caching.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/caching.test.js +141 -0
- package/out-tsc/tests/folding/caching.test.js.map +1 -0
- package/out-tsc/tests/folding/cte-dependency-chain.test.d.ts +15 -0
- package/out-tsc/tests/folding/cte-dependency-chain.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/cte-dependency-chain.test.js +323 -0
- package/out-tsc/tests/folding/cte-dependency-chain.test.js.map +1 -0
- package/out-tsc/tests/folding/debug-format-flow.test.d.ts +2 -0
- package/out-tsc/tests/folding/debug-format-flow.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/debug-format-flow.test.js +114 -0
- package/out-tsc/tests/folding/debug-format-flow.test.js.map +1 -0
- package/out-tsc/tests/folding/debug-formatted.test.d.ts +2 -0
- package/out-tsc/tests/folding/debug-formatted.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/debug-formatted.test.js +175 -0
- package/out-tsc/tests/folding/debug-formatted.test.js.map +1 -0
- package/out-tsc/tests/folding/deduplication.test.d.ts +10 -0
- package/out-tsc/tests/folding/deduplication.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/deduplication.test.js +206 -0
- package/out-tsc/tests/folding/deduplication.test.js.map +1 -0
- package/out-tsc/tests/folding/edge-cases.test.d.ts +8 -0
- package/out-tsc/tests/folding/edge-cases.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/edge-cases.test.js +319 -0
- package/out-tsc/tests/folding/edge-cases.test.js.map +1 -0
- package/out-tsc/tests/folding/folding-level-config.test.d.ts +11 -0
- package/out-tsc/tests/folding/folding-level-config.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/folding-level-config.test.js +313 -0
- package/out-tsc/tests/folding/folding-level-config.test.js.map +1 -0
- package/out-tsc/tests/folding/folding-statistics.test.d.ts +13 -0
- package/out-tsc/tests/folding/folding-statistics.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/folding-statistics.test.js +144 -0
- package/out-tsc/tests/folding/folding-statistics.test.js.map +1 -0
- package/out-tsc/tests/folding/index.d.ts +8 -0
- package/out-tsc/tests/folding/index.d.ts.map +1 -0
- package/out-tsc/tests/folding/index.js +24 -0
- package/out-tsc/tests/folding/index.js.map +1 -0
- package/out-tsc/tests/folding/join-folding.test.d.ts +11 -0
- package/out-tsc/tests/folding/join-folding.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/join-folding.test.js +167 -0
- package/out-tsc/tests/folding/join-folding.test.js.map +1 -0
- package/out-tsc/tests/folding/kind-classification.test.d.ts +11 -0
- package/out-tsc/tests/folding/kind-classification.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/kind-classification.test.js +270 -0
- package/out-tsc/tests/folding/kind-classification.test.js.map +1 -0
- package/out-tsc/tests/folding/level1-statement.test.d.ts +8 -0
- package/out-tsc/tests/folding/level1-statement.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/level1-statement.test.js +278 -0
- package/out-tsc/tests/folding/level1-statement.test.js.map +1 -0
- package/out-tsc/tests/folding/level2-query-block.test.d.ts +8 -0
- package/out-tsc/tests/folding/level2-query-block.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/level2-query-block.test.js +374 -0
- package/out-tsc/tests/folding/level2-query-block.test.js.map +1 -0
- package/out-tsc/tests/folding/level3-expression.test.d.ts +8 -0
- package/out-tsc/tests/folding/level3-expression.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/level3-expression.test.js +361 -0
- package/out-tsc/tests/folding/level3-expression.test.js.map +1 -0
- package/out-tsc/tests/folding/level4-structure.test.d.ts +8 -0
- package/out-tsc/tests/folding/level4-structure.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/level4-structure.test.js +270 -0
- package/out-tsc/tests/folding/level4-structure.test.js.map +1 -0
- package/out-tsc/tests/folding/line-comment-folding.test.d.ts +13 -0
- package/out-tsc/tests/folding/line-comment-folding.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/line-comment-folding.test.js +215 -0
- package/out-tsc/tests/folding/line-comment-folding.test.js.map +1 -0
- package/out-tsc/tests/folding/nested-folding.test.d.ts +8 -0
- package/out-tsc/tests/folding/nested-folding.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/nested-folding.test.js +386 -0
- package/out-tsc/tests/folding/nested-folding.test.js.map +1 -0
- package/out-tsc/tests/folding/performance-benchmark.test.d.ts +11 -0
- package/out-tsc/tests/folding/performance-benchmark.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/performance-benchmark.test.js +256 -0
- package/out-tsc/tests/folding/performance-benchmark.test.js.map +1 -0
- package/out-tsc/tests/folding/region-marker-folding.test.d.ts +11 -0
- package/out-tsc/tests/folding/region-marker-folding.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/region-marker-folding.test.js +245 -0
- package/out-tsc/tests/folding/region-marker-folding.test.js.map +1 -0
- package/out-tsc/tests/folding/select-columns-folding.test.d.ts +10 -0
- package/out-tsc/tests/folding/select-columns-folding.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/select-columns-folding.test.js +139 -0
- package/out-tsc/tests/folding/select-columns-folding.test.js.map +1 -0
- package/out-tsc/tests/folding/test-utils.d.ts +73 -0
- package/out-tsc/tests/folding/test-utils.d.ts.map +1 -0
- package/out-tsc/tests/folding/test-utils.js +98 -0
- package/out-tsc/tests/folding/test-utils.js.map +1 -0
- package/out-tsc/tests/folding/values-folding.test.d.ts +10 -0
- package/out-tsc/tests/folding/values-folding.test.d.ts.map +1 -0
- package/out-tsc/tests/folding/values-folding.test.js +102 -0
- package/out-tsc/tests/folding/values-folding.test.js.map +1 -0
- package/out-tsc/tests/format/ddl/datatype-constraint.test.d.ts +5 -0
- package/out-tsc/tests/format/ddl/datatype-constraint.test.d.ts.map +1 -0
- package/out-tsc/tests/format/ddl/datatype-constraint.test.js +132 -0
- package/out-tsc/tests/format/ddl/datatype-constraint.test.js.map +1 -0
- package/out-tsc/tests/format/ddl/index.test.d.ts +5 -0
- package/out-tsc/tests/format/ddl/index.test.d.ts.map +1 -0
- package/out-tsc/tests/format/ddl/index.test.js +74 -0
- package/out-tsc/tests/format/ddl/index.test.js.map +1 -0
- package/out-tsc/tests/format/ddl/materialized-view.test.d.ts +5 -0
- package/out-tsc/tests/format/ddl/materialized-view.test.d.ts.map +1 -0
- package/out-tsc/tests/format/ddl/materialized-view.test.js +92 -0
- package/out-tsc/tests/format/ddl/materialized-view.test.js.map +1 -0
- package/out-tsc/tests/format/ddl/partition.test.d.ts +5 -0
- package/out-tsc/tests/format/ddl/partition.test.d.ts.map +1 -0
- package/out-tsc/tests/format/ddl/partition.test.js +109 -0
- package/out-tsc/tests/format/ddl/partition.test.js.map +1 -0
- package/out-tsc/tests/format/ddl/variable.test.d.ts +5 -0
- package/out-tsc/tests/format/ddl/variable.test.d.ts.map +1 -0
- package/out-tsc/tests/format/ddl/variable.test.js +58 -0
- package/out-tsc/tests/format/ddl/variable.test.js.map +1 -0
- package/out-tsc/tests/format/dml/select.test.d.ts +5 -0
- package/out-tsc/tests/format/dml/select.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dml/select.test.js +114 -0
- package/out-tsc/tests/format/dml/select.test.js.map +1 -0
- package/out-tsc/tests/format/dml/subquery.test.d.ts +5 -0
- package/out-tsc/tests/format/dml/subquery.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dml/subquery.test.js +221 -0
- package/out-tsc/tests/format/dml/subquery.test.js.map +1 -0
- package/out-tsc/tests/format/dql/comment.test.d.ts +7 -0
- package/out-tsc/tests/format/dql/comment.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dql/comment.test.js +279 -0
- package/out-tsc/tests/format/dql/comment.test.js.map +1 -0
- package/out-tsc/tests/format/dql/cte.test.d.ts +7 -0
- package/out-tsc/tests/format/dql/cte.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dql/cte.test.js +31 -0
- package/out-tsc/tests/format/dql/cte.test.js.map +1 -0
- package/out-tsc/tests/format/dql/dql-detail.test.d.ts +5 -0
- package/out-tsc/tests/format/dql/dql-detail.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dql/dql-detail.test.js +191 -0
- package/out-tsc/tests/format/dql/dql-detail.test.js.map +1 -0
- package/out-tsc/tests/format/dql/lateral-view.test.d.ts +7 -0
- package/out-tsc/tests/format/dql/lateral-view.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dql/lateral-view.test.js +34 -0
- package/out-tsc/tests/format/dql/lateral-view.test.js.map +1 -0
- package/out-tsc/tests/format/dql/pivot.test.d.ts +7 -0
- package/out-tsc/tests/format/dql/pivot.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dql/pivot.test.js +56 -0
- package/out-tsc/tests/format/dql/pivot.test.js.map +1 -0
- package/out-tsc/tests/format/dql/window.test.d.ts +7 -0
- package/out-tsc/tests/format/dql/window.test.d.ts.map +1 -0
- package/out-tsc/tests/format/dql/window.test.js +89 -0
- package/out-tsc/tests/format/dql/window.test.js.map +1 -0
- package/out-tsc/tests/format/expression/expression.test.d.ts +5 -0
- package/out-tsc/tests/format/expression/expression.test.d.ts.map +1 -0
- package/out-tsc/tests/format/expression/expression.test.js +203 -0
- package/out-tsc/tests/format/expression/expression.test.js.map +1 -0
- package/out-tsc/tests/format/pipe/pipe-operator.test.d.ts +5 -0
- package/out-tsc/tests/format/pipe/pipe-operator.test.d.ts.map +1 -0
- package/out-tsc/tests/format/pipe/pipe-operator.test.js +290 -0
- package/out-tsc/tests/format/pipe/pipe-operator.test.js.map +1 -0
- package/out-tsc/tests/format/procedure/compound-statement.test.d.ts +16 -0
- package/out-tsc/tests/format/procedure/compound-statement.test.d.ts.map +1 -0
- package/out-tsc/tests/format/procedure/compound-statement.test.js +254 -0
- package/out-tsc/tests/format/procedure/compound-statement.test.js.map +1 -0
- package/out-tsc/tests/format/resource/resource.test.d.ts +5 -0
- package/out-tsc/tests/format/resource/resource.test.d.ts.map +1 -0
- package/out-tsc/tests/format/resource/resource.test.js +69 -0
- package/out-tsc/tests/format/resource/resource.test.js.map +1 -0
- package/out-tsc/tests/format/test-utils.d.ts +40 -0
- package/out-tsc/tests/format/test-utils.d.ts.map +1 -0
- package/out-tsc/tests/format/test-utils.js +53 -0
- package/out-tsc/tests/format/test-utils.js.map +1 -0
- package/out-tsc/tests/lsp-server.test.d.ts +2 -0
- package/out-tsc/tests/lsp-server.test.d.ts.map +1 -0
- package/out-tsc/tests/lsp-server.test.js +1525 -0
- package/out-tsc/tests/lsp-server.test.js.map +1 -0
- package/out-tsc/tests/spark-sql-inputs.test.d.ts +17 -0
- package/out-tsc/tests/spark-sql-inputs.test.d.ts.map +1 -0
- package/out-tsc/tests/spark-sql-inputs.test.js +570 -0
- package/out-tsc/tests/spark-sql-inputs.test.js.map +1 -0
- package/out-tsc/tests/validation.test.d.ts +2 -0
- package/out-tsc/tests/validation.test.d.ts.map +1 -0
- package/out-tsc/tests/validation.test.js +115 -0
- package/out-tsc/tests/validation.test.js.map +1 -0
- package/out-tsc/typings.d.ts +115 -1
- package/out-tsc/typings.d.ts.map +1 -0
- package/out-tsc/typings.js +28 -0
- package/out-tsc/typings.js.map +1 -1
- package/out-tsc/utils.d.ts +1 -0
- package/out-tsc/utils.d.ts.map +1 -0
- package/out-tsc/utils.js +4 -5
- package/out-tsc/utils.js.map +1 -1
- package/out-tsc/visitors/completion.visitor.d.ts +85 -0
- package/out-tsc/visitors/completion.visitor.d.ts.map +1 -0
- package/out-tsc/visitors/completion.visitor.js +379 -0
- package/out-tsc/visitors/completion.visitor.js.map +1 -0
- package/out-tsc/visitors/lineage.visitor.d.ts +34 -0
- package/out-tsc/visitors/lineage.visitor.d.ts.map +1 -0
- package/out-tsc/visitors/lineage.visitor.js +181 -0
- package/out-tsc/visitors/lineage.visitor.js.map +1 -0
- package/out-tsc/visitors/space-replacer-format.visitor.d.ts +1641 -0
- package/out-tsc/visitors/space-replacer-format.visitor.d.ts.map +1 -0
- package/out-tsc/visitors/space-replacer-format.visitor.js +7529 -0
- package/out-tsc/visitors/space-replacer-format.visitor.js.map +1 -0
- package/out-tsc/visitors/sparksql-relation.visitor.d.ts +154 -0
- package/out-tsc/visitors/sparksql-relation.visitor.d.ts.map +1 -0
- package/out-tsc/visitors/sparksql-relation.visitor.js +749 -0
- package/out-tsc/visitors/sparksql-relation.visitor.js.map +1 -0
- package/package.json +36 -9
- package/out-tsc/constant.d.ts +0 -3
- package/out-tsc/constant.js +0 -7
- package/out-tsc/constant.js.map +0 -1
- package/out-tsc/lib/SparkSqlLexer.d.ts +0 -421
- package/out-tsc/lib/SparkSqlLexer.js +0 -2750
- package/out-tsc/lib/SparkSqlLexer.js.map +0 -1
- package/out-tsc/lib/SparkSqlParser.d.ts +0 -6203
- package/out-tsc/lib/SparkSqlParser.js +0 -34733
- package/out-tsc/lib/SparkSqlParser.js.map +0 -1
- package/out-tsc/lib/SparkSqlParserListener.d.ts +0 -1158
- package/out-tsc/lib/SparkSqlParserListener.js.map +0 -1
- package/out-tsc/lib/SparkSqlParserVisitor.d.ts +0 -773
- package/out-tsc/lib/SparkSqlParserVisitor.js.map +0 -1
package/out-tsc/lsp-server.js
CHANGED
|
@@ -15,65 +15,128 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.LSPServer = void 0;
|
|
37
|
+
exports.isSemanticTokenReference = isSemanticTokenReference;
|
|
27
38
|
const antlr4_c3_1 = require("antlr4-c3");
|
|
39
|
+
const antlr4ts_1 = require("antlr4ts");
|
|
28
40
|
const tree_1 = require("antlr4ts/tree");
|
|
29
|
-
const sql_formatter_1 = require("sql-formatter");
|
|
30
41
|
const lsp = __importStar(require("vscode-languageserver"));
|
|
31
|
-
const
|
|
42
|
+
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
32
43
|
const built_in_functions_1 = require("./assets/built-in-functions");
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
44
|
+
const completion_parser_1 = require("./completion-parser");
|
|
45
|
+
const cursor_1 = require("./cursor");
|
|
46
|
+
const formatter_adapter_1 = require("./formatter/formatter-adapter");
|
|
47
|
+
const SparkSQLLexer_1 = require("./lib/SparkSQLLexer");
|
|
48
|
+
const SparkSQLParser_1 = require("./lib/SparkSQLParser");
|
|
36
49
|
const statement_listener_1 = require("./listeners/statement.listener");
|
|
50
|
+
const structure_listener_1 = require("./listeners/structure.listener");
|
|
51
|
+
const tokens_collector_listener_1 = require("./listeners/tokens-collector.listener");
|
|
37
52
|
const parsing_warehouse_1 = require("./parsing-warehouse");
|
|
38
53
|
const protocol_translation_1 = require("./protocol-translation");
|
|
39
54
|
const schema_registry_1 = require("./schema-registry");
|
|
55
|
+
const typings_1 = require("./typings");
|
|
40
56
|
const utils_1 = require("./utils");
|
|
41
|
-
const
|
|
42
|
-
SparkSqlLexer_1.SparkSqlLexer.EOF,
|
|
43
|
-
SparkSqlLexer_1.SparkSqlLexer.DOT,
|
|
44
|
-
SparkSqlLexer_1.SparkSqlLexer.SEMI,
|
|
45
|
-
SparkSqlLexer_1.SparkSqlLexer.COMMA,
|
|
46
|
-
SparkSqlLexer_1.SparkSqlLexer.LEFT_BRACKET,
|
|
47
|
-
SparkSqlLexer_1.SparkSqlLexer.RIGHT_BRACKET,
|
|
48
|
-
SparkSqlLexer_1.SparkSqlLexer.EQ,
|
|
49
|
-
SparkSqlLexer_1.SparkSqlLexer.DOUBLEQUOTED_STRING,
|
|
50
|
-
SparkSqlLexer_1.SparkSqlLexer.BACKQUOTED_IDENTIFIER,
|
|
51
|
-
SparkSqlLexer_1.SparkSqlLexer.AT,
|
|
52
|
-
SparkSqlLexer_1.SparkSqlLexer.DIV,
|
|
53
|
-
SparkSqlLexer_1.SparkSqlLexer.NSEQ,
|
|
54
|
-
SparkSqlLexer_1.SparkSqlLexer.NEQ,
|
|
55
|
-
SparkSqlLexer_1.SparkSqlLexer.NEQJ,
|
|
56
|
-
SparkSqlLexer_1.SparkSqlLexer.LT,
|
|
57
|
-
SparkSqlLexer_1.SparkSqlLexer.LTE,
|
|
58
|
-
SparkSqlLexer_1.SparkSqlLexer.GT,
|
|
59
|
-
SparkSqlLexer_1.SparkSqlLexer.GTE,
|
|
60
|
-
SparkSqlLexer_1.SparkSqlLexer.PLUS,
|
|
61
|
-
SparkSqlLexer_1.SparkSqlLexer.MINUS,
|
|
62
|
-
SparkSqlLexer_1.SparkSqlLexer.IDENTIFIER
|
|
63
|
-
];
|
|
57
|
+
const lineage_visitor_1 = require("./visitors/lineage.visitor");
|
|
64
58
|
const preferredRules = [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
SparkSqlParser_1.SparkSqlParser.RULE_tableNameDef,
|
|
71
|
-
SparkSqlParser_1.SparkSqlParser.RULE_viewNameDef,
|
|
72
|
-
SparkSqlParser_1.SparkSqlParser.RULE_columnNameDef,
|
|
73
|
-
SparkSqlParser_1.SparkSqlParser.RULE_identifier
|
|
59
|
+
SparkSQLParser_1.SparkSQLParser.RULE_functionName,
|
|
60
|
+
SparkSQLParser_1.SparkSQLParser.RULE_identifierReference,
|
|
61
|
+
SparkSQLParser_1.SparkSQLParser.RULE_multipartIdentifier,
|
|
62
|
+
SparkSQLParser_1.SparkSQLParser.RULE_tableIdentifier,
|
|
63
|
+
SparkSQLParser_1.SparkSQLParser.RULE_identifier
|
|
74
64
|
];
|
|
65
|
+
const ignoredTokens = [
|
|
66
|
+
SparkSQLLexer_1.SparkSQLLexer.EOF,
|
|
67
|
+
SparkSQLLexer_1.SparkSQLLexer.SEMICOLON,
|
|
68
|
+
SparkSQLLexer_1.SparkSQLLexer.COMMA,
|
|
69
|
+
SparkSQLLexer_1.SparkSQLLexer.DOT,
|
|
70
|
+
SparkSQLLexer_1.SparkSQLLexer.ASTERISK,
|
|
71
|
+
SparkSQLLexer_1.SparkSQLLexer.COLON,
|
|
72
|
+
SparkSQLLexer_1.SparkSQLLexer.LEFT_PAREN,
|
|
73
|
+
SparkSQLLexer_1.SparkSQLLexer.RIGHT_PAREN,
|
|
74
|
+
SparkSQLLexer_1.SparkSQLLexer.LEFT_BRACKET,
|
|
75
|
+
SparkSQLLexer_1.SparkSQLLexer.RIGHT_BRACKET,
|
|
76
|
+
SparkSQLLexer_1.SparkSQLLexer.STRING_LITERAL,
|
|
77
|
+
SparkSQLLexer_1.SparkSQLLexer.DECIMAL_VALUE,
|
|
78
|
+
SparkSQLLexer_1.SparkSQLLexer.IDENTIFIER
|
|
79
|
+
];
|
|
80
|
+
/**
|
|
81
|
+
* Simple LRU Cache for folding ranges
|
|
82
|
+
* Limits memory usage by evicting least recently used entries
|
|
83
|
+
*/
|
|
84
|
+
class LRUFoldingCache {
|
|
85
|
+
constructor(maxSize = 50) {
|
|
86
|
+
this.cache = new Map();
|
|
87
|
+
this.maxSize = maxSize;
|
|
88
|
+
}
|
|
89
|
+
get(key) {
|
|
90
|
+
const entry = this.cache.get(key);
|
|
91
|
+
if (entry) {
|
|
92
|
+
// Update last access time
|
|
93
|
+
entry.lastAccess = Date.now();
|
|
94
|
+
// Move to end (most recently used)
|
|
95
|
+
this.cache.delete(key);
|
|
96
|
+
this.cache.set(key, entry);
|
|
97
|
+
}
|
|
98
|
+
return entry;
|
|
99
|
+
}
|
|
100
|
+
set(key, entry) {
|
|
101
|
+
// Remove if exists (to update position)
|
|
102
|
+
if (this.cache.has(key)) {
|
|
103
|
+
this.cache.delete(key);
|
|
104
|
+
}
|
|
105
|
+
// Evict oldest if at capacity
|
|
106
|
+
else if (this.cache.size >= this.maxSize) {
|
|
107
|
+
// The first key is the least recently used
|
|
108
|
+
const oldestKey = this.cache.keys().next().value;
|
|
109
|
+
if (oldestKey) {
|
|
110
|
+
this.cache.delete(oldestKey);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
entry.lastAccess = Date.now();
|
|
114
|
+
this.cache.set(key, entry);
|
|
115
|
+
}
|
|
116
|
+
delete(key) {
|
|
117
|
+
return this.cache.delete(key);
|
|
118
|
+
}
|
|
119
|
+
deleteByPrefix(prefix) {
|
|
120
|
+
for (const key of this.cache.keys()) {
|
|
121
|
+
if (key.startsWith(prefix)) {
|
|
122
|
+
this.cache.delete(key);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
clear() {
|
|
127
|
+
this.cache.clear();
|
|
128
|
+
}
|
|
129
|
+
get size() {
|
|
130
|
+
return this.cache.size;
|
|
131
|
+
}
|
|
132
|
+
keys() {
|
|
133
|
+
return this.cache.keys();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
75
136
|
class LSPServer {
|
|
76
137
|
constructor() {
|
|
138
|
+
this._builtInFunctionItems = null;
|
|
139
|
+
this._foldingCache = new LRUFoldingCache(50); // Max 50 cached documents
|
|
77
140
|
this._warehouse = new parsing_warehouse_1.ParsingWarehouse();
|
|
78
141
|
this._schemaRegistry = new schema_registry_1.SchemaRegistry();
|
|
79
142
|
}
|
|
@@ -83,235 +146,607 @@ class LSPServer {
|
|
|
83
146
|
get schemaRegistry() {
|
|
84
147
|
return this._schemaRegistry;
|
|
85
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Get cached built-in function completion items
|
|
151
|
+
*/
|
|
152
|
+
getBuiltInFunctionItems() {
|
|
153
|
+
if (!this._builtInFunctionItems) {
|
|
154
|
+
this._builtInFunctionItems = built_in_functions_1.BuiltInFunctions.map(fn => {
|
|
155
|
+
const funcName = fn.name.split('(')[0];
|
|
156
|
+
return (0, protocol_translation_1.toCompletionItem)('built-in', funcName, fn.expr, fn.funcDesc, (0, built_in_functions_1.generateDescription)(fn));
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return this._builtInFunctionItems;
|
|
160
|
+
}
|
|
161
|
+
getTokenByPosition(document, position) {
|
|
162
|
+
const parsingValue = this._warehouse.getParsingValue(document);
|
|
163
|
+
const offset = document.offsetAt(position);
|
|
164
|
+
return parsingValue.tokenStream.getTokens().find(t => t.startIndex <= offset && offset <= t.stopIndex + 1);
|
|
165
|
+
}
|
|
86
166
|
doValidation(document) {
|
|
87
167
|
const parsingValue = this._warehouse.getParsingValue(document);
|
|
88
168
|
return parsingValue.errors;
|
|
89
169
|
}
|
|
90
|
-
|
|
170
|
+
doFormatting(document, options, returnResult) {
|
|
91
171
|
const parsingValue = this._warehouse.getParsingValue(document);
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
const core = new antlr4_c3_1.CodeCompletionCore(parsingValue.parser);
|
|
98
|
-
core.ignoredTokens = new Set(ignoredTokens);
|
|
99
|
-
core.preferredRules = new Set(preferredRules);
|
|
100
|
-
let index = token.tokenIndex;
|
|
101
|
-
let bias = 0;
|
|
102
|
-
if (token.type === SparkSqlLexer_1.SparkSqlLexer.DOT) {
|
|
103
|
-
index += 1;
|
|
104
|
-
offset -= 1;
|
|
105
|
-
bias = 1;
|
|
106
|
-
}
|
|
107
|
-
const completionItems = [];
|
|
172
|
+
// Collect parse errors for reporting (but don't block formatting)
|
|
173
|
+
const parseErrors = parsingValue.errors.map(e => ({
|
|
174
|
+
message: e.message,
|
|
175
|
+
line: e.range.start.line
|
|
176
|
+
}));
|
|
108
177
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.map(d => (0, protocol_translation_1.toCompletionItem)('database', d.label, d.label, `Schema database: ${d.catalog}.*`, d.description)));
|
|
178
|
+
// Use formatSQLFromText which handles normalization internally
|
|
179
|
+
// Returns a single edit that replaces the entire document
|
|
180
|
+
const formattingOutput = (0, formatter_adapter_1.formatSQLFromText)(document.getText(), options, formatter_adapter_1.DEFAULT_FORMATTER_CONFIG);
|
|
181
|
+
// Merge parse errors with formatting errors
|
|
182
|
+
const allErrors = [...parseErrors, ...formattingOutput.errors];
|
|
183
|
+
// Check if we should use fallback formatting
|
|
184
|
+
// Trigger fallback if there are parse errors and we detect that many statements were skipped
|
|
185
|
+
const shouldUseFallback = parseErrors.length > 0 && this.shouldUseFallbackFormatting(document, formattingOutput.edits, parsingValue.tree);
|
|
186
|
+
if (shouldUseFallback) {
|
|
187
|
+
try {
|
|
188
|
+
const fallbackResult = this.doStatementByStatementFormatting(document, options);
|
|
189
|
+
if (fallbackResult.edits.length > formattingOutput.edits.length) {
|
|
190
|
+
// Fallback produced more edits, use it
|
|
191
|
+
const result = {
|
|
192
|
+
edits: fallbackResult.edits,
|
|
193
|
+
errors: [
|
|
194
|
+
...parseErrors,
|
|
195
|
+
...fallbackResult.errors,
|
|
196
|
+
{
|
|
197
|
+
message: `Used fallback formatting due to parse errors (recovered ${fallbackResult.edits.length} edits vs ${formattingOutput.edits.length})`,
|
|
198
|
+
line: 0
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
success: false
|
|
202
|
+
};
|
|
203
|
+
return returnResult ? result : fallbackResult.edits;
|
|
136
204
|
}
|
|
137
|
-
identifiers.push('database');
|
|
138
205
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (!!schemaParts && schemaParts.length <= 1 - bias) {
|
|
142
|
-
completionItems.push(...this._schemaRegistry
|
|
143
|
-
.getSchemaTables({})
|
|
144
|
-
.map(t => (0, protocol_translation_1.toCompletionItem)('table', t.label, t.label, `Schema table: ${t.catalog}.${t.database}.*`, t.description)));
|
|
145
|
-
tablesInDocument = (0, utils_1.unique)(schemaContexts.filter(t => t !== context && t.kind === schema_listener_1.SchemaContextKindEnum.TABLE).map(t => t.tableName));
|
|
146
|
-
}
|
|
147
|
-
else if (!!schemaParts && schemaParts.length === 2 - bias) {
|
|
148
|
-
completionItems.push(...this._schemaRegistry
|
|
149
|
-
.getSchemaTables({ database: schemaParts[0] })
|
|
150
|
-
.map(t => (0, protocol_translation_1.toCompletionItem)('table', t.label, t.label, `Schema table: ${t.catalog}.${t.database}.*`, t.description)));
|
|
151
|
-
tablesInDocument = (0, utils_1.unique)(schemaContexts.filter(t => t !== context &&
|
|
152
|
-
t.kind === schema_listener_1.SchemaContextKindEnum.TABLE &&
|
|
153
|
-
(!schemaParts[0] || t.databaseName === schemaParts[0])).map(t => t.tableName));
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
completionItems.push(...this._schemaRegistry
|
|
157
|
-
.getSchemaTables({ catalog: schemaParts?.[0], database: schemaParts?.[1] })
|
|
158
|
-
.map(t => (0, protocol_translation_1.toCompletionItem)('table', t.label, t.label, `Schema table: ${t.catalog}.${t.database}.*`, t.description)));
|
|
159
|
-
tablesInDocument = (0, utils_1.unique)(schemaContexts.filter(t => t !== context &&
|
|
160
|
-
t.kind === schema_listener_1.SchemaContextKindEnum.TABLE &&
|
|
161
|
-
(!schemaParts?.[0] || t.catalogName === schemaParts?.[0]) &&
|
|
162
|
-
(!schemaParts?.[1] || t.databaseName === schemaParts?.[1])).map(t => t.tableName));
|
|
163
|
-
}
|
|
164
|
-
completionItems.push(...tablesInDocument.map(t => (0, protocol_translation_1.toCompletionItem)('table', t, t, 'Table in document')));
|
|
165
|
-
identifiers.push('table');
|
|
206
|
+
catch (fallbackError) {
|
|
207
|
+
// Fallback failed, continue with primary results
|
|
166
208
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
database: schemaParts[0],
|
|
197
|
-
table: schemaParts[1]
|
|
198
|
-
};
|
|
199
|
-
columns = this._schemaRegistry.getSchemaColumns({
|
|
200
|
-
database: schemaParts[0] || databaseName,
|
|
201
|
-
table: schemaParts[1] || tableName
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
columnDefinitionMap = {
|
|
206
|
-
catalog: schemaParts?.[0],
|
|
207
|
-
database: schemaParts?.[1],
|
|
208
|
-
table: schemaParts?.[2]
|
|
209
|
+
}
|
|
210
|
+
// formatSQLFromText returns a single edit that replaces the entire document
|
|
211
|
+
// No need to normalize blank lines since normalization is done during preprocessing
|
|
212
|
+
const result = {
|
|
213
|
+
edits: formattingOutput.edits,
|
|
214
|
+
errors: allErrors,
|
|
215
|
+
success: allErrors.length === 0
|
|
216
|
+
};
|
|
217
|
+
return returnResult ? result : result.edits;
|
|
218
|
+
}
|
|
219
|
+
catch (e) {
|
|
220
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
221
|
+
// If formatting failed and there are parse errors, try statement-by-statement formatting
|
|
222
|
+
if (parseErrors.length > 0) {
|
|
223
|
+
try {
|
|
224
|
+
const fallbackResult = this.doStatementByStatementFormatting(document, options);
|
|
225
|
+
if (fallbackResult.edits.length > 0) {
|
|
226
|
+
// Fallback formatting succeeded, return those results
|
|
227
|
+
const result = {
|
|
228
|
+
edits: fallbackResult.edits,
|
|
229
|
+
errors: [
|
|
230
|
+
...parseErrors,
|
|
231
|
+
...fallbackResult.errors,
|
|
232
|
+
{
|
|
233
|
+
message: `Used fallback formatting due to parse errors`,
|
|
234
|
+
line: 0
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
success: false
|
|
209
238
|
};
|
|
210
|
-
|
|
211
|
-
catalog: schemaParts?.[0] || catalogName,
|
|
212
|
-
database: schemaParts?.[1] || databaseName,
|
|
213
|
-
table: schemaParts?.[2] || tableName
|
|
214
|
-
});
|
|
239
|
+
return returnResult ? result : fallbackResult.edits;
|
|
215
240
|
}
|
|
216
|
-
const columnsInDocument = (0, utils_1.unique)(schemaContexts.filter(t => {
|
|
217
|
-
return (t !== context &&
|
|
218
|
-
t.kind === schema_listener_1.SchemaContextKindEnum.COLUMN &&
|
|
219
|
-
(columnDefinitionMap
|
|
220
|
-
? (!columnDefinitionMap.catalog || columnDefinitionMap.catalog === t.catalogName) &&
|
|
221
|
-
(!columnDefinitionMap.database || columnDefinitionMap.database === t.databaseName) &&
|
|
222
|
-
(!columnDefinitionMap.table || columnDefinitionMap.table === t.tableName)
|
|
223
|
-
: (!t.tableName && !nearestTable) ||
|
|
224
|
-
!nearestTable?.tableName ||
|
|
225
|
-
t.tableName === nearestTable.tableName));
|
|
226
|
-
}));
|
|
227
|
-
completionItems.push(...columnsInDocument.map(d => (0, protocol_translation_1.toCompletionItem)('column', d.text, d.text, `Column ${d.tableName ? `of ${d.tableName}` : ''} in document`)));
|
|
228
|
-
if (columns.length) {
|
|
229
|
-
completionItems.push(...columns.map(c => (0, protocol_translation_1.toCompletionItem)('column', c.label, c.label, `Schema column: ${c.catalog}.${c.database}.${c.table}.*`, c.description)));
|
|
230
|
-
}
|
|
231
|
-
identifiers.push('column');
|
|
232
241
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
242
|
+
catch (fallbackError) {
|
|
243
|
+
// Fallback also failed, continue to original error handling
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const result = {
|
|
247
|
+
edits: [],
|
|
248
|
+
errors: [
|
|
249
|
+
...parseErrors,
|
|
250
|
+
{
|
|
251
|
+
message: `Formatting failed: ${errorMessage}`,
|
|
252
|
+
line: 0
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
success: false
|
|
256
|
+
};
|
|
257
|
+
return returnResult ? result : [];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Format with a specific formatter configuration (legacy or strategy)
|
|
262
|
+
* Used for comparing formatter outputs in playground
|
|
263
|
+
*/
|
|
264
|
+
doFormattingWithConfig(document, options, config) {
|
|
265
|
+
const parsingValue = this._warehouse.getParsingValue(document);
|
|
266
|
+
// Collect parse errors for reporting
|
|
267
|
+
const parseErrors = parsingValue.errors.map(e => ({
|
|
268
|
+
message: e.message,
|
|
269
|
+
line: e.range.start.line
|
|
270
|
+
}));
|
|
271
|
+
try {
|
|
272
|
+
// Use formatSQLFromText which handles normalization internally
|
|
273
|
+
// Returns a single edit that replaces the entire document
|
|
274
|
+
const formattingOutput = (0, formatter_adapter_1.formatSQLFromText)(document.getText(), options, config);
|
|
275
|
+
const allErrors = [...parseErrors, ...formattingOutput.errors];
|
|
276
|
+
return {
|
|
277
|
+
edits: formattingOutput.edits,
|
|
278
|
+
errors: allErrors,
|
|
279
|
+
success: allErrors.length === 0
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
catch (e) {
|
|
283
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
284
|
+
return {
|
|
285
|
+
edits: [],
|
|
286
|
+
errors: [
|
|
287
|
+
...parseErrors,
|
|
288
|
+
{
|
|
289
|
+
message: `Formatting failed: ${errorMessage}`,
|
|
290
|
+
line: 0
|
|
237
291
|
}
|
|
238
|
-
|
|
239
|
-
|
|
292
|
+
],
|
|
293
|
+
success: false
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Fallback formatting: split document by semicolons and format each statement independently
|
|
299
|
+
* This is used when the primary formatting fails due to parse errors
|
|
300
|
+
* IMPORTANT: Preserves original separators (blank lines and comments) between statements
|
|
301
|
+
*/
|
|
302
|
+
doStatementByStatementFormatting(document, options) {
|
|
303
|
+
const text = document.getText();
|
|
304
|
+
const lines = text.split('\n');
|
|
305
|
+
const allEdits = [];
|
|
306
|
+
const allErrors = [];
|
|
307
|
+
// Parse document into statement segments with separators preserved
|
|
308
|
+
const segments = this.splitIntoStatementSegments(lines);
|
|
309
|
+
let currentLineOffset = 0;
|
|
310
|
+
for (const segment of segments) {
|
|
311
|
+
if (segment.type === 'statement') {
|
|
312
|
+
// Format the statement
|
|
313
|
+
const statementText = segment.lines.join('\n');
|
|
314
|
+
const statementDoc = vscode_languageserver_textdocument_1.TextDocument.create(`${document.uri}#statement-${currentLineOffset}`, document.languageId, document.version, statementText);
|
|
315
|
+
try {
|
|
316
|
+
const stmtParsingValue = this._warehouse.parseDocument(statementDoc);
|
|
317
|
+
// Only format if parsing succeeded (no errors)
|
|
318
|
+
if (stmtParsingValue.errors.length === 0) {
|
|
319
|
+
// Use formatSQLFromText which handles normalization internally
|
|
320
|
+
const formattingOutput = (0, formatter_adapter_1.formatSQLFromText)(statementDoc.getText(), options, formatter_adapter_1.DEFAULT_FORMATTER_CONFIG);
|
|
321
|
+
// Adjust edit positions to match the original document
|
|
322
|
+
for (const edit of formattingOutput.edits) {
|
|
323
|
+
allEdits.push({
|
|
324
|
+
range: {
|
|
325
|
+
start: {
|
|
326
|
+
line: edit.range.start.line + currentLineOffset,
|
|
327
|
+
character: edit.range.start.character
|
|
328
|
+
},
|
|
329
|
+
end: {
|
|
330
|
+
line: edit.range.end.line + currentLineOffset,
|
|
331
|
+
character: edit.range.end.character
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
newText: edit.newText
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
// Collect formatting errors
|
|
338
|
+
for (const error of formattingOutput.errors) {
|
|
339
|
+
allErrors.push({
|
|
340
|
+
message: error.message,
|
|
341
|
+
line: (error.line ?? 0) + currentLineOffset
|
|
342
|
+
});
|
|
343
|
+
}
|
|
240
344
|
}
|
|
241
345
|
else {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
346
|
+
// Skip statements with parse errors
|
|
347
|
+
allErrors.push({
|
|
348
|
+
message: `Skipped statement due to parse errors`,
|
|
349
|
+
line: currentLineOffset
|
|
245
350
|
});
|
|
246
351
|
}
|
|
247
|
-
|
|
248
|
-
|
|
352
|
+
}
|
|
353
|
+
catch (e) {
|
|
354
|
+
// Skip this statement if formatting failed
|
|
355
|
+
allErrors.push({
|
|
356
|
+
message: `Statement formatting failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
357
|
+
line: currentLineOffset
|
|
358
|
+
});
|
|
249
359
|
}
|
|
250
360
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
361
|
+
// For 'separator' type segments, we don't format them - they are preserved as-is
|
|
362
|
+
// Move line offset forward
|
|
363
|
+
currentLineOffset += segment.lines.length;
|
|
364
|
+
}
|
|
365
|
+
return { edits: allEdits, errors: allErrors };
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Split lines into statement segments and separator segments
|
|
369
|
+
* Statement segments contain SQL statements (ending with semicolon)
|
|
370
|
+
* Separator segments contain blank lines and comments between statements
|
|
371
|
+
*
|
|
372
|
+
* NOTE: This method does NOT normalize separators anymore
|
|
373
|
+
* Normalization is done later via normalizeBlankLinesInEdits
|
|
374
|
+
*/
|
|
375
|
+
splitIntoStatementSegments(lines) {
|
|
376
|
+
const segments = [];
|
|
377
|
+
let currentStatementLines = [];
|
|
378
|
+
let currentSeparatorLines = [];
|
|
379
|
+
let inStatement = false;
|
|
380
|
+
for (let i = 0; i < lines.length; i++) {
|
|
381
|
+
const line = lines[i];
|
|
382
|
+
const trimmedLine = line.trim();
|
|
383
|
+
// Check if this is a comment or blank line
|
|
384
|
+
const isCommentOrBlank = trimmedLine.startsWith('--') || trimmedLine.length === 0;
|
|
385
|
+
if (!inStatement && !isCommentOrBlank) {
|
|
386
|
+
// Start of a new statement
|
|
387
|
+
// First, save any accumulated separator lines (preserve original)
|
|
388
|
+
if (currentSeparatorLines.length > 0) {
|
|
389
|
+
segments.push({ type: 'separator', lines: currentSeparatorLines });
|
|
390
|
+
currentSeparatorLines = [];
|
|
391
|
+
}
|
|
392
|
+
inStatement = true;
|
|
393
|
+
currentStatementLines.push(line);
|
|
394
|
+
}
|
|
395
|
+
else if (inStatement) {
|
|
396
|
+
// Continue building the current statement
|
|
397
|
+
currentStatementLines.push(line);
|
|
398
|
+
// Check if this line ends the statement (contains semicolon)
|
|
399
|
+
if (line.includes(';')) {
|
|
400
|
+
// Statement complete
|
|
401
|
+
segments.push({ type: 'statement', lines: currentStatementLines });
|
|
402
|
+
currentStatementLines = [];
|
|
403
|
+
inStatement = false;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
// Not in a statement and this is a comment or blank line
|
|
408
|
+
currentSeparatorLines.push(line);
|
|
259
409
|
}
|
|
260
410
|
}
|
|
261
|
-
|
|
411
|
+
// Handle remaining lines
|
|
412
|
+
if (currentSeparatorLines.length > 0) {
|
|
413
|
+
segments.push({ type: 'separator', lines: currentSeparatorLines });
|
|
414
|
+
}
|
|
415
|
+
if (currentStatementLines.length > 0 && currentStatementLines.some(l => l.trim().length > 0)) {
|
|
416
|
+
// Last statement without semicolon
|
|
417
|
+
segments.push({ type: 'statement', lines: currentStatementLines });
|
|
262
418
|
}
|
|
263
|
-
return
|
|
419
|
+
return segments;
|
|
264
420
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
|
|
421
|
+
/**
|
|
422
|
+
* Normalize separator lines (blank lines + comments between statements)
|
|
423
|
+
* NOTE: This method is no longer used as normalization is done via normalizeBlankLinesInEdits
|
|
424
|
+
* Kept for potential future use
|
|
425
|
+
*/
|
|
426
|
+
normalizeSeparator(lines) {
|
|
427
|
+
const result = ['']; // Always start with 1 blank line
|
|
428
|
+
let lastWasBlank = true; // We just added a blank line
|
|
429
|
+
for (const line of lines) {
|
|
430
|
+
const trimmedLine = line.trim();
|
|
431
|
+
const isBlank = trimmedLine.length === 0;
|
|
432
|
+
const isComment = trimmedLine.startsWith('--');
|
|
433
|
+
if (isComment) {
|
|
434
|
+
// Always preserve comments
|
|
435
|
+
result.push(line);
|
|
436
|
+
lastWasBlank = false;
|
|
437
|
+
}
|
|
438
|
+
else if (isBlank) {
|
|
439
|
+
// Only add blank line if the last line wasn't blank (prevent consecutive blanks)
|
|
440
|
+
if (!lastWasBlank) {
|
|
441
|
+
result.push('');
|
|
442
|
+
lastWasBlank = true;
|
|
443
|
+
}
|
|
444
|
+
// Otherwise skip this blank line
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
// Non-comment, non-blank content (shouldn't happen in separators, but handle it)
|
|
448
|
+
result.push(line);
|
|
449
|
+
lastWasBlank = false;
|
|
450
|
+
}
|
|
278
451
|
}
|
|
279
|
-
|
|
280
|
-
|
|
452
|
+
return result;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Normalize blank lines in the formatted result
|
|
456
|
+
* This is a simplified safe version that works on text directly
|
|
457
|
+
* Rules:
|
|
458
|
+
* - Remove excessive consecutive blank lines (2+ become 1)
|
|
459
|
+
* - Preserves comments and statement structure
|
|
460
|
+
*/
|
|
461
|
+
normalizeBlankLinesInEdits(document, edits) {
|
|
462
|
+
// If no edits, no need to normalize
|
|
463
|
+
if (edits.length === 0) {
|
|
464
|
+
return edits;
|
|
465
|
+
}
|
|
466
|
+
// Create a new document with edits applied
|
|
467
|
+
const text = document.getText();
|
|
468
|
+
const lines = text.split('\n');
|
|
469
|
+
// Apply edits using TextDocument.applyEdits logic
|
|
470
|
+
// Sort edits from bottom to top to avoid position shifting
|
|
471
|
+
const sortedEdits = [...edits].sort((a, b) => {
|
|
472
|
+
if (a.range.start.line !== b.range.start.line) {
|
|
473
|
+
return b.range.start.line - a.range.start.line;
|
|
474
|
+
}
|
|
475
|
+
return b.range.start.character - a.range.start.character;
|
|
476
|
+
});
|
|
477
|
+
// Build formatted text by applying edits
|
|
478
|
+
const result = lines.map((line, index) => ({ line, index }));
|
|
479
|
+
for (const edit of sortedEdits) {
|
|
480
|
+
const startLine = edit.range.start.line;
|
|
481
|
+
const endLine = edit.range.end.line;
|
|
482
|
+
if (startLine >= result.length)
|
|
483
|
+
continue;
|
|
484
|
+
// Handle single line edit
|
|
485
|
+
if (startLine === endLine) {
|
|
486
|
+
const lineObj = result[startLine];
|
|
487
|
+
const line = lineObj.line;
|
|
488
|
+
const before = line.substring(0, edit.range.start.character);
|
|
489
|
+
const after = line.substring(edit.range.end.character);
|
|
490
|
+
lineObj.line = before + edit.newText + after;
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
// Multi-line edit: remove lines and merge
|
|
494
|
+
if (endLine >= result.length)
|
|
495
|
+
continue;
|
|
496
|
+
const firstLine = result[startLine].line.substring(0, edit.range.start.character);
|
|
497
|
+
const lastLine = result[endLine].line.substring(edit.range.end.character);
|
|
498
|
+
result[startLine].line = firstLine + edit.newText + lastLine;
|
|
499
|
+
result.splice(startLine + 1, endLine - startLine);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const formattedLines = result.map(r => r.line);
|
|
503
|
+
// Now normalize blank lines
|
|
504
|
+
const normalizedLines = [];
|
|
505
|
+
let consecutiveBlankCount = 0;
|
|
506
|
+
let hasChanges = false;
|
|
507
|
+
for (let i = 0; i < formattedLines.length; i++) {
|
|
508
|
+
const line = formattedLines[i];
|
|
509
|
+
const isBlank = line.trim().length === 0;
|
|
510
|
+
if (isBlank) {
|
|
511
|
+
consecutiveBlankCount++;
|
|
512
|
+
// Only keep first blank line
|
|
513
|
+
if (consecutiveBlankCount === 1) {
|
|
514
|
+
normalizedLines.push(line);
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
// Skip this blank line
|
|
518
|
+
hasChanges = true;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
consecutiveBlankCount = 0;
|
|
523
|
+
normalizedLines.push(line);
|
|
524
|
+
}
|
|
281
525
|
}
|
|
526
|
+
// Only return new edit if we actually removed blank lines
|
|
527
|
+
if (!hasChanges) {
|
|
528
|
+
return edits;
|
|
529
|
+
}
|
|
530
|
+
// Create a single edit that replaces entire document
|
|
531
|
+
const normalizedText = normalizedLines.join('\n');
|
|
532
|
+
return [
|
|
533
|
+
{
|
|
534
|
+
range: {
|
|
535
|
+
start: { line: 0, character: 0 },
|
|
536
|
+
end: { line: lines.length - 1, character: lines[lines.length - 1].length }
|
|
537
|
+
},
|
|
538
|
+
newText: normalizedText
|
|
539
|
+
}
|
|
540
|
+
];
|
|
282
541
|
}
|
|
283
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Determine if we should use fallback formatting
|
|
544
|
+
* Criteria: Parse errors exist and the coverage is below 60%
|
|
545
|
+
*/
|
|
546
|
+
shouldUseFallbackFormatting(document, edits, _tree) {
|
|
547
|
+
const text = document.getText();
|
|
548
|
+
const totalLines = text.split('\n').length;
|
|
549
|
+
// Count how many lines have edits
|
|
550
|
+
const editedLines = new Set();
|
|
551
|
+
for (const edit of edits) {
|
|
552
|
+
for (let line = edit.range.start.line; line <= edit.range.end.line; line++) {
|
|
553
|
+
editedLines.add(line);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
const coverage = editedLines.size / totalLines;
|
|
557
|
+
// Use fallback if coverage is less than 60%
|
|
558
|
+
// This indicates that many statements were not formatted due to parse errors
|
|
559
|
+
// We use a conservative threshold to avoid triggering fallback unnecessarily
|
|
560
|
+
return coverage < 0.6;
|
|
561
|
+
}
|
|
562
|
+
doFoldingRanges(document, options = typings_1.DEFAULT_FOLDING_OPTIONS) {
|
|
563
|
+
const optionsHash = options.level || 'all';
|
|
564
|
+
// 使用 uri + optionsHash 作为缓存 key,支持不同选项独立缓存
|
|
565
|
+
const cacheKey = `${document.uri}#${optionsHash}`;
|
|
566
|
+
const currentVersion = document.version;
|
|
567
|
+
const currentText = document.getText();
|
|
568
|
+
const currentHash = this._hashText(currentText);
|
|
569
|
+
// 检查缓存 (包含 options)
|
|
570
|
+
const cached = this._foldingCache.get(cacheKey);
|
|
571
|
+
if (cached &&
|
|
572
|
+
cached.version === currentVersion &&
|
|
573
|
+
cached.textHash === currentHash &&
|
|
574
|
+
cached.optionsHash === optionsHash) {
|
|
575
|
+
return cached.ranges;
|
|
576
|
+
}
|
|
577
|
+
// 缓存未命中,重新计算
|
|
284
578
|
const parsingValue = this._warehouse.getParsingValue(document);
|
|
285
|
-
const listener = new statement_listener_1.StatementListener(document);
|
|
579
|
+
const listener = new statement_listener_1.StatementListener(document, options.level || 'all');
|
|
286
580
|
tree_1.ParseTreeWalker.DEFAULT.walk(listener, parsingValue.tree);
|
|
287
|
-
const
|
|
288
|
-
|
|
581
|
+
const foldingRanges = listener.getFoldingRanges();
|
|
582
|
+
const result = foldingRanges.map(info => (0, protocol_translation_1.toFoldingRange)(info.range, info.kind));
|
|
583
|
+
// 更新缓存 (lastAccess 由 LRUFoldingCache.set 自动设置)
|
|
584
|
+
this._foldingCache.set(cacheKey, {
|
|
585
|
+
ranges: result,
|
|
586
|
+
version: currentVersion,
|
|
587
|
+
textHash: currentHash,
|
|
588
|
+
optionsHash: optionsHash,
|
|
589
|
+
lastAccess: 0 // Will be overwritten by LRUFoldingCache.set
|
|
590
|
+
});
|
|
591
|
+
return result;
|
|
289
592
|
}
|
|
290
|
-
|
|
593
|
+
/**
|
|
594
|
+
* 清除指定文档的折叠缓存
|
|
595
|
+
* 清除所有与该文档 URI 相关的缓存(包括不同 options)
|
|
596
|
+
*/
|
|
597
|
+
clearFoldingCache(uri) {
|
|
598
|
+
this._foldingCache.deleteByPrefix(uri);
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* 简单文本哈希算法
|
|
602
|
+
*/
|
|
603
|
+
_hashText(text) {
|
|
604
|
+
let hash = 0;
|
|
605
|
+
for (let i = 0; i < text.length; i++) {
|
|
606
|
+
const char = text.charCodeAt(i);
|
|
607
|
+
hash = (hash << 5) - hash + char;
|
|
608
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
609
|
+
}
|
|
610
|
+
return hash;
|
|
611
|
+
}
|
|
612
|
+
doReferences(document, position, skipSelf = true) {
|
|
291
613
|
const parsingValue = this._warehouse.getParsingValue(document);
|
|
292
|
-
const
|
|
293
|
-
|
|
614
|
+
const tokens = parsingValue.tokenStream.getTokens();
|
|
615
|
+
const currentOffset = document.offsetAt(position);
|
|
616
|
+
const currentToken = tokens.find(token => {
|
|
617
|
+
return token.startIndex <= currentOffset && currentOffset <= token.stopIndex;
|
|
618
|
+
});
|
|
619
|
+
if (currentToken?.text === undefined) {
|
|
620
|
+
return [];
|
|
621
|
+
}
|
|
622
|
+
const listener = new tokens_collector_listener_1.TokensCollectorListener(document);
|
|
623
|
+
tree_1.ParseTreeWalker.DEFAULT.walk(listener, parsingValue.tree);
|
|
624
|
+
const semanticTokens = listener.getSemanticTokens();
|
|
625
|
+
const references = [];
|
|
626
|
+
const compareText = (str1, str2) => (0, utils_1.sanitizeText)(str1).localeCompare((0, utils_1.sanitizeText)(str2)) === 0;
|
|
627
|
+
const findReferences = (token) => {
|
|
628
|
+
if (currentToken.text && compareText(currentToken.text, token.name)) {
|
|
629
|
+
references.push(token.range);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
semanticTokens.forEach(findReferences);
|
|
633
|
+
if (skipSelf) {
|
|
634
|
+
return references.filter(range => !(0, protocol_translation_1.positionInRange)(document, position, range));
|
|
635
|
+
}
|
|
636
|
+
return references;
|
|
294
637
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
638
|
+
doCompletion(document, position) {
|
|
639
|
+
const sql = cursor_1.defaultCursor.insertAt(document.getText(), position);
|
|
640
|
+
const charStream = antlr4ts_1.CharStreams.fromString(sql);
|
|
641
|
+
const lexer = new SparkSQLLexer_1.SparkSQLLexer(charStream);
|
|
642
|
+
const tokenStream = new antlr4ts_1.CommonTokenStream(lexer);
|
|
643
|
+
const parser = new SparkSQLParser_1.SparkSQLParser(tokenStream);
|
|
644
|
+
parser.buildParseTree = true;
|
|
645
|
+
parser.removeErrorListeners();
|
|
646
|
+
const tree = parser.program();
|
|
647
|
+
const completionItems = [];
|
|
648
|
+
// Use SparkSQLCompletionParser for context-aware completions
|
|
649
|
+
const sqlCompletionParser = new completion_parser_1.SparkSQLCompletionParser(tree, cursor_1.defaultCursor);
|
|
650
|
+
const suggestions = sqlCompletionParser.getSuggestions({
|
|
651
|
+
getCatalogs: () => {
|
|
652
|
+
return this.schemaRegistry.getSchemaCatalogs();
|
|
653
|
+
},
|
|
654
|
+
getDatabases: args => {
|
|
655
|
+
return this.schemaRegistry.getSchemaDatabases(args);
|
|
656
|
+
},
|
|
657
|
+
getTables: args => {
|
|
658
|
+
return this.schemaRegistry.getSchemaTables(args);
|
|
659
|
+
},
|
|
660
|
+
getColumns: args => {
|
|
661
|
+
return this.schemaRegistry.getSchemaColumns(args);
|
|
305
662
|
}
|
|
663
|
+
});
|
|
664
|
+
completionItems.push(...suggestions);
|
|
665
|
+
const parsingValue = this._warehouse.getParsingValue(document);
|
|
666
|
+
const offset = document.offsetAt(position);
|
|
667
|
+
const token = parsingValue.tokenStream.getTokens().find(t => t.startIndex <= offset && offset <= t.stopIndex + 1);
|
|
668
|
+
if (!token) {
|
|
669
|
+
return { completionItems: [], identifiers: [] };
|
|
306
670
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
671
|
+
const core = new antlr4_c3_1.CodeCompletionCore(parsingValue.parser);
|
|
672
|
+
core.ignoredTokens = new Set(ignoredTokens);
|
|
673
|
+
core.preferredRules = new Set(preferredRules);
|
|
674
|
+
let index = token.tokenIndex;
|
|
675
|
+
if (token.type === SparkSQLLexer_1.SparkSQLLexer.DOT) {
|
|
676
|
+
index += 1;
|
|
677
|
+
}
|
|
678
|
+
const candidates = core.collectCandidates(index);
|
|
679
|
+
const identifiers = [];
|
|
680
|
+
if (candidates.rules.size > 0) {
|
|
681
|
+
if (candidates.rules.has(SparkSQLParser_1.SparkSQLParser.RULE_functionName)) {
|
|
682
|
+
completionItems.push(...this.getBuiltInFunctionItems());
|
|
311
683
|
}
|
|
312
684
|
}
|
|
313
|
-
|
|
685
|
+
for (const candidate of Array.from(candidates.tokens)) {
|
|
686
|
+
const keyword = parsingValue.parser.vocabulary.getDisplayName(candidate[0]).replace(/'/g, '');
|
|
687
|
+
completionItems.push({
|
|
688
|
+
kind: lsp.CompletionItemKind.Keyword,
|
|
689
|
+
label: keyword,
|
|
690
|
+
insertText: keyword,
|
|
691
|
+
insertTextFormat: lsp.InsertTextFormat.Snippet
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
return { completionItems, identifiers };
|
|
695
|
+
}
|
|
696
|
+
parseStructure(document, options = { ignoreInsertSource: false, addCreateContext: false }) {
|
|
697
|
+
const parsingValue = this._warehouse.getParsingValue(document);
|
|
698
|
+
const listener = new structure_listener_1.SparkStructureListener(document);
|
|
699
|
+
tree_1.ParseTreeWalker.DEFAULT.walk(listener, parsingValue.tree);
|
|
700
|
+
let nodes = listener.getNodes();
|
|
701
|
+
let edges = listener.getEdges();
|
|
702
|
+
if (options.ignoreInsertSource) {
|
|
703
|
+
const tmp = (0, structure_listener_1.ignoreInsertSource)(nodes, edges);
|
|
704
|
+
nodes = tmp.nodes;
|
|
705
|
+
edges = tmp.edges;
|
|
706
|
+
}
|
|
707
|
+
if (options.addCreateContext) {
|
|
708
|
+
const tmp = (0, structure_listener_1.addFromCreateContext)(nodes, edges);
|
|
709
|
+
nodes = tmp.nodes;
|
|
710
|
+
edges = tmp.edges;
|
|
711
|
+
}
|
|
712
|
+
return { nodes, edges };
|
|
713
|
+
}
|
|
714
|
+
collectTokens(document, range) {
|
|
715
|
+
const parsingValue = range
|
|
716
|
+
? this._warehouse.parseDocument(document, range)
|
|
717
|
+
: this._warehouse.getParsingValue(document);
|
|
718
|
+
if (parsingValue.tokenCollection) {
|
|
719
|
+
return parsingValue.tokenCollection;
|
|
720
|
+
}
|
|
721
|
+
const listener = new tokens_collector_listener_1.TokensCollectorListener(document);
|
|
722
|
+
tree_1.ParseTreeWalker.DEFAULT.walk(listener, parsingValue.tree);
|
|
723
|
+
if (!range) {
|
|
724
|
+
this._warehouse.setTokenCollection(document, {
|
|
725
|
+
semanticTokens: listener.getSemanticTokens(),
|
|
726
|
+
stringTokens: listener.getStringTokens()
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
return { semanticTokens: listener.getSemanticTokens(), stringTokens: listener.getStringTokens() };
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Lineage
|
|
733
|
+
*/
|
|
734
|
+
getLineage(document, options = {}) {
|
|
735
|
+
const parsingValue = this._warehouse.getParsingValue(document);
|
|
736
|
+
const visitor = new lineage_visitor_1.LineageVisitor(options);
|
|
737
|
+
try {
|
|
738
|
+
parsingValue.tree.accept(visitor);
|
|
739
|
+
return visitor.getLineage();
|
|
740
|
+
}
|
|
741
|
+
catch (e) {
|
|
742
|
+
console.error(`Language Server: Lineage visitor traversal failed.\n\n${e}`);
|
|
743
|
+
return { nodes: [], edges: [] };
|
|
744
|
+
}
|
|
314
745
|
}
|
|
315
746
|
}
|
|
316
747
|
exports.LSPServer = LSPServer;
|
|
748
|
+
function isSemanticTokenReference(token1, token2) {
|
|
749
|
+
return (token1.name.replace(/['"`]/g, '').localeCompare(token2.name.replace(/['"`]/g, '')) === 0 &&
|
|
750
|
+
token1.type === token2.type);
|
|
751
|
+
}
|
|
317
752
|
//# sourceMappingURL=lsp-server.js.map
|