Skip to content

Instantly share code, notes, and snippets.

@tigersoldier
Created March 25, 2019 05:50
Show Gist options
  • Save tigersoldier/ebe8affda09d23ff01ac0820bacdab8e to your computer and use it in GitHub Desktop.
Save tigersoldier/ebe8affda09d23ff01ac0820bacdab8e to your computer and use it in GitHub Desktop.
PHP language server requests and responses
>>> php-ls:11041(async)
Content-Length: 253
{
"jsonrpc": "2.0",
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php"
},
"position": {
"line": 43,
"character": 18
}
},
"id": 86
}
<<<< php-ls:11041
{
"result": {
"isIncomplete": true,
"items": [
{
"label": "cooked",
"kind": 10,
"detail": "bool",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "__construct",
"kind": 4,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "cook_it",
"kind": 2,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "is_cooked",
"kind": 2,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "edible",
"kind": 10,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "color",
"kind": 10,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "__construct",
"kind": 4,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "is_edible",
"kind": 2,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
},
{
"label": "what_color",
"kind": 2,
"detail": "mixed",
"documentation": null,
"sortText": null,
"filterText": null,
"insertText": null,
"textEdit": null,
"additionalTextEdits": null,
"command": null,
"data": null
}
]
},
"id": 86,
"jsonrpc": "2.0"
}
>>> php-ls:11041(async)
Content-Length: 247
{
"jsonrpc": "2.0",
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php"
},
"position": {
"line": 43,
"character": 4
}
},
"id": 87
}
>>> php-ls:11041(async)
Content-Length: 248
{
"jsonrpc": "2.0",
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php"
},
"position": {
"line": 43,
"character": 12
}
},
"id": 88
}
<<<< php-ls:11041
{
"result": {
"contents": [],
"range": {
"start": {
"line": 43,
"character": 4
},
"end": {
"line": 44,
"character": 10
}
}
},
"id": 87,
"jsonrpc": "2.0"
}
<<<< php-ls:11041
{
"result": {
"contents": [
{
"language": "php",
"value": "<?php\nclass Spinach extends Vegetable {"
}
],
"range": {
"start": {
"line": 43,
"character": 11
},
"end": {
"line": 43,
"character": 16
}
}
},
"id": 88,
"jsonrpc": "2.0"
}
>>> php-ls:11041(async)
Content-Length: 247
{
"jsonrpc": "2.0",
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php"
},
"position": {
"line": 43,
"character": 4
}
},
"id": 89
}
>>> php-ls:11041(async)
Content-Length: 248
{
"jsonrpc": "2.0",
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php"
},
"position": {
"line": 43,
"character": 12
}
},
"id": 90
}
<<<< php-ls:11041
{
"result": {
"contents": [],
"range": {
"start": {
"line": 43,
"character": 4
},
"end": {
"line": 44,
"character": 10
}
}
},
"id": 89,
"jsonrpc": "2.0"
}
<<<< php-ls:11041
{
"result": {
"contents": [
{
"language": "php",
"value": "<?php\nclass Spinach extends Vegetable {"
}
],
"range": {
"start": {
"line": 43,
"character": 11
},
"end": {
"line": 43,
"character": 16
}
}
},
"id": 90,
"jsonrpc": "2.0"
}
>>> php-ls:11041(async)
Content-Length: 1004
{
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php",
"version": 44
},
"contentChanges": [
{
"text": "<?php\n\n// base class with member properties and methods\nclass Vegetable {\n\n var $edible;\n var $color;\n\n function __construct($edible, $color=\"green\")\n {\n $this->edible = $edible;\n $this->color = $color;\n }\n\n function is_edible()\n {\n return $this->edible;\n }\n\n function what_color()\n {\n return $this->color;\n }\n\n} // end of class Vegetable\n\n// extends the base class\nclass Spinach extends Vegetable {\n\n var $cooked = false;\n\n function __construct()\n {\n parent::__construct(true, \"green\");\n }\n\n function cook_it()\n {\n $this->cooked = true;\n }\n\n function is_cooked()\n {\n return $this->c\n return $this->cooked;\n }\n\n} // end of class Spinach\n\n\n?>\n"
}
]
}
}
>>> php-ls:11041(async)
Content-Length: 253
{
"jsonrpc": "2.0",
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php"
},
"position": {
"line": 43,
"character": 19
}
},
"id": 91
}
<<<< php-ls:11041
{
"result": {
"isIncomplete": true,
"items": []
},
"id": 91,
"jsonrpc": "2.0"
}
>>> php-ls:11041(async)
Content-Length: 1003
{
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php",
"version": 45
},
"contentChanges": [
{
"text": "<?php\n\n// base class with member properties and methods\nclass Vegetable {\n\n var $edible;\n var $color;\n\n function __construct($edible, $color=\"green\")\n {\n $this->edible = $edible;\n $this->color = $color;\n }\n\n function is_edible()\n {\n return $this->edible;\n }\n\n function what_color()\n {\n return $this->color;\n }\n\n} // end of class Vegetable\n\n// extends the base class\nclass Spinach extends Vegetable {\n\n var $cooked = false;\n\n function __construct()\n {\n parent::__construct(true, \"green\");\n }\n\n function cook_it()\n {\n $this->cooked = true;\n }\n\n function is_cooked()\n {\n return $this->\n return $this->cooked;\n }\n\n} // end of class Spinach\n\n\n?>\n"
}
]
}
}
>>> php-ls:11041(async)
Content-Length: 253
{
"jsonrpc": "2.0",
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///home/chencaibin/code/lsp-demos/php/demo.php"
},
"position": {
"line": 43,
"character": 18
}
},
"id": 92
}
<<<< php-ls:11041
{
"result": {
"isIncomplete": true,
"items": []
},
"id": 92,
"jsonrpc": "2.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment