LSP:无法获取文档符号
LSP: Cannot get document symbol
我正在学习 LSP,现在正在尝试获取文档符号。我使用 Felix Becker PHP language server。无论我尝试什么,我都无法取回符号。
我已经尝试记录语言服务器接收到的内容,这里是(试图忽略敏感数据):
{"id":1,"method":"initialize","params":{"initializationOptions":{},"rootUri":"file:\/\/\/Users\/stef\/Projects\/TestApp","capabilities":{},"rootPath":"\/Users\/stef\/Projects\/TestApp","trace":"verbose","processId":null,"workspaceFolders":[{"uri":"file:\/\/\/Users\/stef\/Projects\/TestApp","name":"TestApp"}]},"jsonrpc":"2.0"}
{"id":2,"method":"initialized","params":{},"jsonrpc":"2.0"}
{"id":3,"method":"textDocument\/didOpen","params":{"textDocument":{"uri":"file:\/\/\/Users\/stef\/Projects\/TestApp\/models\/User.php","languageId":"php","version":1,"text":"<?php\n\nnamespace app\models;\n\nuse Yii;\n\n\/**\n * This is the model class for table \"Users\".\n *\n * @property integer $id\n * @property string $User\n * @property integer $route\n * @property string $bus\n * @property string $start\n * @property string $end\n * @property string $dept_date\n * @property string $dept_time\n * @property integer $customer\n * @property integer $issued_on\n * @property string $machine_serial\n * @property integer $price\n * @property integer $is_deleted\n * @property string $OOOPS\n * @property integer $expired_in\n * @property integer $created_at\n * @property integer $created_by\n * @property integer $updated_at\n * @property integer $updated_by\n *\n * @property PlannedRoutes $deptDate\n * @property Buses $bus0\n * @property Customers $customer0\n * @property Stops $end0\n * @property POSes $machineSerial\n * @property Routes $route0\n * @property Stops $start0\n *\/\nclass User extends TenantModel\n{\n use \app\traits\Signature;\n\n const OOOPS_KOOK = 'BO';\n const OOOPS_TEMPORARY_KOOK = 'BT';\n const OOOPS_CANCELLED = 'CA';\n const OOOPS_CONFIRMED = 'CO';\n const OOOPS_FOOF_User = 'CT';\n const OOOPS_FREE = 'FR';\n \n public $RWF;\n public $UGS;\n public $FIB;\n public $USD;\n public $seats; \/\/ total bus seats\n public $Users; \/\/ sold Users\n public $bookings; \/\/ valid bookings\n public $promotion; \/\/ Promotion Users\n public $staff; \/\/ Staff Users\n public $location; \/\/ Staff Location\n public $day; \/\/ User day like Monday\n public $author; \/\/ Staff who created User\n public $broute; \/\/ Main Route\n \n public $FOOFs; \/\/total FOOFs sold\n public $crevenue; \/\/total FOOFs Revenue\n \/**\n * @inheritdoc\n *\/\n ....some sensitive data omitted...}}},"jsonrpc":"2.0"}
{"id":4,"method":"textDocument\/documentSymbol","params":{"textDocument":{"uri":"file:\/\/\/Users\/stef\/Projects\/TestApp\/models\/User.php"}},"jsonrpc":"2.0"}
这是来自服务器的记录响应
- 很多
{"method":"window\/logMessage","params"....
- 很多
{"method":"textDocument\/publishDiagnostics"...
终于得到
{"result":null,"id":3,"jsonrpc":"2.0"}Content-Type: application/vscode-jsonrpc; charset=utf8
Content-Length: 36
我找不到服务器不响应符号的原因。我尝试了同一作者的 VS 插件,它工作正常,这意味着我在某个地方搞砸了。但不能只是想出来!
感谢任何帮助。
碰巧我的 JSON RPC 负载包含未转义的 0x09 或制表符控制字符。用\t
替换它解决了问题
我正在学习 LSP,现在正在尝试获取文档符号。我使用 Felix Becker PHP language server。无论我尝试什么,我都无法取回符号。
我已经尝试记录语言服务器接收到的内容,这里是(试图忽略敏感数据):
{"id":1,"method":"initialize","params":{"initializationOptions":{},"rootUri":"file:\/\/\/Users\/stef\/Projects\/TestApp","capabilities":{},"rootPath":"\/Users\/stef\/Projects\/TestApp","trace":"verbose","processId":null,"workspaceFolders":[{"uri":"file:\/\/\/Users\/stef\/Projects\/TestApp","name":"TestApp"}]},"jsonrpc":"2.0"}
{"id":2,"method":"initialized","params":{},"jsonrpc":"2.0"}
{"id":3,"method":"textDocument\/didOpen","params":{"textDocument":{"uri":"file:\/\/\/Users\/stef\/Projects\/TestApp\/models\/User.php","languageId":"php","version":1,"text":"<?php\n\nnamespace app\models;\n\nuse Yii;\n\n\/**\n * This is the model class for table \"Users\".\n *\n * @property integer $id\n * @property string $User\n * @property integer $route\n * @property string $bus\n * @property string $start\n * @property string $end\n * @property string $dept_date\n * @property string $dept_time\n * @property integer $customer\n * @property integer $issued_on\n * @property string $machine_serial\n * @property integer $price\n * @property integer $is_deleted\n * @property string $OOOPS\n * @property integer $expired_in\n * @property integer $created_at\n * @property integer $created_by\n * @property integer $updated_at\n * @property integer $updated_by\n *\n * @property PlannedRoutes $deptDate\n * @property Buses $bus0\n * @property Customers $customer0\n * @property Stops $end0\n * @property POSes $machineSerial\n * @property Routes $route0\n * @property Stops $start0\n *\/\nclass User extends TenantModel\n{\n use \app\traits\Signature;\n\n const OOOPS_KOOK = 'BO';\n const OOOPS_TEMPORARY_KOOK = 'BT';\n const OOOPS_CANCELLED = 'CA';\n const OOOPS_CONFIRMED = 'CO';\n const OOOPS_FOOF_User = 'CT';\n const OOOPS_FREE = 'FR';\n \n public $RWF;\n public $UGS;\n public $FIB;\n public $USD;\n public $seats; \/\/ total bus seats\n public $Users; \/\/ sold Users\n public $bookings; \/\/ valid bookings\n public $promotion; \/\/ Promotion Users\n public $staff; \/\/ Staff Users\n public $location; \/\/ Staff Location\n public $day; \/\/ User day like Monday\n public $author; \/\/ Staff who created User\n public $broute; \/\/ Main Route\n \n public $FOOFs; \/\/total FOOFs sold\n public $crevenue; \/\/total FOOFs Revenue\n \/**\n * @inheritdoc\n *\/\n ....some sensitive data omitted...}}},"jsonrpc":"2.0"}
{"id":4,"method":"textDocument\/documentSymbol","params":{"textDocument":{"uri":"file:\/\/\/Users\/stef\/Projects\/TestApp\/models\/User.php"}},"jsonrpc":"2.0"}
这是来自服务器的记录响应
- 很多
{"method":"window\/logMessage","params"....
- 很多
{"method":"textDocument\/publishDiagnostics"...
终于得到
{"result":null,"id":3,"jsonrpc":"2.0"}Content-Type: application/vscode-jsonrpc; charset=utf8
Content-Length: 36
我找不到服务器不响应符号的原因。我尝试了同一作者的 VS 插件,它工作正常,这意味着我在某个地方搞砸了。但不能只是想出来!
感谢任何帮助。
碰巧我的 JSON RPC 负载包含未转义的 0x09 或制表符控制字符。用\t
替换它解决了问题