From 86dc0ba9f59e4d87969e5e9bd826c586994a6474 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Tue, 23 Jul 2024 13:44:38 +0800 Subject: [PATCH] nixd/test/completion: precommit `pkgs` failing test (#550) Dereferencing empty vector and thus crash. --- nixd/tools/nixd/test/completion/pkgs.md | 78 +++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 nixd/tools/nixd/test/completion/pkgs.md diff --git a/nixd/tools/nixd/test/completion/pkgs.md b/nixd/tools/nixd/test/completion/pkgs.md new file mode 100644 index 000000000..dbc300293 --- /dev/null +++ b/nixd/tools/nixd/test/completion/pkgs.md @@ -0,0 +1,78 @@ +# RUN: nixd --lit-test \ +# RUN: --nixpkgs-expr="{ lib.hello.meta.description = \"Very Nice\"; }" \ +# RUN: < %s | FileCheck %s +# XFAIL: * + + +<-- initialize(0) + +```json +{ + "jsonrpc":"2.0", + "id":0, + "method":"initialize", + "params":{ + "processId":123, + "rootPath":"", + "capabilities":{ + }, + "trace":"off" + } +} +``` + + +<-- textDocument/didOpen + + +```json +{ + "jsonrpc":"2.0", + "method":"textDocument/didOpen", + "params":{ + "textDocument":{ + "uri":"file:///completion.nix", + "languageId":"nix", + "version":1, + "text":"pkgs" + } + } +} +``` + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "file:///completion.nix" + }, + "position": { + "line": 0, + "character": 3 + }, + "context": { + "triggerKind": 1 + } + } +} +``` + +``` + CHECK: "isIncomplete": false, +CHECK-NEXT: "items": [ +CHECK-NEXT: { +CHECK-NEXT: "data": "{\"Prefix\":\"hel\",\"Scope\":[\"lib\"]}", +CHECK-NEXT: "kind": 5, +CHECK-NEXT: "label": "hello", +CHECK-NEXT: "score": 0 +CHECK-NEXT: } +CHECK-NEXT: ] +``` + + +```json +{"jsonrpc":"2.0","method":"exit"} +```