🧪 test: add LSP json fixtures and provider suite

This commit is contained in:
csh
2025-12-21 15:39:33 +08:00
parent 53f4588c53
commit bb0cbde79c
33 changed files with 2934 additions and 20 deletions
@@ -0,0 +1,7 @@
{
"jsonrpc": "2.0",
"method": "$/cancelRequest",
"params": {
"id": "nonexistent"
}
}
+5 -5
View File
@@ -1,17 +1,17 @@
{
"jsonrpc": "2.0",
"id": 1,
"id": 2,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///home/cobia/test_lsp/1.tsl"
"uri": "{{MAIN_UNIT_URI}}"
},
"position": {
"line": 2,
"character": 5
"line": 0,
"character": 0
},
"context": {
"triggerKind": 1
}
}
}
}
@@ -0,0 +1,14 @@
{
"jsonrpc": "2.0",
"id": 3,
"method": "completionItem/resolve",
"params": {
"label": "Widget",
"data": {
"ctx": "new",
"class": "Widget",
"unit": "MainUnit",
"uri": "{{MAIN_UNIT_URI}}"
}
}
}
@@ -0,0 +1,14 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "textDocument/definition",
"params": {
"textDocument": {
"uri": "{{MAIN_UNIT_URI}}"
},
"position": {
"line": 72,
"character": 2
}
}
}
+8 -8
View File
@@ -3,24 +3,24 @@
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///home/cobia/test_lsp/1.tsl",
"version": 4
"uri": "{{MAIN_UNIT_URI}}",
"version": 2
},
"contentChanges": [
{
"range": {
"start": {
"line": 2,
"character": 4
"line": 0,
"character": 0
},
"end": {
"line": 2,
"character": 4
"line": 0,
"character": 0
}
},
"rangeLength": 0,
"text": "e"
"text": " "
}
]
}
}
}
@@ -0,0 +1,9 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didClose",
"params": {
"textDocument": {
"uri": "{{MAIN_UNIT_URI}}"
}
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "{{MAIN_UNIT_URI}}",
"languageId": "tsl",
"version": 1,
"text": {{MAIN_UNIT_TEXT}}
}
}
}
+3 -3
View File
@@ -3,10 +3,10 @@
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///home/cobia/test_lsp/1.tsl",
"uri": "{{MAIN_UNIT_URI}}",
"languageId": "tsl",
"version": 1,
"text": "function aaa();\nbegin\nend;"
"text": {{MAIN_UNIT_TEXT}}
}
}
}
}
+4
View File
@@ -0,0 +1,4 @@
{
"jsonrpc": "2.0",
"method": "exit"
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"jsonrpc": "2.0",
"id": 0,
"id": 1,
"method": "initialize",
"params": {
"processId": 61310,
@@ -9,8 +9,8 @@
"version": "1.102.0"
},
"locale": "en",
"rootPath": "/home/cobia/test_lsp",
"rootUri": "file:///home/cobia/test_lsp",
"rootPath": "{{WORKSPACE_PATH}}",
"rootUri": "{{WORKSPACE_URI}}",
"capabilities": {
"workspace": {
"applyEdit": true,
@@ -479,7 +479,7 @@
"trace": "off",
"workspaceFolders": [
{
"uri": "file:///home/cobia/test_lsp",
"uri": "{{WORKSPACE_URI}}",
"name": "test_lsp"
}
]
@@ -0,0 +1,5 @@
{
"jsonrpc": "2.0",
"method": "initialized",
"params": {}
}
@@ -0,0 +1,17 @@
{
"jsonrpc": "2.0",
"id": 6,
"method": "textDocument/references",
"params": {
"textDocument": {
"uri": "{{RENAME_CASE_URI}}"
},
"position": {
"line": 1,
"character": 0
},
"context": {
"includeDeclaration": true
}
}
}
+15
View File
@@ -0,0 +1,15 @@
{
"jsonrpc": "2.0",
"id": 5,
"method": "textDocument/rename",
"params": {
"textDocument": {
"uri": "{{RENAME_CASE_URI}}"
},
"position": {
"line": 1,
"character": 0
},
"newName": "renamed"
}
}
+14
View File
@@ -0,0 +1,14 @@
initialize.json
initialized.json
setTrace.json
didOpen.json
completion.json
completion_resolve.json
definition.json
rename.json
references.json
didChange.json
cancelRequest.json
didClose.json
shutdown.json
exit.json
@@ -0,0 +1,7 @@
{
"jsonrpc": "2.0",
"method": "$/setTrace",
"params": {
"value": "verbose"
}
}
@@ -0,0 +1,5 @@
{
"jsonrpc": "2.0",
"id": 7,
"method": "shutdown"
}