2016-08-22 15:32:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace LanguageServer;
|
|
|
|
|
2016-08-23 09:21:37 +00:00
|
|
|
use LanguageServer\Protocol\{ProtocolServer, ServerCapabilities, TextDocumentSyncKind};
|
|
|
|
use LanguageServer\Protocol\Methods\{InitializeParams, InitializeResult};
|
2016-08-22 15:32:31 +00:00
|
|
|
|
|
|
|
class LanguageServer extends ProtocolServer
|
|
|
|
{
|
2016-08-23 09:21:37 +00:00
|
|
|
protected $textDocument;
|
|
|
|
protected $telemetry;
|
|
|
|
protected $window;
|
|
|
|
protected $workspace;
|
|
|
|
protected $completionItem;
|
|
|
|
protected $codeLens;
|
|
|
|
|
|
|
|
public function __construct($input, $output)
|
2016-08-22 15:32:31 +00:00
|
|
|
{
|
2016-08-23 09:21:37 +00:00
|
|
|
parent::__construct($input, $output);
|
|
|
|
$this->textDocument = new TextDocumentManager();
|
2016-08-22 15:32:31 +00:00
|
|
|
}
|
2016-08-22 21:48:20 +00:00
|
|
|
|
2016-08-23 09:21:37 +00:00
|
|
|
protected function initialize(InitializeParams $req): InitializeResult
|
|
|
|
{
|
|
|
|
$capabilities = new ServerCapabilites();
|
|
|
|
// Ask the client to return always full documents (because we need to rebuild the AST from scratch)
|
|
|
|
$capabilities->textDocumentSync = TextDocumentSyncKind::FULL;
|
|
|
|
// Support "Find all symbols"
|
|
|
|
$capabilities->documentSymbolProvider = true;
|
|
|
|
$result = new InitializeResult($capabilities);
|
|
|
|
return $result;
|
|
|
|
}
|
2016-08-22 15:32:31 +00:00
|
|
|
}
|