@xano/xanoscript-language-server 11.12.2 → 12.0.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/onCheckError/onCheckError.js +35 -28
- package/package.json +25 -1
- package/.claude/memory/feedback_no_git.md +0 -11
- package/.claude/settings.local.json +0 -21
- package/.github/copilot-instructions.md +0 -190
- package/.github/workflows/ci.yml +0 -31
- package/.husky/pre-commit +0 -1
- package/CLAUDE.md +0 -256
- package/eslint.config.js +0 -24
- package/lexer/comment.spec.js +0 -77
- package/lexer/multiline.spec.js +0 -179
- package/lexer/regexp.spec.js +0 -84
- package/lexer/tests/query/query_lexer.spec.js +0 -36
- package/lexer/tests/query/valid_sources/basic_query.xs +0 -44
- package/lexer/tests/query/valid_sources/db_query.xs +0 -77
- package/lexer/tests/query/valid_sources/empty_query.xs +0 -5
- package/lexer/tests/query/valid_sources/header_query.xs +0 -15
- package/lexer/tests/table/basic_table.xs +0 -17
- package/lexer/tests/table/empty_table.xs +0 -3
- package/lexer/tests/table/table_lexer.spec.js +0 -324
- package/lexer/utils.spec.js +0 -61
- package/onCompletion/contentAssist.spec.js +0 -275
- package/onDefinition/onDefinition.spec.js +0 -313
- package/onHover/FilterMessageProvider.spec.js +0 -85
- package/onHover/FunctionMessageProvider.spec.js +0 -128
- package/onHover/InputFilterMessageProvider.spec.js +0 -329
- package/onHover/QueryFilterMessageProvider.spec.js +0 -164
- package/onHover/onHoverDocument.spec.js +0 -660
- package/parser/addon_parser.spec.js +0 -88
- package/parser/agent_parser.spec.js +0 -599
- package/parser/agent_trigger_parser.spec.js +0 -525
- package/parser/api_group_parser.spec.js +0 -137
- package/parser/attributes/columnDefaultValueAttribute.spec.js +0 -49
- package/parser/attributes/descriptionFieldAttribute.spec.js +0 -39
- package/parser/attributes/disabledFieldAttribute.spec.js +0 -34
- package/parser/attributes/docsFieldAttribute.spec.js +0 -44
- package/parser/attributes/guidFieldAttribute.spec.js +0 -93
- package/parser/attributes/inputFilterFn.spec.js +0 -39
- package/parser/attributes/sensitiveFieldAttribute.spec.js +0 -39
- package/parser/attributes/valueFieldAttribute.spec.js +0 -54
- package/parser/attributes/valuesFieldAttribute.spec.js +0 -44
- package/parser/attributes/visibilityFieldAttribute.spec.js +0 -44
- package/parser/branch_parser.spec.js +0 -34
- package/parser/clauses/agentClause.spec.js +0 -34
- package/parser/clauses/authClause.spec.js +0 -39
- package/parser/clauses/cacheClause.spec.js +0 -103
- package/parser/clauses/canonicalClause.spec.js +0 -34
- package/parser/clauses/channelClause.spec.js +0 -34
- package/parser/clauses/dbTableClause.spec.js +0 -34
- package/parser/clauses/historyClause.spec.js +0 -53
- package/parser/clauses/indexClause.spec.js +0 -47
- package/parser/clauses/inputClause.spec.js +0 -96
- package/parser/clauses/mcpServerClause.spec.js +0 -34
- package/parser/clauses/middlewareClause.spec.js +0 -161
- package/parser/clauses/nakedStackFn.spec.js +0 -73
- package/parser/clauses/responseClause.spec.js +0 -47
- package/parser/clauses/scheduleClause.spec.js +0 -71
- package/parser/clauses/schemaClause.spec.js +0 -102
- package/parser/clauses/testClause.spec.js +0 -69
- package/parser/clauses/viewClause.spec.js +0 -163
- package/parser/definitions/arraySlice.spec.js +0 -49
- package/parser/definitions/columnDefinition.spec.js +0 -199
- package/parser/definitions/dbLinkColumnDefinition.spec.js +0 -45
- package/parser/definitions/enumColumnDefinition.spec.js +0 -108
- package/parser/definitions/filterDefinition.spec.js +0 -43
- package/parser/definitions/objectColumnDefinition.spec.js +0 -118
- package/parser/function_parser.spec.js +0 -131
- package/parser/functions/actionCallFn.spec.js +0 -51
- package/parser/functions/addonCallFn.spec.js +0 -41
- package/parser/functions/ai/aiAgentRunFn.spec.js +0 -94
- package/parser/functions/ai/aiExternalMcpServerDetailsFn.spec.js +0 -85
- package/parser/functions/ai/aiExternalMcpToolListFn.spec.js +0 -85
- package/parser/functions/ai/aiExternalMcpToolRunFn.spec.js +0 -101
- package/parser/functions/aiFn.spec.js +0 -51
- package/parser/functions/api/apiCallFn.spec.js +0 -62
- package/parser/functions/api/apiLambdaFn.spec.js +0 -63
- package/parser/functions/api/apiRealtimeEventFn.spec.js +0 -82
- package/parser/functions/api/apiRequestFn.spec.js +0 -113
- package/parser/functions/api/apiStreamFn.spec.js +0 -44
- package/parser/functions/api/webflowRequestFn.spec.js +0 -114
- package/parser/functions/array/arrayDifferenceFn.spec.js +0 -34
- package/parser/functions/array/arrayFindFn.spec.js +0 -44
- package/parser/functions/array/arrayGroupByFn.spec.js +0 -41
- package/parser/functions/array/arrayIntersectionFn.spec.js +0 -22
- package/parser/functions/array/arrayMapFn.spec.js +0 -37
- package/parser/functions/array/arrayNoValueAs.spec.js +0 -56
- package/parser/functions/array/arrayPartitionFn.spec.js +0 -29
- package/parser/functions/array/arrayUnionFn.spec.js +0 -22
- package/parser/functions/array/arrayValueIfAs.spec.js +0 -54
- package/parser/functions/array/arrayValueOnly.spec.js +0 -61
- package/parser/functions/array/valueAttrOnly.spec.js +0 -61
- package/parser/functions/cloud/cloudAlgoliaRequestFn.spec.js +0 -30
- package/parser/functions/cloud/cloudAwsS3Fn.spec.js +0 -21
- package/parser/functions/cloud/cloudDeleteFileFn.spec.js +0 -25
- package/parser/functions/cloud/cloudGetFileInfoFn.spec.js +0 -25
- package/parser/functions/cloud/cloudListDirectoryFn.spec.js +0 -26
- package/parser/functions/cloud/cloudReadFileFn.spec.js +0 -25
- package/parser/functions/cloud/cloudSearchDocumentFn.spec.js +0 -28
- package/parser/functions/cloud/cloudSearchQueryFn.spec.js +0 -32
- package/parser/functions/cloud/cloudSearchRequestFn.spec.js +0 -32
- package/parser/functions/cloud/cloudSignUrlFn.spec.js +0 -26
- package/parser/functions/cloud/cloudStorageFn.spec.js +0 -21
- package/parser/functions/cloud/cloudUploadFileFn.spec.js +0 -29
- package/parser/functions/controls/awaitFn.spec.js +0 -48
- package/parser/functions/controls/conditionalFn.spec.js +0 -188
- package/parser/functions/controls/forEachFn.spec.js +0 -109
- package/parser/functions/controls/forFn.spec.js +0 -85
- package/parser/functions/controls/functionRunFn.spec.js +0 -87
- package/parser/functions/controls/groupFn.spec.js +0 -63
- package/parser/functions/controls/preconditionFn.spec.js +0 -107
- package/parser/functions/controls/returnFn.spec.js +0 -44
- package/parser/functions/controls/switchFn.spec.js +0 -118
- package/parser/functions/controls/throwFn.spec.js +0 -56
- package/parser/functions/controls/tryCatchFn.spec.js +0 -193
- package/parser/functions/controls/whileFn.spec.js +0 -94
- package/parser/functions/db/dbAddFn.spec.js +0 -72
- package/parser/functions/db/dbAddOrEditFn.spec.js +0 -97
- package/parser/functions/db/dbBulkAddFn.spec.js +0 -94
- package/parser/functions/db/dbBulkDeleteFn.spec.js +0 -28
- package/parser/functions/db/dbBulkPatchFn.spec.js +0 -42
- package/parser/functions/db/dbBulkUpdateFn.spec.js +0 -42
- package/parser/functions/db/dbDelFn.spec.js +0 -67
- package/parser/functions/db/dbDirectQueryFn.spec.js +0 -104
- package/parser/functions/db/dbEditFn.spec.js +0 -122
- package/parser/functions/db/dbExternalDirectQueryFn.spec.js +0 -103
- package/parser/functions/db/dbGetFn.spec.js +0 -117
- package/parser/functions/db/dbHasFn.spec.js +0 -62
- package/parser/functions/db/dbPatchFn.spec.js +0 -88
- package/parser/functions/db/dbQueryFn.spec.js +0 -380
- package/parser/functions/db/dbSchemaFn.spec.js +0 -42
- package/parser/functions/db/dbSetDatasourceFn.spec.js +0 -44
- package/parser/functions/db/dbTransactionFn.spec.js +0 -63
- package/parser/functions/db/dbTruncateFn.spec.js +0 -42
- package/parser/functions/debug/debugLogFn.spec.js +0 -44
- package/parser/functions/debug/debugStopFn.spec.js +0 -44
- package/parser/functions/expect/unitExpectToBeWithinFn.spec.js +0 -63
- package/parser/functions/expect/unitExpectToThrowFn.spec.js +0 -40
- package/parser/functions/expect/unitExpectWithArgumentsFn.spec.js +0 -355
- package/parser/functions/expect/unitExpectWithoutArgumentsFn.spec.js +0 -69
- package/parser/functions/expect/workflowExpectToBeWithinFn.spec.js +0 -70
- package/parser/functions/expect/workflowExpectToThrowFn.spec.js +0 -56
- package/parser/functions/expect/workflowExpectWithArgumentsFn.spec.js +0 -308
- package/parser/functions/expect/workflowExpectWithoutArgumentsFn.spec.js +0 -87
- package/parser/functions/math/allMathFn.spec.js +0 -100
- package/parser/functions/middlewareCallFn.spec.js +0 -44
- package/parser/functions/object/objectEntriesFn.spec.js +0 -44
- package/parser/functions/object/objectKeysFn.spec.js +0 -44
- package/parser/functions/object/objectValuesFn.spec.js +0 -44
- package/parser/functions/redis/redisCountFn.spec.js +0 -58
- package/parser/functions/redis/redisDecrFn.spec.js +0 -47
- package/parser/functions/redis/redisDelFn.spec.js +0 -58
- package/parser/functions/redis/redisGetFn.spec.js +0 -67
- package/parser/functions/redis/redisHasFn.spec.js +0 -58
- package/parser/functions/redis/redisIncrFn.spec.js +0 -74
- package/parser/functions/redis/redisKeysFn.spec.js +0 -67
- package/parser/functions/redis/redisPopFn.spec.js +0 -75
- package/parser/functions/redis/redisPushFn.spec.js +0 -71
- package/parser/functions/redis/redisRangeFn.spec.js +0 -80
- package/parser/functions/redis/redisRateLimitFn.spec.js +0 -87
- package/parser/functions/redis/redisRemoveFn.spec.js +0 -65
- package/parser/functions/redis/redisSetFn.spec.js +0 -89
- package/parser/functions/redis/redisShiftFn.spec.js +0 -75
- package/parser/functions/redis/redisUnshiftFn.spec.js +0 -73
- package/parser/functions/schema/schemaFn.spec.js +0 -92
- package/parser/functions/schema/schemaParseArrayFn.spec.js +0 -134
- package/parser/functions/schema/schemaParseAttributeFn.spec.js +0 -285
- package/parser/functions/schema/schemaParseConstantFn.spec.js +0 -122
- package/parser/functions/schema/schemaParseEnum.spec.js +0 -47
- package/parser/functions/schema/schemaParseImmutableFn.spec.js +0 -99
- package/parser/functions/schema/schemaParseObjectFn.spec.js +0 -223
- package/parser/functions/schema/utils.spec.js +0 -27
- package/parser/functions/security/securityCheckPasswordFn.spec.js +0 -22
- package/parser/functions/security/securityCreateAuthTokenFn.spec.js +0 -51
- package/parser/functions/security/securityCreateCurveKeyFn.spec.js +0 -22
- package/parser/functions/security/securityCreatePasswordFn.spec.js +0 -26
- package/parser/functions/security/securityCreateRsaKeyFn.spec.js +0 -22
- package/parser/functions/security/securityCreateSecretKeyFn.spec.js +0 -22
- package/parser/functions/security/securityCreateUuidFn.spec.js +0 -27
- package/parser/functions/security/securityDecryptFn.spec.js +0 -24
- package/parser/functions/security/securityEncryptFn.spec.js +0 -24
- package/parser/functions/security/securityJweDecodeFn.spec.js +0 -26
- package/parser/functions/security/securityJweDecodeLegacyFn.spec.js +0 -26
- package/parser/functions/security/securityJweEncodeFn.spec.js +0 -26
- package/parser/functions/security/securityJweEncodeLegacyFn.spec.js +0 -25
- package/parser/functions/security/securityJwsDecodeFn.spec.js +0 -25
- package/parser/functions/security/securityJwsEncodeFn.spec.js +0 -25
- package/parser/functions/security/securityRandomBytesFn.spec.js +0 -21
- package/parser/functions/security/securityRandomNumberFn.spec.js +0 -22
- package/parser/functions/storage/storageCreateAttachmentFn.spec.js +0 -87
- package/parser/functions/storage/storageCreateAudioFn.spec.js +0 -98
- package/parser/functions/storage/storageCreateFileResourceFn.spec.js +0 -72
- package/parser/functions/storage/storageCreateImageFn.spec.js +0 -98
- package/parser/functions/storage/storageCreateVideoFn.spec.js +0 -99
- package/parser/functions/storage/storageDeleteFileFn.spec.js +0 -67
- package/parser/functions/storage/storageReadFileResourceFn.spec.js +0 -60
- package/parser/functions/storage/storageSignPrivateUrlFn.spec.js +0 -72
- package/parser/functions/stream/streamFromCsvFn.spec.js +0 -69
- package/parser/functions/stream/streamFromJsonlFn.spec.js +0 -47
- package/parser/functions/stream/streamFromRequestFn.spec.js +0 -103
- package/parser/functions/text/allTextWithReturnValueFn.spec.js +0 -100
- package/parser/functions/text/allTextWithoutReturnValueFn.spec.js +0 -122
- package/parser/functions/toolCallFn.spec.js +0 -28
- package/parser/functions/triggerCallFn.spec.js +0 -51
- package/parser/functions/unitExpectFn.spec.js +0 -21
- package/parser/functions/util/utilGeoDistanceFn.spec.js +0 -79
- package/parser/functions/util/utilGetAllInputFn.spec.js +0 -33
- package/parser/functions/util/utilGetEnvFn.spec.js +0 -33
- package/parser/functions/util/utilGetRawInputFn.spec.js +0 -62
- package/parser/functions/util/utilGetVarsFn.spec.js +0 -33
- package/parser/functions/util/utilIpLookupFn.spec.js +0 -37
- package/parser/functions/util/utilPostProcessFn.spec.js +0 -63
- package/parser/functions/util/utilSendEmailFn.spec.js +0 -62
- package/parser/functions/util/utilSetHeaderFn.spec.js +0 -48
- package/parser/functions/util/utilSleepFn.spec.js +0 -44
- package/parser/functions/util/utilTemplateFn.spec.js +0 -78
- package/parser/functions/varFn.spec.js +0 -332
- package/parser/functions/workflowExpectFn.spec.js +0 -32
- package/parser/functions/zip/zipAddToArchiveFn.spec.js +0 -78
- package/parser/functions/zip/zipCreateArchiveFn.spec.js +0 -53
- package/parser/functions/zip/zipDeleteFromArchiveFn.spec.js +0 -69
- package/parser/functions/zip/zipExtractFn.spec.js +0 -52
- package/parser/functions/zip/zipViewContentsFn.spec.js +0 -52
- package/parser/generic/arrayWithValues.spec.js +0 -72
- package/parser/generic/asVariable.spec.js +0 -117
- package/parser/generic/assignableVariableAs.spec.js +0 -126
- package/parser/generic/assignableVariableProperty.spec.js +0 -138
- package/parser/generic/castedValue.spec.js +0 -29
- package/parser/generic/chainedIdentifier.spec.js +0 -89
- package/parser/generic/completeAuthVariable.spec.js +0 -23
- package/parser/generic/completeEnvVariable.spec.js +0 -99
- package/parser/generic/completeErrorVariable.spec.js +0 -17
- package/parser/generic/completeInputVariable.spec.js +0 -53
- package/parser/generic/expressionFn.spec.js +0 -605
- package/parser/generic/filterFn.spec.js +0 -47
- package/parser/generic/functionAttrReq.spec.js +0 -353
- package/parser/generic/longFormVariable.spec.js +0 -25
- package/parser/generic/minimalFnBody.spec.js +0 -47
- package/parser/generic/mockAttribute.spec.js +0 -57
- package/parser/generic/multilineFilterFn.spec.js +0 -51
- package/parser/generic/objectWithAttributes.spec.js +0 -147
- package/parser/generic/requiredValueFnBody.spec.js +0 -56
- package/parser/generic/shortFormVariable.spec.js +0 -27
- package/parser/generic/stringArray.spec.js +0 -55
- package/parser/generic/tagsAttribute.spec.js +0 -47
- package/parser/generic/variableOnly.spec.js +0 -47
- package/parser/mcp_server_parser.spec.js +0 -478
- package/parser/mcp_server_trigger_parser.spec.js +0 -396
- package/parser/metadata/columnMetadataDefinition.spec.js +0 -47
- package/parser/metadata/enumColumnMetadataDefinition.spec.js +0 -81
- package/parser/middleware_parser.spec.js +0 -230
- package/parser/multidoc.spec.js +0 -946
- package/parser/query_parser.spec.js +0 -202
- package/parser/realtime_channel_parser.spec.js +0 -20
- package/parser/realtime_trigger_parser.spec.js +0 -469
- package/parser/run_parser.spec.js +0 -100
- package/parser/table_parser.spec.js +0 -176
- package/parser/table_trigger_parser.spec.js +0 -478
- package/parser/task_parser.spec.js +0 -94
- package/parser/tests/agent/agent_parser.spec.js +0 -52
- package/parser/tests/agent/valid_sources/customer_servier_agent.xs +0 -45
- package/parser/tests/api_group/api_group_parser.spec.js +0 -52
- package/parser/tests/api_group/valid_sources/api_group_history.xs +0 -4
- package/parser/tests/api_group/valid_sources/basic_api_group.xs +0 -3
- package/parser/tests/api_group/valid_sources/complete_api_group.xs +0 -7
- package/parser/tests/api_group/valid_sources/protected_api_group.xs +0 -7
- package/parser/tests/function/function_parser.spec.js +0 -52
- package/parser/tests/function/valid_sources/all_controls.xs +0 -68
- package/parser/tests/function/valid_sources/all_query_return_types.xs +0 -227
- package/parser/tests/function/valid_sources/all_storage.xs +0 -45
- package/parser/tests/function/valid_sources/discord_poll_send_to_slack.xs +0 -133
- package/parser/tests/function/valid_sources/expression_in_response.xs +0 -22
- package/parser/tests/function/valid_sources/filter_by_value.xs +0 -55
- package/parser/tests/function/valid_sources/filter_query.xs +0 -82
- package/parser/tests/function/valid_sources/large_regex.xs +0 -13
- package/parser/tests/function/valid_sources/ledash_ends_with.xs +0 -90
- package/parser/tests/function/valid_sources/multiline_description.xs +0 -28
- package/parser/tests/function/valid_sources/multiline_expr.xs +0 -41
- package/parser/tests/function/valid_sources/set_theory_fn.xs +0 -129
- package/parser/tests/function/valid_sources/simple_unit_test.xs +0 -33
- package/parser/tests/function/valid_sources/valid_officer.xs +0 -57
- package/parser/tests/function/valid_sources/webflow.xs +0 -18
- package/parser/tests/query/query_parser.spec.js +0 -54
- package/parser/tests/query/valid_sources/all_basics.xs +0 -51
- package/parser/tests/query/valid_sources/all_cloud.xs +0 -141
- package/parser/tests/query/valid_sources/all_db.xs +0 -102
- package/parser/tests/query/valid_sources/all_external_db.xs +0 -43
- package/parser/tests/query/valid_sources/all_keywords.xs +0 -65
- package/parser/tests/query/valid_sources/all_math.xs +0 -53
- package/parser/tests/query/valid_sources/all_object.xs +0 -25
- package/parser/tests/query/valid_sources/all_redis.xs +0 -106
- package/parser/tests/query/valid_sources/all_security.xs +0 -105
- package/parser/tests/query/valid_sources/all_stream.xs +0 -69
- package/parser/tests/query/valid_sources/all_text.xs +0 -54
- package/parser/tests/query/valid_sources/all_util.xs +0 -66
- package/parser/tests/query/valid_sources/all_zip.xs +0 -39
- package/parser/tests/query/valid_sources/arrays.xs +0 -33
- package/parser/tests/query/valid_sources/disabled_response.xs +0 -27
- package/parser/tests/query/valid_sources/multiline_lambda_GET.xs +0 -50
- package/parser/tests/query/valid_sources/mutliline_query.xs +0 -140
- package/parser/tests/query/valid_sources/patch_expression_multiline.xs +0 -27
- package/parser/tests/query/valid_sources/query_cache.xs +0 -34
- package/parser/tests/query/valid_sources/query_example.xs +0 -43
- package/parser/tests/query/valid_sources/query_mini.xs +0 -11
- package/parser/tests/query/valid_sources/query_rich_inputs.xs +0 -32
- package/parser/tests/query/valid_sources/simple_unit_test.xs +0 -33
- package/parser/tests/query/valid_sources/test_with_slashes.xs +0 -22
- package/parser/tests/query/valid_sources/with_unit_test.xs +0 -97
- package/parser/tests/table/table_parser.spec.js +0 -52
- package/parser/tests/table/valid_sources/account.xs +0 -31
- package/parser/tests/table/valid_sources/all_basic_columns.xs +0 -44
- package/parser/tests/table/valid_sources/basic_table.xs +0 -15
- package/parser/tests/table/valid_sources/empty_object.xs +0 -17
- package/parser/tests/table/valid_sources/empty_table.xs +0 -3
- package/parser/tests/table/valid_sources/multiline_index.xs +0 -33
- package/parser/tests/table/valid_sources/relation.xs +0 -44
- package/parser/tests/table/valid_sources/rich_columns.xs +0 -31
- package/parser/tests/table/valid_sources/table_with_comments.xs +0 -17
- package/parser/tests/table/valid_sources/table_with_search_index.xs +0 -31
- package/parser/tests/table/valid_sources/view_table.xs +0 -62
- package/parser/tests/task/task_parser.spec.js +0 -53
- package/parser/tests/task/valid_sources/active_event.xs +0 -11
- package/parser/tests/task/valid_sources/all_events.xs +0 -17
- package/parser/tests/task/valid_sources/create_leak.xs +0 -165
- package/parser/tests/task/valid_sources/daily_sales_report.xs +0 -56
- package/parser/tests/task/valid_sources/inactive_event.xs +0 -11
- package/parser/tests/variable_test/coverage_check.xs +0 -293
- package/parser/tests/workflow_test/valid_sources/basic_workflow_test.xs +0 -13
- package/parser/tests/workflow_test/workflow_test_parser.spec.js +0 -52
- package/parser/tool_parser.spec.js +0 -115
- package/parser/variableValidator.spec.js +0 -179
- package/parser/workflow_test_parser.spec.js +0 -136
- package/parser/workspace_parser.spec.js +0 -142
- package/parser/workspace_trigger_parser.spec.js +0 -332
- package/toTmLanguage.js +0 -75
- package/utils.spec.js +0 -369
- package/workspace/crossFileValidator.spec.js +0 -654
- package/workspace/referenceTracking.spec.js +0 -420
- package/workspace/workspaceIndex.spec.js +0 -189
|
@@ -1,660 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { describe, it } from "mocha";
|
|
3
|
-
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
4
|
-
import { FilterMessageProvider } from "./FilterMessageProvider.js";
|
|
5
|
-
import { FunctionMessageProvider } from "./FunctionMessageProvider.js";
|
|
6
|
-
import { InputFilterMessageProvider } from "./InputFilterMessageProvider.js";
|
|
7
|
-
import { InputVariableMessageProvider } from "./InputVariableMessageProvider.js";
|
|
8
|
-
import { onHoverDocument } from "./onHoverDocument.js";
|
|
9
|
-
import { QueryFilterMessageProvider } from "./queryFilterMessageProvider.js";
|
|
10
|
-
|
|
11
|
-
// Mock markdown content for tests
|
|
12
|
-
const testFiltersMd = `
|
|
13
|
-
# trim
|
|
14
|
-
Removes excess whitespace from the beginning and end of the entry.
|
|
15
|
-
|
|
16
|
-
# min
|
|
17
|
-
Enforces a minimum value or length for the entry.
|
|
18
|
-
|
|
19
|
-
# max
|
|
20
|
-
Enforces a maximum value or length for the entry.
|
|
21
|
-
|
|
22
|
-
# upper
|
|
23
|
-
Converts all characters to uppercase.
|
|
24
|
-
|
|
25
|
-
# !lower:to_lower
|
|
26
|
-
Converts all characters to lowercase.
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
const testInputFiltersMd = `
|
|
30
|
-
# trim
|
|
31
|
-
Removes excess whitespace from the beginning and end of the entry.
|
|
32
|
-
|
|
33
|
-
# min
|
|
34
|
-
Enforces a minimum value or length for the entry.
|
|
35
|
-
|
|
36
|
-
# max
|
|
37
|
-
Enforces a maximum value or length for the entry.
|
|
38
|
-
|
|
39
|
-
# lower
|
|
40
|
-
Converts all characters to lowercase.
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
const testFunctionsMd = `
|
|
44
|
-
# api.lambda
|
|
45
|
-
Execute serverless function code in the cloud
|
|
46
|
-
|
|
47
|
-
# db.get
|
|
48
|
-
Retrieve data from database table
|
|
49
|
-
|
|
50
|
-
# var
|
|
51
|
-
Create a variable to store data
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
const testQueryFiltersMd = `
|
|
55
|
-
# inner_product
|
|
56
|
-
Provides the inner product between two vectors.
|
|
57
|
-
|
|
58
|
-
# cosine_distance
|
|
59
|
-
Provides the cosine distance between two vectors.
|
|
60
|
-
|
|
61
|
-
# distance
|
|
62
|
-
Provides the distance in meters between two geometries.
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
describe("onHoverDocument", () => {
|
|
66
|
-
const hoverProviders = [
|
|
67
|
-
new InputVariableMessageProvider(),
|
|
68
|
-
new FunctionMessageProvider(testFunctionsMd),
|
|
69
|
-
new InputFilterMessageProvider(testInputFiltersMd),
|
|
70
|
-
new FilterMessageProvider(testFiltersMd),
|
|
71
|
-
new QueryFilterMessageProvider(testQueryFiltersMd),
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
it("should return null when document is not found", () => {
|
|
75
|
-
const params = {
|
|
76
|
-
textDocument: { uri: "file://nonexistent.xs" },
|
|
77
|
-
position: { line: 0, character: 0 },
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const result = onHoverDocument(params, { get: () => null }, hoverProviders);
|
|
81
|
-
expect(result).to.be.null;
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("should return null for invalid token position", () => {
|
|
85
|
-
const code = `query test verb=GET {
|
|
86
|
-
response = "hello"
|
|
87
|
-
}`;
|
|
88
|
-
|
|
89
|
-
const document = TextDocument.create(
|
|
90
|
-
"file://test.xs",
|
|
91
|
-
"xanoscript",
|
|
92
|
-
1,
|
|
93
|
-
code
|
|
94
|
-
);
|
|
95
|
-
const params = {
|
|
96
|
-
textDocument: { uri: "file://test.xs" },
|
|
97
|
-
position: { line: 0, character: 0 }, // Position on whitespace
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const result = onHoverDocument(
|
|
101
|
-
params,
|
|
102
|
-
{ get: () => document },
|
|
103
|
-
hoverProviders
|
|
104
|
-
);
|
|
105
|
-
expect(result).to.be.null;
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it("should return null when no hover provider matches", () => {
|
|
109
|
-
const code = `query test verb=GET {
|
|
110
|
-
response = "hello"
|
|
111
|
-
}`;
|
|
112
|
-
|
|
113
|
-
const document = TextDocument.create(
|
|
114
|
-
"file://test.xs",
|
|
115
|
-
"xanoscript",
|
|
116
|
-
1,
|
|
117
|
-
code
|
|
118
|
-
);
|
|
119
|
-
const params = {
|
|
120
|
-
textDocument: { uri: "file://test.xs" },
|
|
121
|
-
position: { line: 0, character: 6 }, // Position on "test" which shouldn't match any provider
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const result = onHoverDocument(
|
|
125
|
-
params,
|
|
126
|
-
{ get: () => document },
|
|
127
|
-
hoverProviders
|
|
128
|
-
);
|
|
129
|
-
expect(result).to.be.null;
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("should return the deprecation message for deprecated filters", () => {
|
|
133
|
-
const code = `query test verb=GET {
|
|
134
|
-
input {
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
stack {
|
|
138
|
-
var $result {
|
|
139
|
-
value = $input.name|max:1:2|lower
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
response = $result.value
|
|
144
|
-
}`;
|
|
145
|
-
|
|
146
|
-
const document = TextDocument.create(
|
|
147
|
-
"file://test.xs",
|
|
148
|
-
"xanoscript",
|
|
149
|
-
1,
|
|
150
|
-
code
|
|
151
|
-
);
|
|
152
|
-
const params = {
|
|
153
|
-
textDocument: { uri: "file://test.xs" },
|
|
154
|
-
position: { line: 6, character: 34 }, // Position on "lower" in the filter
|
|
155
|
-
};
|
|
156
|
-
const result = onHoverDocument(
|
|
157
|
-
params,
|
|
158
|
-
{ get: () => document },
|
|
159
|
-
hoverProviders
|
|
160
|
-
);
|
|
161
|
-
expect(result).to.not.be.null;
|
|
162
|
-
expect(result).to.have.property("contents");
|
|
163
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
164
|
-
expect(result.contents).to.have.property("value");
|
|
165
|
-
expect(result.contents.value).to.equal(
|
|
166
|
-
"`lower` is deprecated, use `to_lower` instead."
|
|
167
|
-
);
|
|
168
|
-
expect(result).to.have.property("range");
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("should return hover info for function tokens", () => {
|
|
172
|
-
const code = `query test verb=GET {
|
|
173
|
-
stack {
|
|
174
|
-
var $result {
|
|
175
|
-
value = "hello"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}`;
|
|
179
|
-
|
|
180
|
-
const document = TextDocument.create(
|
|
181
|
-
"file://test.xs",
|
|
182
|
-
"xanoscript",
|
|
183
|
-
1,
|
|
184
|
-
code
|
|
185
|
-
);
|
|
186
|
-
const params = {
|
|
187
|
-
textDocument: { uri: "file://test.xs" },
|
|
188
|
-
position: { line: 2, character: 4 }, // Position on "var"
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const result = onHoverDocument(
|
|
192
|
-
params,
|
|
193
|
-
{ get: () => document },
|
|
194
|
-
hoverProviders
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
if (result) {
|
|
198
|
-
expect(result).to.have.property("contents");
|
|
199
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
200
|
-
expect(result.contents).to.have.property("value");
|
|
201
|
-
expect(result).to.have.property("range");
|
|
202
|
-
expect(result.range).to.have.property("start");
|
|
203
|
-
expect(result.range).to.have.property("end");
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it("should return hover info for filter tokens", () => {
|
|
208
|
-
const code = `query test verb=GET {
|
|
209
|
-
input {
|
|
210
|
-
text name filters=trim
|
|
211
|
-
}
|
|
212
|
-
stack {
|
|
213
|
-
var $result { value = $input.name|to_upper }
|
|
214
|
-
}
|
|
215
|
-
}`;
|
|
216
|
-
|
|
217
|
-
const document = TextDocument.create(
|
|
218
|
-
"file://test.xs",
|
|
219
|
-
"xanoscript",
|
|
220
|
-
1,
|
|
221
|
-
code
|
|
222
|
-
);
|
|
223
|
-
const params = {
|
|
224
|
-
textDocument: { uri: "file://test.xs" },
|
|
225
|
-
position: { line: 2, character: 25 }, // Position on "trim" in filters=trim
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
const result = onHoverDocument(
|
|
229
|
-
params,
|
|
230
|
-
{ get: () => document },
|
|
231
|
-
hoverProviders
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
if (result) {
|
|
235
|
-
expect(result).to.have.property("contents");
|
|
236
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
237
|
-
expect(result.contents).to.have.property("value");
|
|
238
|
-
expect(result.range).to.have.property("start");
|
|
239
|
-
expect(result.range).to.have.property("end");
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it("should return hover info for pipe filter tokens", () => {
|
|
244
|
-
const code = `query test verb=GET {
|
|
245
|
-
stack {
|
|
246
|
-
var $result { value = $input.name|to_upper }
|
|
247
|
-
}
|
|
248
|
-
}`;
|
|
249
|
-
|
|
250
|
-
const document = TextDocument.create(
|
|
251
|
-
"file://test.xs",
|
|
252
|
-
"xanoscript",
|
|
253
|
-
1,
|
|
254
|
-
code
|
|
255
|
-
);
|
|
256
|
-
const params = {
|
|
257
|
-
textDocument: { uri: "file://test.xs" },
|
|
258
|
-
position: { line: 2, character: 37 }, // Position on "to_upper" after pipe
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const result = onHoverDocument(
|
|
262
|
-
params,
|
|
263
|
-
{ get: () => document },
|
|
264
|
-
hoverProviders
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
if (result) {
|
|
268
|
-
expect(result).to.have.property("contents");
|
|
269
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
270
|
-
expect(result.contents).to.have.property("value");
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
it("should handle empty hover providers array", () => {
|
|
275
|
-
const code = `query test verb=GET {
|
|
276
|
-
stack {
|
|
277
|
-
var $result { value = "hello" }
|
|
278
|
-
}
|
|
279
|
-
}`;
|
|
280
|
-
|
|
281
|
-
const document = TextDocument.create(
|
|
282
|
-
"file://test.xs",
|
|
283
|
-
"xanoscript",
|
|
284
|
-
1,
|
|
285
|
-
code
|
|
286
|
-
);
|
|
287
|
-
const params = {
|
|
288
|
-
textDocument: { uri: "file://test.xs" },
|
|
289
|
-
position: { line: 2, character: 4 }, // Position on "var"
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
const result = onHoverDocument(params, { get: () => document }, []);
|
|
293
|
-
expect(result).to.be.null;
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it("should return hover info for input filter tokens in column definition", () => {
|
|
297
|
-
const code = `table users {
|
|
298
|
-
text name filters=trim
|
|
299
|
-
email address filters=lower|trim
|
|
300
|
-
}`;
|
|
301
|
-
|
|
302
|
-
const document = TextDocument.create(
|
|
303
|
-
"file://test.xs",
|
|
304
|
-
"xanoscript",
|
|
305
|
-
1,
|
|
306
|
-
code
|
|
307
|
-
);
|
|
308
|
-
const params = {
|
|
309
|
-
textDocument: { uri: "file://test.xs" },
|
|
310
|
-
position: { line: 1, character: 20 }, // Position on "trim" in filters=trim
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
const result = onHoverDocument(
|
|
314
|
-
params,
|
|
315
|
-
{ get: () => document },
|
|
316
|
-
hoverProviders
|
|
317
|
-
);
|
|
318
|
-
|
|
319
|
-
if (result) {
|
|
320
|
-
expect(result).to.have.property("contents");
|
|
321
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
322
|
-
expect(result.contents).to.have.property("value");
|
|
323
|
-
expect(result.range).to.have.property("start");
|
|
324
|
-
expect(result.range).to.have.property("end");
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it("should handle lexer errors gracefully", () => {
|
|
329
|
-
const code = `invalid xanoscript syntax @#$%`;
|
|
330
|
-
|
|
331
|
-
const document = TextDocument.create(
|
|
332
|
-
"file://test.xs",
|
|
333
|
-
"xanoscript",
|
|
334
|
-
1,
|
|
335
|
-
code
|
|
336
|
-
);
|
|
337
|
-
const params = {
|
|
338
|
-
textDocument: { uri: "file://test.xs" },
|
|
339
|
-
position: { line: 0, character: 5 },
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
const result = onHoverDocument(
|
|
343
|
-
params,
|
|
344
|
-
{ get: () => document },
|
|
345
|
-
hoverProviders
|
|
346
|
-
);
|
|
347
|
-
expect(result).to.be.null;
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it("should return hover info for API function calls", () => {
|
|
351
|
-
const code = `query test verb=GET {
|
|
352
|
-
stack {
|
|
353
|
-
api.lambda {
|
|
354
|
-
code = "console.log('hello')"
|
|
355
|
-
}
|
|
356
|
-
var $result {
|
|
357
|
-
value = "response"
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}`;
|
|
361
|
-
|
|
362
|
-
const document = TextDocument.create(
|
|
363
|
-
"file://test.xs",
|
|
364
|
-
"xanoscript",
|
|
365
|
-
1,
|
|
366
|
-
code
|
|
367
|
-
);
|
|
368
|
-
const params = {
|
|
369
|
-
textDocument: { uri: "file://test.xs" },
|
|
370
|
-
position: { line: 2, character: 8 }, // Position on "lambda" in "api.lambda"
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
const result = onHoverDocument(
|
|
374
|
-
params,
|
|
375
|
-
{ get: () => document },
|
|
376
|
-
hoverProviders
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
expect(result).to.not.be.null;
|
|
380
|
-
expect(result).to.have.property("contents");
|
|
381
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
382
|
-
expect(result.contents).to.have.property("value");
|
|
383
|
-
expect(result.contents.value).to.include("Execute serverless function");
|
|
384
|
-
expect(result).to.have.property("range");
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
it("should return hover info for database function calls", () => {
|
|
388
|
-
const code = `query test verb=GET {
|
|
389
|
-
stack {
|
|
390
|
-
db.get 123 as $user {
|
|
391
|
-
id = $input.user_id
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}`;
|
|
395
|
-
|
|
396
|
-
const document = TextDocument.create(
|
|
397
|
-
"file://test.xs",
|
|
398
|
-
"xanoscript",
|
|
399
|
-
1,
|
|
400
|
-
code
|
|
401
|
-
);
|
|
402
|
-
const params = {
|
|
403
|
-
textDocument: { uri: "file://test.xs" },
|
|
404
|
-
position: { line: 2, character: 7 }, // Position on "get" in "db.get"
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
const result = onHoverDocument(
|
|
408
|
-
params,
|
|
409
|
-
{ get: () => document },
|
|
410
|
-
hoverProviders
|
|
411
|
-
);
|
|
412
|
-
|
|
413
|
-
expect(result).to.not.be.null;
|
|
414
|
-
expect(result).to.have.property("contents");
|
|
415
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
416
|
-
expect(result.contents).to.have.property("value");
|
|
417
|
-
expect(result.contents.value).to.include("Retrieve data from database");
|
|
418
|
-
expect(result).to.have.property("range");
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
it("should return hover info for variable function calls", () => {
|
|
422
|
-
const code = `query test verb=GET {
|
|
423
|
-
stack {
|
|
424
|
-
var $result {
|
|
425
|
-
value = "hello world"
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}`;
|
|
429
|
-
|
|
430
|
-
const document = TextDocument.create(
|
|
431
|
-
"file://test.xs",
|
|
432
|
-
"xanoscript",
|
|
433
|
-
1,
|
|
434
|
-
code
|
|
435
|
-
);
|
|
436
|
-
const params = {
|
|
437
|
-
textDocument: { uri: "file://test.xs" },
|
|
438
|
-
position: { line: 2, character: 4 }, // Position on "var"
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
const result = onHoverDocument(
|
|
442
|
-
params,
|
|
443
|
-
{ get: () => document },
|
|
444
|
-
hoverProviders
|
|
445
|
-
);
|
|
446
|
-
|
|
447
|
-
expect(result).to.not.be.null;
|
|
448
|
-
expect(result).to.have.property("contents");
|
|
449
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
450
|
-
expect(result.contents).to.have.property("value");
|
|
451
|
-
expect(result.contents.value).to.include("Create a variable");
|
|
452
|
-
expect(result).to.have.property("range");
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
it("should return hover info for var in second segment of multidoc", () => {
|
|
456
|
-
const code = `function foo {
|
|
457
|
-
input {
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
stack {
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
response = null
|
|
464
|
-
}
|
|
465
|
-
---
|
|
466
|
-
query test verb=GET {
|
|
467
|
-
stack {
|
|
468
|
-
var $result {
|
|
469
|
-
value = "hello"
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}`;
|
|
473
|
-
|
|
474
|
-
const document = TextDocument.create(
|
|
475
|
-
"file://test-multidoc.xs",
|
|
476
|
-
"xanoscript",
|
|
477
|
-
1,
|
|
478
|
-
code
|
|
479
|
-
);
|
|
480
|
-
const params = {
|
|
481
|
-
textDocument: { uri: "file://test-multidoc.xs" },
|
|
482
|
-
position: { line: 12, character: 4 }, // Position on "var" in second segment
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
const result = onHoverDocument(
|
|
486
|
-
params,
|
|
487
|
-
{ get: () => document },
|
|
488
|
-
hoverProviders
|
|
489
|
-
);
|
|
490
|
-
|
|
491
|
-
expect(result).to.not.be.null;
|
|
492
|
-
expect(result.contents.value).to.include("Create a variable");
|
|
493
|
-
expect(result).to.have.property("range");
|
|
494
|
-
// Range should be in the global document, not segment-local
|
|
495
|
-
expect(result.range.start.line).to.be.at.least(10);
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
it("should return hover info for input variable in multidoc segment", () => {
|
|
499
|
-
const code = `function foo {
|
|
500
|
-
input {
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
stack {
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
response = null
|
|
507
|
-
}
|
|
508
|
-
---
|
|
509
|
-
query test verb=GET {
|
|
510
|
-
input {
|
|
511
|
-
text username
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
stack {
|
|
515
|
-
var $result {
|
|
516
|
-
value = $input.username
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
response = $result
|
|
521
|
-
}`;
|
|
522
|
-
|
|
523
|
-
const document = TextDocument.create(
|
|
524
|
-
"file://test-multidoc-input.xs",
|
|
525
|
-
"xanoscript",
|
|
526
|
-
1,
|
|
527
|
-
code
|
|
528
|
-
);
|
|
529
|
-
// "username" after $input. in the second segment
|
|
530
|
-
const params = {
|
|
531
|
-
textDocument: { uri: "file://test-multidoc-input.xs" },
|
|
532
|
-
position: { line: 17, character: 20 },
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
const result = onHoverDocument(
|
|
536
|
-
params,
|
|
537
|
-
{ get: () => document },
|
|
538
|
-
hoverProviders
|
|
539
|
-
);
|
|
540
|
-
|
|
541
|
-
if (result) {
|
|
542
|
-
expect(result.contents.value).to.include("username");
|
|
543
|
-
expect(result.range.start.line).to.be.at.least(10);
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
it("should return hover info for first segment of multidoc", () => {
|
|
548
|
-
const code = `query test verb=GET {
|
|
549
|
-
stack {
|
|
550
|
-
var $result {
|
|
551
|
-
value = "hello"
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
---
|
|
556
|
-
function bar {
|
|
557
|
-
input {
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
stack {
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
response = null
|
|
564
|
-
}`;
|
|
565
|
-
|
|
566
|
-
const document = TextDocument.create(
|
|
567
|
-
"file://test-multidoc-first.xs",
|
|
568
|
-
"xanoscript",
|
|
569
|
-
1,
|
|
570
|
-
code
|
|
571
|
-
);
|
|
572
|
-
const params = {
|
|
573
|
-
textDocument: { uri: "file://test-multidoc-first.xs" },
|
|
574
|
-
position: { line: 2, character: 4 }, // "var" in first segment
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
const result = onHoverDocument(
|
|
578
|
-
params,
|
|
579
|
-
{ get: () => document },
|
|
580
|
-
hoverProviders
|
|
581
|
-
);
|
|
582
|
-
|
|
583
|
-
expect(result).to.not.be.null;
|
|
584
|
-
expect(result.contents.value).to.include("Create a variable");
|
|
585
|
-
expect(result.range.start.line).to.equal(2);
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
it("should return null for hover on separator line in multidoc", () => {
|
|
589
|
-
const code = `function foo {
|
|
590
|
-
input {
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
stack {
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
response = null
|
|
597
|
-
}
|
|
598
|
-
---
|
|
599
|
-
function bar {
|
|
600
|
-
input {
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
stack {
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
response = null
|
|
607
|
-
}`;
|
|
608
|
-
|
|
609
|
-
const document = TextDocument.create(
|
|
610
|
-
"file://test-multidoc-sep.xs",
|
|
611
|
-
"xanoscript",
|
|
612
|
-
1,
|
|
613
|
-
code
|
|
614
|
-
);
|
|
615
|
-
const params = {
|
|
616
|
-
textDocument: { uri: "file://test-multidoc-sep.xs" },
|
|
617
|
-
position: { line: 9, character: 1 }, // On the "---" separator line
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
const result = onHoverDocument(
|
|
621
|
-
params,
|
|
622
|
-
{ get: () => document },
|
|
623
|
-
hoverProviders
|
|
624
|
-
);
|
|
625
|
-
|
|
626
|
-
expect(result).to.be.null;
|
|
627
|
-
});
|
|
628
|
-
|
|
629
|
-
it("should return hover info for query filter tokens in search context", () => {
|
|
630
|
-
const code = `query books verb=GET {
|
|
631
|
-
where = $db.embedding.vector|inner_product:$input.query_vector
|
|
632
|
-
} as $matched_books`;
|
|
633
|
-
|
|
634
|
-
const document = TextDocument.create(
|
|
635
|
-
"file://test.xs",
|
|
636
|
-
"xanoscript",
|
|
637
|
-
1,
|
|
638
|
-
code
|
|
639
|
-
);
|
|
640
|
-
const params = {
|
|
641
|
-
textDocument: { uri: "file://test.xs" },
|
|
642
|
-
position: { line: 1, character: 32 }, // Position on "inner_product" (starts at column 32)
|
|
643
|
-
};
|
|
644
|
-
|
|
645
|
-
const result = onHoverDocument(
|
|
646
|
-
params,
|
|
647
|
-
{ get: () => document },
|
|
648
|
-
hoverProviders
|
|
649
|
-
);
|
|
650
|
-
|
|
651
|
-
expect(result).to.not.be.null;
|
|
652
|
-
expect(result).to.have.property("contents");
|
|
653
|
-
expect(result.contents).to.have.property("kind", "markdown");
|
|
654
|
-
expect(result.contents).to.have.property("value");
|
|
655
|
-
expect(result.contents.value).to.include(
|
|
656
|
-
"inner product between two vectors"
|
|
657
|
-
);
|
|
658
|
-
expect(result).to.have.property("range");
|
|
659
|
-
});
|
|
660
|
-
});
|