Removed Protocol directory
parent
81463c6ba7
commit
fb54d5f2ad
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class ClientCapabilities
|
||||
{
|
||||
/**
|
||||
* The client supports workspace/xfiles requests
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $xfilesProvider;
|
||||
|
||||
/**
|
||||
* The client supports textDocument/xcontent requests
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $xcontentProvider;
|
||||
|
||||
/**
|
||||
* The client supports xcache/* requests
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $xcacheProvider;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Contains additional diagnostic information about the context in which
|
||||
* a code action is run.
|
||||
*/
|
||||
class CodeActionContext
|
||||
{
|
||||
/**
|
||||
* An array of diagnostics.
|
||||
*
|
||||
* @var Diagnostic[]
|
||||
*/
|
||||
public $diagnostics;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* A code lens represents a command that should be shown along with
|
||||
* source text, like the number of references, a way to run tests, etc.
|
||||
*
|
||||
* A code lens is _unresolved_ when no command is associated to it. For performance
|
||||
* reasons the creation of a code lens and resolving should be done in two stages.
|
||||
*/
|
||||
class CodeLens
|
||||
{
|
||||
/**
|
||||
* The range in which this code lens is valid. Should only span a single line.
|
||||
*
|
||||
* @var Range
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* The command this code lens represents.
|
||||
*
|
||||
* @var Command|null
|
||||
*/
|
||||
public $command;
|
||||
|
||||
/**
|
||||
* A data entry field that is preserved on a code lens item between
|
||||
* a code lens and a code lens resolve request.
|
||||
*
|
||||
* @var mixed|null
|
||||
*/
|
||||
public $data;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Code Lens options.
|
||||
*/
|
||||
class CodeLensOptions
|
||||
{
|
||||
/**
|
||||
* Code lens has a resolve provider as well.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $resolveProvider;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Represents a reference to a command. Provides a title which will be used to represent a command in the UI and,
|
||||
* optionally, an array of arguments which will be passed to the command handler function when invoked.
|
||||
*/
|
||||
class Command
|
||||
{
|
||||
/**
|
||||
* Title of the command, like `save`.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $title;
|
||||
|
||||
/**
|
||||
* The identifier of the actual command handler.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $command;
|
||||
|
||||
/**
|
||||
* Arguments that the command handler should be
|
||||
* invoked with.
|
||||
*
|
||||
* @var mixed[]|null
|
||||
*/
|
||||
public $arguments;
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Contains additional information about the context in which a completion request is triggered.
|
||||
*/
|
||||
class CompletionContext
|
||||
{
|
||||
/**
|
||||
* How the completion was triggered.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $triggerKind;
|
||||
|
||||
/**
|
||||
* The trigger character (a single character) that has trigger code complete.
|
||||
* Is null if `triggerKind !== CompletionTriggerKind::TRIGGER_CHARACTER`
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $triggerCharacter;
|
||||
|
||||
public function __construct(int $triggerKind = null, string $triggerCharacter = null)
|
||||
{
|
||||
$this->triggerKind = $triggerKind;
|
||||
$this->triggerCharacter = $triggerCharacter;
|
||||
}
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
use LanguageServer\Definition;
|
||||
|
||||
class CompletionItem
|
||||
{
|
||||
/**
|
||||
* The label of this completion item. By default
|
||||
* also the text that is inserted when selecting
|
||||
* this completion.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* The kind of this completion item. Based of the kind
|
||||
* an icon is chosen by the editor.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $kind;
|
||||
|
||||
/**
|
||||
* A human-readable string with additional information
|
||||
* about this item, like type or symbol information.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $detail;
|
||||
|
||||
/**
|
||||
* A human-readable string that represents a doc-comment.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $documentation;
|
||||
|
||||
/**
|
||||
* A string that shoud be used when comparing this item
|
||||
* with other items. When `falsy` the label is used.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $sortText;
|
||||
|
||||
/**
|
||||
* A string that should be used when filtering a set of
|
||||
* completion items. When `falsy` the label is used.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $filterText;
|
||||
|
||||
/**
|
||||
* A string that should be inserted a document when selecting
|
||||
* this completion. When `falsy` the label is used.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $insertText;
|
||||
|
||||
/**
|
||||
* An edit which is applied to a document when selecting
|
||||
* this completion. When an edit is provided the value of
|
||||
* insertText is ignored.
|
||||
*
|
||||
* @var TextEdit|null
|
||||
*/
|
||||
public $textEdit;
|
||||
|
||||
/**
|
||||
* An optional array of additional text edits that are applied when
|
||||
* selecting this completion. Edits must not overlap with the main edit
|
||||
* nor with themselves.
|
||||
*
|
||||
* @var TextEdit[]|null
|
||||
*/
|
||||
public $additionalTextEdits;
|
||||
|
||||
/**
|
||||
* An optional command that is executed *after* inserting this completion. *Note* that
|
||||
* additional modifications to the current document should be described with the
|
||||
* additionalTextEdits-property.
|
||||
*
|
||||
* @var Command|null
|
||||
*/
|
||||
public $command;
|
||||
|
||||
/**
|
||||
* An data entry field that is preserved on a completion item between
|
||||
* a completion and a completion resolve request.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
* @param int|null $kind
|
||||
* @param string|null $detail
|
||||
* @param string|null $documentation
|
||||
* @param string|null $sortText
|
||||
* @param string|null $filterText
|
||||
* @param string|null $insertText
|
||||
* @param TextEdit|null $textEdit
|
||||
* @param TextEdit[]|null $additionalTextEdits
|
||||
* @param Command|null $command
|
||||
* @param mixed|null $data
|
||||
*/
|
||||
public function __construct(
|
||||
string $label = null,
|
||||
int $kind = null,
|
||||
string $detail = null,
|
||||
string $documentation = null,
|
||||
string $sortText = null,
|
||||
string $filterText = null,
|
||||
string $insertText = null,
|
||||
TextEdit $textEdit = null,
|
||||
array $additionalTextEdits = null,
|
||||
Command $command = null,
|
||||
$data = null
|
||||
) {
|
||||
$this->label = $label;
|
||||
$this->kind = $kind;
|
||||
$this->detail = $detail;
|
||||
$this->documentation = $documentation;
|
||||
$this->sortText = $sortText;
|
||||
$this->filterText = $filterText;
|
||||
$this->insertText = $insertText;
|
||||
$this->textEdit = $textEdit;
|
||||
$this->additionalTextEdits = $additionalTextEdits;
|
||||
$this->command = $command;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CompletionItem for a Definition
|
||||
*
|
||||
* @param Definition $def
|
||||
* @return self
|
||||
*/
|
||||
public static function fromDefinition(Definition $def): self
|
||||
{
|
||||
$item = new CompletionItem;
|
||||
$item->label = $def->symbolInformation->name;
|
||||
$item->kind = CompletionItemKind::fromSymbolKind($def->symbolInformation->kind);
|
||||
if ($def->type) {
|
||||
$item->detail = (string)$def->type;
|
||||
} else if ($def->symbolInformation->containerName) {
|
||||
$item->detail = $def->symbolInformation->containerName;
|
||||
}
|
||||
if ($def->documentation) {
|
||||
$item->documentation = $def->documentation;
|
||||
}
|
||||
if ($def->isStatic && $def->symbolInformation->kind === SymbolKind::PROPERTY) {
|
||||
$item->insertText = '$' . $def->symbolInformation->name;
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* The kind of a completion entry.
|
||||
*/
|
||||
abstract class CompletionItemKind
|
||||
{
|
||||
const TEXT = 1;
|
||||
const METHOD = 2;
|
||||
const FUNCTION = 3;
|
||||
const CONSTRUCTOR = 4;
|
||||
const FIELD = 5;
|
||||
const VARIABLE = 6;
|
||||
const CLASS_ = 7;
|
||||
const INTERFACE = 8;
|
||||
const MODULE = 9;
|
||||
const PROPERTY = 10;
|
||||
const UNIT = 11;
|
||||
const VALUE = 12;
|
||||
const ENUM = 13;
|
||||
const KEYWORD = 14;
|
||||
const SNIPPET = 15;
|
||||
const COLOR = 16;
|
||||
const FILE = 17;
|
||||
const REFERENCE = 18;
|
||||
|
||||
/**
|
||||
* Returns the CompletionItemKind for a SymbolKind
|
||||
*
|
||||
* @param int $kind A SymbolKind
|
||||
* @return int The CompletionItemKind
|
||||
*/
|
||||
public static function fromSymbolKind(int $kind): int
|
||||
{
|
||||
switch ($kind) {
|
||||
case SymbolKind::PROPERTY:
|
||||
case SymbolKind::FIELD:
|
||||
return self::PROPERTY;
|
||||
case SymbolKind::METHOD:
|
||||
return self::METHOD;
|
||||
case SymbolKind::CLASS_:
|
||||
return self::CLASS_;
|
||||
case SymbolKind::INTERFACE:
|
||||
return self::INTERFACE;
|
||||
case SymbolKind::FUNCTION:
|
||||
return self::FUNCTION;
|
||||
case SymbolKind::NAMESPACE:
|
||||
case SymbolKind::MODULE:
|
||||
case SymbolKind::PACKAGE:
|
||||
return self::MODULE;
|
||||
case SymbolKind::FILE:
|
||||
return self::FILE;
|
||||
case SymbolKind::STRING:
|
||||
return self::TEXT;
|
||||
case SymbolKind::NUMBER:
|
||||
case SymbolKind::BOOLEAN:
|
||||
case SymbolKind::ARRAY:
|
||||
return self::VALUE;
|
||||
case SymbolKind::ENUM:
|
||||
return self::ENUM;
|
||||
case SymbolKind::CONSTRUCTOR:
|
||||
return self::CONSTRUCTOR;
|
||||
case SymbolKind::VARIABLE:
|
||||
case SymbolKind::CONSTANT:
|
||||
return self::VARIABLE;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Represents a collection of completion items to be presented in
|
||||
* the editor.
|
||||
*/
|
||||
class CompletionList
|
||||
{
|
||||
/**
|
||||
* This list it not complete. Further typing should result in recomputing this
|
||||
* list.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isIncomplete;
|
||||
|
||||
/**
|
||||
* The completion items.
|
||||
*
|
||||
* @var CompletionItem[]
|
||||
*/
|
||||
public $items;
|
||||
|
||||
/**
|
||||
* @param CompletionItem[] $items The completion items.
|
||||
* @param bool $isIncomplete This list it not complete. Further typing should result in recomputing this list.
|
||||
*/
|
||||
public function __construct(array $items = [], bool $isIncomplete = false)
|
||||
{
|
||||
$this->items = $items;
|
||||
$this->isIncomplete = $isIncomplete;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Completion options.
|
||||
*/
|
||||
class CompletionOptions
|
||||
{
|
||||
/*
|
||||
* The server provides support to resolve additional information for a completion
|
||||
* item.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $resolveProvider;
|
||||
|
||||
/**
|
||||
* The characters that trigger completion automatically.
|
||||
*
|
||||
* @var string[]|null
|
||||
*/
|
||||
public $triggerCharacters;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class CompletionTriggerKind
|
||||
{
|
||||
/**
|
||||
* Completion was triggered by invoking it manuall or using API.
|
||||
*/
|
||||
const INVOKED = 1;
|
||||
|
||||
/**
|
||||
* Completion was triggered by a trigger character.
|
||||
*/
|
||||
const TRIGGER_CHARACTER = 2;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* An event describing a change to a text document. If range and rangeLength are
|
||||
* omitted the new text is considered to be the full content of the document.
|
||||
*/
|
||||
class ContentChangeEvent
|
||||
{
|
||||
/**
|
||||
* The range of the document that changed.
|
||||
*
|
||||
* @var Range|null
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* The length of the range that got replaced.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $rangeLength;
|
||||
|
||||
/**
|
||||
* The new text of the document.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $text;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class DependencyReference
|
||||
{
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $hints;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $attributes;
|
||||
|
||||
/**
|
||||
* @param object $attributes
|
||||
* @param mixed $hints
|
||||
*/
|
||||
public function __construct($attributes = null, $hints = null)
|
||||
{
|
||||
$this->attributes = $attributes ?? new \stdClass;
|
||||
$this->hints = $hints;
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a
|
||||
* resource.
|
||||
*/
|
||||
class Diagnostic
|
||||
{
|
||||
/**
|
||||
* The range at which the message applies.
|
||||
*
|
||||
* @var Range
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* The diagnostic's severity. Can be omitted. If omitted it is up to the
|
||||
* client to interpret diagnostics as error, warning, info or hint.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $severity;
|
||||
|
||||
/**
|
||||
* The diagnostic's code. Can be omitted.
|
||||
*
|
||||
* @var int|string|null
|
||||
*/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* A human-readable string describing the source of this
|
||||
* diagnostic, e.g. 'typescript' or 'super lint'.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $source;
|
||||
|
||||
/**
|
||||
* The diagnostic's message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* @param string $message The diagnostic's message
|
||||
* @param Range $range The range at which the message applies
|
||||
* @param int $code The diagnostic's code
|
||||
* @param int $severity DiagnosticSeverity
|
||||
* @param string $source A human-readable string describing the source of this diagnostic
|
||||
*/
|
||||
public function __construct(string $message = null, Range $range = null, int $code = null, int $severity = null, string $source = null)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->range = $range;
|
||||
$this->code = $code;
|
||||
$this->severity = $severity;
|
||||
$this->source = $source;
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
abstract class DiagnosticSeverity
|
||||
{
|
||||
/**
|
||||
* Reports an error.
|
||||
*/
|
||||
const ERROR = 1;
|
||||
|
||||
/**
|
||||
* Reports a warning.
|
||||
*/
|
||||
const WARNING = 2;
|
||||
|
||||
/**
|
||||
* Reports an information.
|
||||
*/
|
||||
const INFORMATION = 3;
|
||||
|
||||
/**
|
||||
* Reports a hint.
|
||||
*/
|
||||
const HINT = 4;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* A document highlight is a range inside a text document which deserves
|
||||
* special attention. Usually a document highlight is visualized by changing
|
||||
* the background color of its range.
|
||||
*/
|
||||
class DocumentHighlight
|
||||
{
|
||||
/**
|
||||
* The range this highlight applies to.
|
||||
*
|
||||
* @var Range
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* The highlight kind, default is DocumentHighlightKind::TEXT.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $kind;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* A document highlight kind.
|
||||
*/
|
||||
abstract class DocumentHighlightKind
|
||||
{
|
||||
/**
|
||||
* A textual occurrance.
|
||||
*/
|
||||
const TEXT = 1;
|
||||
|
||||
/**
|
||||
* Read-access of a symbol, like reading a variable.
|
||||
*/
|
||||
const READ = 2;
|
||||
|
||||
/**
|
||||
* Write-access of a symbol, like writing to a variable.
|
||||
*/
|
||||
const WRITE = 3;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Format document on type options
|
||||
*/
|
||||
class DocumentOnTypeFormattingOptions
|
||||
{
|
||||
/**
|
||||
* A character on which formatting should be triggered, like `}`.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $firstTriggerCharacter;
|
||||
|
||||
/**
|
||||
* More trigger characters.
|
||||
*
|
||||
* @var string[]|null
|
||||
*/
|
||||
public $moreTriggerCharacter;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Enum
|
||||
*/
|
||||
abstract class ErrorCode
|
||||
{
|
||||
const PARSE_ERROR = -32700;
|
||||
const INVALID_REQUEST = -32600;
|
||||
const METHOD_NOT_FOUND = -32601;
|
||||
const INVALID_PARAMS = -32602;
|
||||
const INTERNAL_ERROR = -32603;
|
||||
const SERVER_ERROR_START = -32099;
|
||||
const SERVER_ERROR_END = -32000;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* The file event type. Enum
|
||||
*/
|
||||
abstract class FileChangeType
|
||||
{
|
||||
/**
|
||||
* The file got created.
|
||||
*/
|
||||
const CREATED = 1;
|
||||
|
||||
/**
|
||||
* The file got changed.
|
||||
*/
|
||||
const CHANGED = 2;
|
||||
|
||||
/**
|
||||
* The file got deleted.
|
||||
*/
|
||||
const DELETED = 3;
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* An event describing a file change.
|
||||
*/
|
||||
class FileEvent
|
||||
{
|
||||
/**
|
||||
* The file's URI.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $uri;
|
||||
|
||||
/**
|
||||
* The change type.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @param string $uri
|
||||
* @param int $type
|
||||
*/
|
||||
public function __construct(string $uri, int $type)
|
||||
{
|
||||
$this->uri = $uri;
|
||||
$this->type = $type;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Value-object describing what options formatting should use.
|
||||
*/
|
||||
class FormattingOptions
|
||||
{
|
||||
/**
|
||||
* Size of a tab in spaces.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $tabSize;
|
||||
|
||||
/**
|
||||
* Prefer spaces over tabs.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $insertSpaces;
|
||||
|
||||
// Can be extended with further properties.
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* The result of a hover request.
|
||||
*/
|
||||
class Hover
|
||||
{
|
||||
/**
|
||||
* The hover's content
|
||||
*
|
||||
* @var string|MarkedString|string[]|MarkedString[]
|
||||
*/
|
||||
public $contents;
|
||||
|
||||
/**
|
||||
* An optional range
|
||||
*
|
||||
* @var Range|null
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* @param string|MarkedString|string[]|MarkedString[] $contents The hover's content
|
||||
* @param Range $range An optional range
|
||||
*/
|
||||
public function __construct($contents = null, $range = null)
|
||||
{
|
||||
$this->contents = $contents;
|
||||
$this->range = $range;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class InitializeResult
|
||||
{
|
||||
/**
|
||||
* The capabilities the language server provides.
|
||||
*
|
||||
* @var LanguageServer\Protocol\ServerCapabilities
|
||||
*/
|
||||
public $capabilities;
|
||||
|
||||
/**
|
||||
* @param LanguageServer\Protocol\ServerCapabilities $capabilities
|
||||
*/
|
||||
public function __construct(ServerCapabilities $capabilities = null)
|
||||
{
|
||||
$this->capabilities = $capabilities ?? new ServerCapabilities();
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
use Microsoft\PhpParser;
|
||||
use Microsoft\PhpParser\Node;
|
||||
|
||||
/**
|
||||
* Represents a location inside a resource, such as a line inside a text file.
|
||||
*/
|
||||
class Location
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $uri;
|
||||
|
||||
/**
|
||||
* @var Range
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* Returns the location of the node
|
||||
*
|
||||
* @param Node $node
|
||||
* @return self
|
||||
*/
|
||||
public static function fromNode($node)
|
||||
{
|
||||
$range = PhpParser\PositionUtilities::getRangeFromPosition($node->getStart(), $node->getWidth(), $node->getFileContents());
|
||||
return new self($node->getUri(), new Range(
|
||||
new Position($range->start->line, $range->start->character),
|
||||
new Position($range->end->line, $range->end->character)
|
||||
));
|
||||
}
|
||||
|
||||
public function __construct(string $uri = null, Range $range = null)
|
||||
{
|
||||
$this->uri = $uri;
|
||||
$this->range = $range;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class MarkedString
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $language;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
public function __construct(string $language = null, string $value = null)
|
||||
{
|
||||
$this->language = $language;
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class MessageActionItem
|
||||
{
|
||||
/**
|
||||
* A short title like 'Retry', 'Open Log' etc.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $title;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Enum
|
||||
*/
|
||||
abstract class MessageType
|
||||
{
|
||||
/**
|
||||
* An error message.
|
||||
*/
|
||||
const ERROR = 1;
|
||||
|
||||
/**
|
||||
* A warning message.
|
||||
*/
|
||||
const WARNING = 2;
|
||||
|
||||
/**
|
||||
* An information message.
|
||||
*/
|
||||
const INFO = 3;
|
||||
|
||||
/**
|
||||
* A log message.
|
||||
*/
|
||||
const LOG = 4;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Uniquely identifies a Composer package
|
||||
*/
|
||||
class PackageDescriptor
|
||||
{
|
||||
/**
|
||||
* The package name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @param string $name The package name
|
||||
*/
|
||||
public function __construct(string $name = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Represents a parameter of a callable-signature. A parameter can
|
||||
* have a label and a doc-comment.
|
||||
*/
|
||||
class ParameterInformation
|
||||
{
|
||||
/**
|
||||
* The label of this signature. Will be shown in
|
||||
* the UI.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* The human-readable doc-comment of this signature. Will be shown
|
||||
* in the UI but can be omitted.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $documentation;
|
||||
|
||||
/**
|
||||
* Create ParameterInformation
|
||||
*
|
||||
* @param string $label The label of this signature. Will be shown in the UI.
|
||||
* @param string $documentation The human-readable doc-comment of this signature. Will be shown in the UI but can
|
||||
* be omitted.
|
||||
*/
|
||||
public function __construct(string $label, string $documentation = null)
|
||||
{
|
||||
$this->label = $label;
|
||||
$this->documentation = $documentation;
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Position in a text document expressed as zero-based line and character offset.
|
||||
*/
|
||||
class Position
|
||||
{
|
||||
/**
|
||||
* Line position in a document (zero-based).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $line;
|
||||
|
||||
/**
|
||||
* Character offset on a line in a document (zero-based).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $character;
|
||||
|
||||
public function __construct(int $line = null, int $character = null)
|
||||
{
|
||||
$this->line = $line;
|
||||
$this->character = $character;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this position to another position
|
||||
* Returns
|
||||
* - 0 if the positions match
|
||||
* - a negative number if $this is before $position
|
||||
* - a positive number otherwise
|
||||
*
|
||||
* @param Position $position
|
||||
* @return int
|
||||
*/
|
||||
public function compare(Position $position): int
|
||||
{
|
||||
if ($this->line === $position->line && $this->character === $position->character) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($this->line !== $position->line) {
|
||||
return $this->line - $position->line;
|
||||
}
|
||||
|
||||
return $this->character - $position->character;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the offset of the position in a string
|
||||
*
|
||||
* @param string $content
|
||||
* @return int
|
||||
*/
|
||||
public function toOffset(string $content): int
|
||||
{
|
||||
$lines = explode("\n", $content);
|
||||
$slice = array_slice($lines, 0, $this->line);
|
||||
return array_sum(array_map('strlen', $slice)) + count($slice) + $this->character;
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
use Microsoft\PhpParser;
|
||||
use Microsoft\PhpParser\Node;
|
||||
|
||||
/**
|
||||
* A range in a text document expressed as (zero-based) start and end positions.
|
||||
*/
|
||||
class Range
|
||||
{
|
||||
/**
|
||||
* The range's start position.
|
||||
*
|
||||
* @var Position
|
||||
*/
|
||||
public $start;
|
||||
|
||||
/**
|
||||
* The range's end position.
|
||||
*
|
||||
* @var Position
|
||||
*/
|
||||
public $end;
|
||||
|
||||
/**
|
||||
* Returns the range the node spans
|
||||
*
|
||||
* @param Node $node
|
||||
* @return self
|
||||
*/
|
||||
public static function fromNode(Node $node)
|
||||
{
|
||||
$range = PhpParser\PositionUtilities::getRangeFromPosition($node->getStart(), $node->getWidth(), $node->getFileContents());
|
||||
|
||||
return new self(
|
||||
new Position($range->start->line, $range->start->character),
|
||||
new Position($range->end->line, $range->end->character)
|
||||
);
|
||||
}
|
||||
|
||||
public function __construct(Position $start = null, Position $end = null)
|
||||
{
|
||||
$this->start = $start;
|
||||
$this->end = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a position is within the range
|
||||
*
|
||||
* @param Position $position
|
||||
* @return bool
|
||||
*/
|
||||
public function includes(Position $position): bool
|
||||
{
|
||||
return $this->start->compare($position) <= 0 && $this->end->compare($position) >= 0;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class ReferenceContext
|
||||
{
|
||||
/**
|
||||
* Include the declaration of the current symbol.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $includeDeclaration;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Metadata about the symbol that can be used to identify or locate its
|
||||
* definition.
|
||||
*/
|
||||
class ReferenceInformation
|
||||
{
|
||||
/**
|
||||
* The location in the workspace where the `symbol` is referenced.
|
||||
*
|
||||
* @var Location
|
||||
*/
|
||||
public $reference;
|
||||
|
||||
/**
|
||||
* Metadata about the symbol that can be used to identify or locate its
|
||||
* definition.
|
||||
*
|
||||
* @var SymbolDescriptor
|
||||
*/
|
||||
public $symbol;
|
||||
|
||||
/**
|
||||
* @param Location $reference The location in the workspace where the `symbol` is referenced.
|
||||
* @param SymbolDescriptor $symbol Metadata about the symbol that can be used to identify or locate its definition.
|
||||
*/
|
||||
public function __construct(Location $reference = null, SymbolDescriptor $symbol = null)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->symbol = $symbol;
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class ServerCapabilities
|
||||
{
|
||||
/**
|
||||
* Defines how text documents are synced.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $textDocumentSync;
|
||||
|
||||
/**
|
||||
* The server provides hover support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $hoverProvider;
|
||||
|
||||
/**
|
||||
* The server provides completion support.
|
||||
*
|
||||
* @var CompletionOptions|null
|
||||
*/
|
||||
public $completionProvider;
|
||||
|
||||
/**
|
||||
* The server provides signature help support.
|
||||
*
|
||||
* @var SignatureHelpOptions|null
|
||||
*/
|
||||
public $signatureHelpProvider;
|
||||
|
||||
/**
|
||||
* The server provides goto definition support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $definitionProvider;
|
||||
|
||||
/**
|
||||
* The server provides find references support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $referencesProvider;
|
||||
|
||||
/**
|
||||
* The server provides document highlight support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $documentHighlightProvider;
|
||||
|
||||
/**
|
||||
* The server provides document symbol support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $documentSymbolProvider;
|
||||
|
||||
/**
|
||||
* The server provides workspace symbol support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $workspaceSymbolProvider;
|
||||
|
||||
/**
|
||||
* The server provides code actions.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $codeActionProvider;
|
||||
|
||||
/**
|
||||
* The server provides code lens.
|
||||
*
|
||||
* @var CodeLensOptions|null
|
||||
*/
|
||||
public $codeLensProvider;
|
||||
|
||||
/**
|
||||
* The server provides document formatting.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $documentFormattingProvider;
|
||||
|
||||
/**
|
||||
* The server provides document range formatting.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $documentRangeFormattingProvider;
|
||||
|
||||
/**
|
||||
* The server provides document formatting on typing.
|
||||
*
|
||||
* @var DocumentOnTypeFormattingOptions|null
|
||||
*/
|
||||
public $documentOnTypeFormattingProvider;
|
||||
|
||||
/**
|
||||
* The server provides rename support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $renameProvider;
|
||||
|
||||
/**
|
||||
* The server provides workspace references exporting support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $xworkspaceReferencesProvider;
|
||||
|
||||
/**
|
||||
* The server provides extended text document definition support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $xdefinitionProvider;
|
||||
|
||||
/**
|
||||
* The server provides workspace dependencies support.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $dependenciesProvider;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Signature help represents the signature of something
|
||||
* callable. There can be multiple signature but only one
|
||||
* active and only one active parameter.
|
||||
*/
|
||||
class SignatureHelp
|
||||
{
|
||||
/**
|
||||
* One or more signatures.
|
||||
*
|
||||
* @var SignatureInformation[]
|
||||
*/
|
||||
public $signatures;
|
||||
|
||||
/**
|
||||
* The active signature.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $activeSignature;
|
||||
|
||||
/**
|
||||
* The active parameter of the active signature.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $activeParameter;
|
||||
|
||||
/**
|
||||
* Create a SignatureHelp
|
||||
*
|
||||
* @param SignatureInformation[] $signatures List of signature information
|
||||
* @param int|null $activeSignature The active signature, zero based
|
||||
* @param int|null $activeParameter The active parameter, zero based
|
||||
*/
|
||||
public function __construct(array $signatures = [], $activeSignature = null, int $activeParameter = null)
|
||||
{
|
||||
$this->signatures = $signatures;
|
||||
$this->activeSignature = $activeSignature;
|
||||
$this->activeParameter = $activeParameter;
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Signature help options.
|
||||
*/
|
||||
class SignatureHelpOptions
|
||||
{
|
||||
/**
|
||||
* The characters that trigger signature help automatically.
|
||||
*
|
||||
* @var string[]|null
|
||||
*/
|
||||
public $triggerCharacters;
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Represents the signature of something callable. A signature
|
||||
* can have a label, like a function-name, a doc-comment, and
|
||||
* a set of parameters.
|
||||
*/
|
||||
class SignatureInformation
|
||||
{
|
||||
/**
|
||||
* The label of this signature. Will be shown in
|
||||
* the UI.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* The human-readable doc-comment of this signature. Will be shown
|
||||
* in the UI but can be omitted.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $documentation;
|
||||
|
||||
/**
|
||||
* The parameters of this signature.
|
||||
*
|
||||
* @var ParameterInformation[]|null
|
||||
*/
|
||||
public $parameters;
|
||||
|
||||
/**
|
||||
* Create a SignatureInformation
|
||||
*
|
||||
* @param string $label The label of this signature. Will be shown in the UI.
|
||||
* @param ParameterInformation[]|null The parameters of this signature
|
||||
* @param string|null The human-readable doc-comment of this signature. Will be shown in the UI
|
||||
* but can be omitted.
|
||||
*/
|
||||
public function __construct(string $label, array $parameters = null, string $documentation = null)
|
||||
{
|
||||
$this->label = $label;
|
||||
$this->parameters = $parameters;
|
||||
$this->documentation = $documentation;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Uniquely identifies a symbol
|
||||
*/
|
||||
class SymbolDescriptor
|
||||
{
|
||||
/**
|
||||
* The fully qualified structural element name, a globally unique identifier for the symbol.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $fqsen;
|
||||
|
||||
/**
|
||||
* Identifies the Composer package the symbol is defined in (if any)
|
||||
*
|
||||
* @var PackageDescriptor|null
|
||||
*/
|
||||
public $package;
|
||||
|
||||
/**
|
||||
* @param string $fqsen The fully qualified structural element name, a globally unique identifier for the symbol.
|
||||
* @param PackageDescriptor $package Identifies the Composer package the symbol is defined in
|
||||
*/
|
||||
public function __construct(string $fqsen = null, PackageDescriptor $package = null)
|
||||
{
|
||||
$this->fqsen = $fqsen;
|
||||
$this->package = $package;
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
use LanguageServer\Factory\LocationFactory;
|
||||
use Microsoft\PhpParser;
|
||||
use Microsoft\PhpParser\Node;
|
||||
|
||||
/**
|
||||
* Represents information about programming constructs like variables, classes,
|
||||
* interfaces etc.
|
||||
*/
|
||||
class SymbolInformation
|
||||
{
|
||||
/**
|
||||
* The name of this symbol.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The kind of this symbol.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $kind;
|
||||
|
||||
/**
|
||||
* The location of this symbol.
|
||||
*
|
||||
* @var Location
|
||||
*/
|
||||
public $location;
|
||||
|
||||
/**
|
||||
* The name of the symbol containing this symbol.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $containerName;
|
||||
|
||||
/**
|
||||
* Converts a Node to a SymbolInformation
|
||||
*
|
||||
* @param Node $node
|
||||
* @param string $fqn If given, $containerName will be extracted from it
|
||||
* @return SymbolInformation|null
|
||||
*/
|
||||
public static function fromNode($node, string $fqn = null)
|
||||
{
|
||||
$symbol = new self;
|
||||
if ($node instanceof Node\Statement\ClassDeclaration) {
|
||||
$symbol->kind = SymbolKind::CLASS_;
|
||||
} else if ($node instanceof Node\Statement\TraitDeclaration) {
|
||||
$symbol->kind = SymbolKind::CLASS_;
|
||||
} else if (\LanguageServer\ParserHelpers\isConstDefineExpression($node)) {
|
||||
// constants with define() like
|
||||
// define('TEST_DEFINE_CONSTANT', false);
|
||||
$symbol->kind = SymbolKind::CONSTANT;
|
||||
$symbol->name = $node->argumentExpressionList->children[0]->expression->getStringContentsText();
|
||||
} else if ($node instanceof Node\Statement\InterfaceDeclaration) {
|
||||
$symbol->kind = SymbolKind::INTERFACE;
|
||||
} else if ($node instanceof Node\Statement\NamespaceDefinition) {
|
||||
$symbol->kind = SymbolKind::NAMESPACE;
|
||||
} else if ($node instanceof Node\Statement\FunctionDeclaration) {
|
||||
$symbol->kind = SymbolKind::FUNCTION;
|
||||
} else if ($node instanceof Node\MethodDeclaration) {
|
||||
$nameText = $node->getName();
|
||||
if ($nameText === '__construct' || $nameText === '__destruct') {
|
||||
$symbol->kind = SymbolKind::CONSTRUCTOR;
|
||||
} else {
|
||||
$symbol->kind = SymbolKind::METHOD;
|
||||
}
|
||||
} else if ($node instanceof Node\Expression\Variable && $node->getFirstAncestor(Node\PropertyDeclaration::class) !== null) {
|
||||
$symbol->kind = SymbolKind::PROPERTY;
|
||||
} else if ($node instanceof Node\ConstElement) {
|
||||
$symbol->kind = SymbolKind::CONSTANT;
|
||||
} else if (
|
||||
(
|
||||
($node instanceof Node\Expression\AssignmentExpression)
|
||||
&& $node->leftOperand instanceof Node\Expression\Variable
|
||||
)
|
||||
|| $node instanceof Node\UseVariableName
|
||||
|| $node instanceof Node\Parameter
|
||||
) {
|
||||
$symbol->kind = SymbolKind::VARIABLE;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Expression\AssignmentExpression) {
|
||||
if ($node->leftOperand instanceof Node\Expression\Variable) {
|
||||
$symbol->name = $node->leftOperand->getName();
|
||||
} elseif ($node->leftOperand instanceof PhpParser\Token) {
|
||||
$symbol->name = trim($node->leftOperand->getText($node->getFileContents()), "$");
|
||||
}
|
||||
} else if ($node instanceof Node\UseVariableName) {
|
||||
$symbol->name = $node->getName();
|
||||
} else if (isset($node->name)) {
|
||||
if ($node->name instanceof Node\QualifiedName) {
|
||||
$symbol->name = (string)PhpParser\ResolvedName::buildName($node->name->nameParts, $node->getFileContents());
|
||||
} else {
|
||||
$symbol->name = ltrim((string)$node->name->getText($node->getFileContents()), "$");
|
||||
}
|
||||
} else if (isset($node->variableName)) {
|
||||
$symbol->name = $node->variableName->getText($node);
|
||||
} else if (!isset($symbol->name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$symbol->location = LocationFactory::fromNode($node);
|
||||
if ($fqn !== null) {
|
||||
$parts = preg_split('/(::|->|\\\\)/', $fqn);
|
||||
array_pop($parts);
|
||||
$symbol->containerName = implode('\\', $parts);
|
||||
}
|
||||
return $symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $kind
|
||||
* @param Location $location
|
||||
* @param string $containerName
|
||||
*/
|
||||
public function __construct($name = null, $kind = null, $location = null, $containerName = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->kind = $kind;
|
||||
$this->location = $location;
|
||||
$this->containerName = $containerName;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* A symbol kind.
|
||||
*/
|
||||
abstract class SymbolKind
|
||||
{
|
||||
const FILE = 1;
|
||||
const MODULE = 2;
|
||||
const NAMESPACE = 3;
|
||||
const PACKAGE = 4;
|
||||
const CLASS_ = 5;
|
||||
const METHOD = 6;
|
||||
const PROPERTY = 7;
|
||||
const FIELD = 8;
|
||||
const CONSTRUCTOR = 9;
|
||||
const ENUM = 10;
|
||||
const INTERFACE = 11;
|
||||
const FUNCTION = 12;
|
||||
const VARIABLE = 13;
|
||||
const CONSTANT = 14;
|
||||
const STRING = 15;
|
||||
const NUMBER = 16;
|
||||
const BOOLEAN = 17;
|
||||
const ARRAY = 18;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class SymbolLocationInformation
|
||||
{
|
||||
/**
|
||||
* The location where the symbol is defined, if any.
|
||||
*
|
||||
* @var Location|null
|
||||
*/
|
||||
public $location;
|
||||
|
||||
/**
|
||||
* Metadata about the symbol that can be used to identify or locate its
|
||||
* definition.
|
||||
*
|
||||
* @var SymbolDescriptor
|
||||
*/
|
||||
public $symbol;
|
||||
|
||||
/**
|
||||
* @param SymbolDescriptor $symbol The location where the symbol is defined, if any
|
||||
* @param Location $location Metadata about the symbol that can be used to identify or locate its definition
|
||||
*/
|
||||
public function __construct(SymbolDescriptor $symbol = null, Location $location = null)
|
||||
{
|
||||
$this->symbol = $symbol;
|
||||
$this->location = $location;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* An event describing a change to a text document. If range and rangeLength are omitted
|
||||
* the new text is considered to be the full content of the document.
|
||||
*/
|
||||
class TextDocumentContentChangeEvent
|
||||
{
|
||||
/**
|
||||
* The range of the document that changed.
|
||||
*
|
||||
* @var Range|null
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* The length of the range that got replaced.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $rangeLength;
|
||||
|
||||
/**
|
||||
* The new text of the document.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $text;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class TextDocumentIdentifier
|
||||
{
|
||||
/**
|
||||
* The text document's URI.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $uri;
|
||||
|
||||
/**
|
||||
* @param string $uri The text document's URI.
|
||||
*/
|
||||
public function __construct(string $uri = null)
|
||||
{
|
||||
$this->uri = $uri;
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* An item to transfer a text document from the client to the server.
|
||||
*/
|
||||
class TextDocumentItem
|
||||
{
|
||||
/**
|
||||
* The text document's URI.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $uri;
|
||||
|
||||
/**
|
||||
* The text document's language identifier.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $languageId;
|
||||
|
||||
/**
|
||||
* The version number of this document (it will strictly increase after each
|
||||
* change, including undo/redo).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $version;
|
||||
|
||||
/**
|
||||
* The content of the opened text document.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $text;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* Defines how the host (editor) should sync document changes to the language server.
|
||||
*/
|
||||
abstract class TextDocumentSyncKind
|
||||
{
|
||||
/**
|
||||
* Documents should not be synced at all.
|
||||
*/
|
||||
const NONE = 0;
|
||||
|
||||
/**
|
||||
* Documents are synced by always sending the full content of the document.
|
||||
*/
|
||||
const FULL = 1;
|
||||
|
||||
/*
|
||||
* Documents are synced by sending the full content on open. After that only
|
||||
* incremental updates to the document are sent.
|
||||
*/
|
||||
const INCREMENTAL = 2;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* A textual edit applicable to a text document.
|
||||
*/
|
||||
class TextEdit
|
||||
{
|
||||
/**
|
||||
* The range of the text document to be manipulated. To insert
|
||||
* text into a document create a range where start === end.
|
||||
*
|
||||
* @var Range
|
||||
*/
|
||||
public $range;
|
||||
|
||||
/**
|
||||
* The string to be inserted. For delete operations use an
|
||||
* empty string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $newText;
|
||||
|
||||
public function __construct(Range $range = null, string $newText = null)
|
||||
{
|
||||
$this->range = $range;
|
||||
$this->newText = $newText;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
class VersionedTextDocumentIdentifier extends TextDocumentIdentifier
|
||||
{
|
||||
/**
|
||||
* The version number of this document.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $version;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer\Protocol;
|
||||
|
||||
/**
|
||||
* A workspace edit represents changes to many resources managed in the workspace.
|
||||
*/
|
||||
class WorkspaceEdit
|
||||
{
|
||||
/**
|
||||
* Holds changes to existing resources. Associative Array from URI to TextEdit
|
||||
*
|
||||
* @var TextEdit[]
|
||||
*/
|
||||
public $changes;
|
||||
}
|
Loading…
Reference in New Issue