Skip to content

Commit

Permalink
add select lib test
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Jul 16, 2024
1 parent 7b06ad5 commit 6eeb9ab
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions nixd/tools/nixd/test/completion-select-lib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# RUN: nixd --lit-test \
# RUN: --nixpkgs-expr="{ lib.hello.meta.description = \"Very Nice\"; }" \
# RUN: < %s | FileCheck %s


<-- 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":"lib.hel"
}
}
}
```

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///completion.nix"
},
"position": {
"line": 0,
"character": 6
},
"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"}
```

0 comments on commit 6eeb9ab

Please sign in to comment.