forked from jeapostrophe/racket-langserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f283eb
commit fc37990
Showing
27 changed files
with
725 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#lang racket | ||
|
||
(require "../with-document.rkt" | ||
chk | ||
json) | ||
|
||
(define uri "file:///test.rkt") | ||
|
||
(define code | ||
#<<END | ||
#lang racket/base | ||
|
||
(define x 0) | ||
END | ||
) | ||
|
||
(module+ test | ||
(with-document "../../../main.rkt" uri code | ||
(λ (lsp) | ||
(let ([req (read-json (open-input-file "req1.json"))] | ||
[resp (read-json (open-input-file "resp1.json"))]) | ||
(client-send lsp req) | ||
|
||
(chk #:= (client-wait-response lsp) resp))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "textDocument/codeAction", | ||
"params": { | ||
"context": { | ||
"diagnostics": [] | ||
}, | ||
"range": { | ||
"end": { | ||
"character": 9, | ||
"line": 2 | ||
}, | ||
"start": { | ||
"character": 8, | ||
"line": 2 | ||
} | ||
}, | ||
"textDocument": { | ||
"uri": "file:///test.rkt" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": [ | ||
{ | ||
"diagnostics": [ | ||
{ | ||
"message": "unused variable", | ||
"range": { | ||
"end": { | ||
"character": 9, | ||
"line": 2 | ||
}, | ||
"start": { | ||
"character": 8, | ||
"line": 2 | ||
} | ||
}, | ||
"severity": 3, | ||
"source": "file:///test.rkt" | ||
} | ||
], | ||
"edit": { | ||
"changes": { | ||
"file:///test.rkt": [ | ||
{ | ||
"newText": "_", | ||
"range": { | ||
"end": { | ||
"character": 8, | ||
"line": 2 | ||
}, | ||
"start": { | ||
"character": 8, | ||
"line": 2 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"isPreferred": false, | ||
"kind": "quickfix", | ||
"title": "Add prefix `_` to ignore" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"method": "textDocument/didChange", | ||
"params": { | ||
"contentChanges": [ | ||
{ | ||
"range": { | ||
"end": { | ||
"character": 0, | ||
"line": 2 | ||
}, | ||
"start": { | ||
"character": 0, | ||
"line": 2 | ||
} | ||
}, | ||
"rangeLength": 0, | ||
"text": "()" | ||
} | ||
], | ||
"textDocument": { | ||
"uri": "file:///test.rkt", | ||
"version": 1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "textDocument/completion", | ||
"params": { | ||
"context": { | ||
"triggerCharacter": "(", | ||
"triggerKind": 2 | ||
}, | ||
"position": { | ||
"character": 1, | ||
"line": 2 | ||
}, | ||
"textDocument": { | ||
"uri": "file:///test.rkt" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#lang racket | ||
|
||
(require "../with-document.rkt" | ||
"../../../json-util.rkt" | ||
chk | ||
json) | ||
|
||
(define uri "file:///test.rkt") | ||
|
||
(define code | ||
#<<END | ||
#lang racket/base | ||
END | ||
) | ||
|
||
(module+ test | ||
(with-document "../../../main.rkt" uri code | ||
(λ (lsp) | ||
|
||
;; completion requires a document change. | ||
;; only move cursor to that position is not enough. | ||
(define didchange-req (read-json (open-input-file "change-req.json"))) | ||
(client-send lsp didchange-req) | ||
(client-wait-response lsp) | ||
|
||
(define comp-req (read-json (open-input-file "comp-req.json"))) | ||
(client-send lsp comp-req) | ||
;; we only verify the returned completion item list | ||
;; meet some conditions | ||
(let ([resp (client-wait-response lsp)]) | ||
(chk (jsexpr-has-key? resp '(result))) | ||
(define result (jsexpr-ref resp '(result))) | ||
(chk (list? result)) | ||
(chk (for/and ([item result]) | ||
(jsexpr-has-key? item '(label)))) | ||
(chk (for/and ([item result]) | ||
(string? (jsexpr-ref item '(label))))) | ||
(chk (for/and ([item result]) | ||
(not (string=? "" (jsexpr-ref item '(label)))))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "textDocument/definition", | ||
"params": { | ||
"position": { | ||
"character": 2, | ||
"line": 5 | ||
}, | ||
"textDocument": { | ||
"uri": "file:///test.rkt" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"end": { | ||
"character": 8, | ||
"line": 4 | ||
}, | ||
"start": { | ||
"character": 7, | ||
"line": 4 | ||
} | ||
}, | ||
"uri": "file:///test.rkt" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "textDocument/documentHighlight", | ||
"params": { | ||
"position": { | ||
"character": 2, | ||
"line": 5 | ||
}, | ||
"textDocument": { | ||
"uri": "file:///test.rkt" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": [ | ||
{ | ||
"range": { | ||
"end": { | ||
"character": 3, | ||
"line": 5 | ||
}, | ||
"start": { | ||
"character": 2, | ||
"line": 5 | ||
} | ||
} | ||
}, | ||
{ | ||
"range": { | ||
"end": { | ||
"character": 8, | ||
"line": 4 | ||
}, | ||
"start": { | ||
"character": 7, | ||
"line": 4 | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "textDocument/references", | ||
"params": { | ||
"context": { | ||
"includeDeclaration": true | ||
}, | ||
"position": { | ||
"character": 7, | ||
"line": 4 | ||
}, | ||
"textDocument": { | ||
"uri": "file:///test.rkt" | ||
} | ||
} | ||
} |
Oops, something went wrong.