Install psalm as dev, sync scripts updates

This commit is contained in:
Clemens Schwaighofer
2023-03-09 16:27:10 +09:00
parent 6bec59e387
commit feba79a2e8
2099 changed files with 283333 additions and 32 deletions

View File

@@ -0,0 +1,17 @@
[*]
insert_final_newline = true
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.{json,yml}]
indent_size = 2
[composer.json]
indent_size = 4
[*.md]
trim_trailing_whitespace = false

View File

@@ -0,0 +1,67 @@
name: build
on: [push, pull_request]
env:
FORCE_COLOR: 3
jobs:
test:
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- php: '7.4'
os: ubuntu-18.04
- php: '8.0'
os: ubuntu-18.04
- php: '8.1'
os: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14.15.3' # renovate:keep-up-to-date
- name: Install npm dependencies
run: npm ci
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.xdebug }}, ast
tools: composer
- name: Composer Install
run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-interaction
- name: phpcs
run: ./vendor/bin/phpcs -n
- name: phpstan
run: ./vendor/bin/phpstan
- name: psalm
run: ./vendor/bin/psalm
# - name: phan
# run: ./vendor/bin/phan
# - name: phpunit
# run: vendor/bin/phpunit --coverage-clover=coverage.xml --colors=always
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v2
# release:
# runs-on: ubuntu-18.04
# needs: test
# if: github.repository_owner == 'xdebug' && github.event_name == 'push' && github.ref == 'refs/heads/main'
# steps:
# - uses: actions/checkout@v2
# - name: Setup Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '14.15.3' # renovate:keep-up-to-date
# - name: Install npm dependencies
# run: npm ci
# - name: Build VS Code extension
# run: npm run build
# - name: Release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
# run: npm run semantic-release

View File

@@ -0,0 +1,15 @@
ISC License
Copyright (c) 2016, Felix Frederick Becker
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,19 @@
# Language Server Protocol for PHP
[![packagist](https://img.shields.io/packagist/v/felixfbecker/language-server-protocol.svg)](https://packagist.org/packages/felixfbecker/language-server-protocol)
[![build](https://travis-ci.org/felixfbecker/php-language-server-protocol.svg?branch=master)](https://travis-ci.org/felixfbecker/php-language-server-protocol)
[![php](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg)](https://php.net/)
[![license](https://img.shields.io/packagist/l/felixfbecker/language-server-protocol.svg)](https://github.com/felixfbecker/php-language-server-protocol/blob/master/LICENSE)
Protocol classes for the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) in PHP
## Installation
```
composer require felixfbecker/language-server-protocol
```
## Releases
Releases are done automatically in CI by analyzing commit messages.
Make sure to follow the [Conventional Commits Convention](https://www.conventionalcommits.org/en/v1.0.0-beta.2/).

View File

@@ -0,0 +1,44 @@
{
"name": "felixfbecker/language-server-protocol",
"description": "PHP classes for the Language Server Protocol",
"license": "ISC",
"keywords": [
"php",
"language",
"server",
"microsoft"
],
"authors": [
{
"name": "Felix Becker",
"email": "felix.b@outlook.com"
}
],
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpstan/phpstan": "*",
"squizlabs/php_codesniffer": "^3.1",
"vimeo/psalm": "^4.0"
},
"autoload": {
"psr-4": {
"LanguageServerProtocol\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts":
{
"phpstan": "phpstan analyse -c phpstan.neon --ansi --level=7 -vvv src",
"psalm": "psalm",
"phpcs": "phpcs",
"phpcbf": "phpcbf"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
{
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/felixfbecker/php-language-server-protocol"
},
"release": {
"verifyConditions": "@semantic-release/github",
"prepare": [],
"publish": "@semantic-release/github"
},
"devDependencies": {
"semantic-release": "^15.9.16"
}
}

View File

@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.0.1@b1e2e30026936ef8d5bf6a354d1c3959b6231f44">
<file src="src/CodeLens.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$range</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/CompletionContext.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$triggerKind</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/CompletionItem.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$label</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/ContentChangeEvent.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$text</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Diagnostic.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$message</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/DocumentHighlight.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$range</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/DocumentOnTypeFormattingOptions.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$firstTriggerCharacter</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/FormattingOptions.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$insertSpaces</code>
<code>$tabSize</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Hover.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$contents</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Location.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$range</code>
<code>$uri</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/MarkedString.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$language</code>
<code>$value</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/MarkupContent.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$kind</code>
<code>$value</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/MessageActionItem.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$title</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/PackageDescriptor.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$name</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Position.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$character</code>
<code>$line</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Range.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$end</code>
<code>$start</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/ReferenceContext.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$includeDeclaration</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/ReferenceInformation.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$reference</code>
<code>$symbol</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/SymbolDescriptor.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$fqsen</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/SymbolInformation.php">
<PossiblyNullPropertyAssignmentValue occurrences="3">
<code>$kind</code>
<code>$location</code>
<code>$name</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/SymbolLocationInformation.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$symbol</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/TextDocumentContentChangeEvent.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$text</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/TextDocumentIdentifier.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$uri</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/TextDocumentItem.php">
<PossiblyNullPropertyAssignmentValue occurrences="4">
<code>$languageId</code>
<code>$text</code>
<code>$uri</code>
<code>$version</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/TextEdit.php">
<PossiblyNullPropertyAssignmentValue occurrences="2">
<code>$newText</code>
<code>$range</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/VersionedTextDocumentIdentifier.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$version</code>
</PossiblyNullPropertyAssignmentValue>
</file>
</files>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>

View File

@@ -0,0 +1,22 @@
<?php
namespace LanguageServerProtocol;
class CallHierarchyClientCapabilities
{
/**
* Whether implementation supports dynamic registration. If this is set to
* `true` the client supports the new `(TextDocumentRegistrationOptions &
* StaticRegistrationOptions)` return value for the corresponding server
* capability as well.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(?bool $dynamicRegistration = null)
{
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace LanguageServerProtocol;
class ChangeAnnotation
{
/**
* A human-readable string describing the actual change. The string
* is rendered prominent in the user interface.
*
* @var string
*/
public $label;
/**
* A flag which indicates that user confirmation is needed
* before applying the change.
*
* @var bool|null
*/
public $needsConfirmation;
/**
* A human-readable string which is rendered less prominent in
* the user interface.
*
* @var string|null
*/
public $description;
public function __construct(string $label = null, bool $needsConfirmation = null, string $description = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->label = $label;
$this->needsConfirmation = $needsConfirmation;
$this->description = $description;
}
}

View File

@@ -0,0 +1,97 @@
<?php
namespace LanguageServerProtocol;
class ClientCapabilities
{
/**
* Workspace specific client capabilities.
*
* @var ClientCapabilitiesWorkspace|null
*/
public $workspace;
/**
* Text document specific client capabilities.
*
* @var TextDocumentClientCapabilities|null
*/
public $textDocument;
/**
* Window specific client capabilities.
*
* @var ClientCapabilitiesWindow|null
*/
public $window;
/**
* General client capabilities.
*
* @since 3.16.0
*
* @var ClientCapabilitiesGeneral|null
*/
public $general;
/**
* Experimental client capabilities.
*
* @var mixed|null
*/
public $experimental;
/**
* 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;
/**
* Undocumented function
*
* @param ClientCapabilitiesWorkspace|null $workspace
* @param TextDocumentClientCapabilities|null $textDocument
* @param ClientCapabilitiesWindow|null $window
* @param ClientCapabilitiesGeneral|null $general
* @param mixed|null $experimental
* @param bool|null $xfilesProvider
* @param bool|null $xcontentProvider
* @param bool|null $xcacheProvider
*/
public function __construct(
ClientCapabilitiesWorkspace $workspace = null,
TextDocumentClientCapabilities $textDocument = null,
ClientCapabilitiesWindow $window = null,
ClientCapabilitiesGeneral $general = null,
$experimental = null,
bool $xfilesProvider = null,
bool $xcontentProvider = null,
bool $xcacheProvider = null
) {
$this->workspace = $workspace;
$this->textDocument = $textDocument;
$this->window = $window;
$this->general = $general;
$this->experimental = $experimental;
$this->xfilesProvider = $xfilesProvider;
$this->xcontentProvider = $xcontentProvider;
$this->xcacheProvider = $xcacheProvider;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace LanguageServerProtocol;
class ClientCapabilitiesGeneral
{
/**
* Client capabilities specific to regular expressions.
*
* @since 3.16.0
*
* @var RegularExpressionsClientCapabilities|null
*/
public $regularExpressions;
/**
* Client capabilities specific to the client's markdown parser.
*
* @since 3.16.0
*
* @var MarkdownClientCapabilities|null
*/
public $markdown;
public function __construct(
RegularExpressionsClientCapabilities $regularExpressions = null,
MarkdownClientCapabilities $markdown = null
) {
$this->regularExpressions = $regularExpressions;
$this->markdown = $markdown;
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace LanguageServerProtocol;
class ClientCapabilitiesWindow
{
/**
* Whether client supports handling progress notifications. If set
* servers are allowed to report in `workDoneProgress` property in the
* request specific server capabilities.
*
* @since 3.15.0
*
* @var boolean|null
*/
public $workDoneProgress;
/**
* Capabilities specific to the showMessage request
*
* @since 3.16.0
*
* @var ShowMessageRequestClientCapabilities|null
*/
public $showMessage;
/**
* Client capabilities for the show document request.
*
* @since 3.16.0
*
* @var ShowDocumentClientCapabilities|null
*/
public $showDocument;
public function __construct(
bool $workDoneProgress = null,
ShowMessageRequestClientCapabilities $showMessage = null,
ShowDocumentClientCapabilities $showDocument = null
) {
$this->workDoneProgress = $workDoneProgress;
$this->showMessage = $showMessage;
$this->showDocument = $showDocument;
}
}

View File

@@ -0,0 +1,99 @@
<?php
namespace LanguageServerProtocol;
class ClientCapabilitiesWorkspace
{
/**
* The client supports applying batch edits
* to the workspace by supporting the request
* 'workspace/applyEdit'
*
* @var bool|null
*/
public $applyEdit;
/**
* Capabilities specific to `WorkspaceEdit`s
*
* @var WorkspaceEditClientCapabilities|null
*/
public $workspaceEdit;
/**
* Capabilities specific to the `workspace/didChangeConfiguration`
* notification.
*
* @var DidChangeConfigurationClientCapabilities|null
*/
public $didChangeConfiguration;
/**
* Capabilities specific to the `workspace/didChangeWatchedFiles`
* notification.
*
* @var DidChangeWatchedFilesClientCapabilities|null
*/
public $didChangeWatchedFiles;
/**
* Capabilities specific to the `workspace/symbol` request.
*
* @var WorkspaceSymbolClientCapabilities|null
*/
public $symbol;
/**
* Capabilities specific to the `workspace/executeCommand` request.
*
* @var ExecuteCommandClientCapabilities|null
*/
public $executeCommand;
/**
* The client has support for workspace folders.
*
* @since 3.6.0
*
* @var bool|null
*/
public $workspaceFolders;
/**
* The client supports `workspace/configuration` requests.
*
* @since 3.6.0
*
* @var bool|null
*/
public $configuration;
/**
* Capabilities specific to the semantic token requests scoped to the
* workspace.
*
* @since 3.16.0
*
* @var SemanticTokensWorkspaceClientCapabilities|null
*/
public $semanticTokens;
/**
* Capabilities specific to the code lens requests scoped to the
* workspace.
*
* @since 3.16.0
*
* @var CodeLensWorkspaceClientCapabilities|null
*/
public $codeLens;
/**
* The client has support for file requests/notifications.
*
* @since 3.16.0
*
* @var ClientCapabilitiesWorkspaceFileOperations|null
*/
public $fileOperations;
}

View File

@@ -0,0 +1,75 @@
<?php
namespace LanguageServerProtocol;
class ClientCapabilitiesWorkspaceFileOperations
{
/**
* Whether the client supports dynamic registration for file
* requests/notifications.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* The client has support for sending didCreateFiles notifications.
*
* @var bool|null
*/
public $didCreate;
/**
* The client has support for sending willCreateFiles requests.
*
* @var bool|null
*/
public $willCreate;
/**
* The client has support for sending didRenameFiles notifications.
*
* @var bool|null
*/
public $didRename;
/**
* The client has support for sending willRenameFiles requests.
*
* @var bool|null
*/
public $willRename;
/**
* The client has support for sending didDeleteFiles notifications.
*
* @var bool|null
*/
public $didDelete;
/**
* The client has support for sending willDeleteFiles requests.
*
* @var bool|null
*/
public $willDelete;
public function __construct(
bool $dynamicRegistration = null,
bool $didCreate = null,
bool $willCreate = null,
bool $didRename = null,
bool $willRename = null,
bool $didDelete = null,
bool $willDelete = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->didCreate = $didCreate;
$this->willCreate = $willCreate;
$this->didRename = $didRename;
$this->willRename = $willRename;
$this->didDelete = $didDelete;
$this->willDelete = $willDelete;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace LanguageServerProtocol;
class ClientInfo
{
/**
* The name of the client as defined by the client.
*
* @var string
*/
public $name;
/**
* The client's version as defined by the client.
*
* @var string|null
*/
public $version;
public function __construct(
string $name = null,
string $version = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->name = $name;
$this->version = $version;
}
}

View File

@@ -0,0 +1,146 @@
<?php
namespace LanguageServerProtocol;
use JsonSerializable;
/**
* A code action represents a change that can be performed in code, e.g. to fix
* a problem or to refactor code.
*
* A CodeAction must set either `edit` and/or a `command`. If both are supplied,
* the `edit` is applied first, then the `command` is executed.
*/
class CodeAction implements JsonSerializable
{
/**
* A short, human-readable, title for this code action.
*
* @var string
*/
public $title;
/**
* The kind of the code action.
*
* Used to filter code actions.
*
* @var string|null
* @see CodeActionKind
*/
public $kind;
/**
* The diagnostics that this code action resolves.
* @var Diagnostic[]|null
*/
public $diagnostics;
/**
* Marks this as a preferred action. Preferred actions are used by the
* `auto fix` command and can be targeted by keybindings.
*
* A quick fix should be marked preferred if it properly addresses the
* underlying error. A refactoring should be marked preferred if it is the
* most reasonable choice of actions to take.
*
* @since 3.15.0
*
* @var bool|null
*/
public $isPreferred;
/**
* Marks that the code action cannot currently be applied.
*
* Clients should follow the following guidelines regarding disabled code
* actions:
*
* - Disabled code actions are not shown in automatic lightbulbs code
* action menus.
*
* - Disabled actions are shown as faded out in the code action menu when
* the user request a more specific type of code action, such as
* refactorings.
*
* - If the user has a keybinding that auto applies a code action and only
* a disabled code actions are returned, the client should show the user
* an error message with `reason` in the editor.
*
* @since 3.16.0
*
* @var CodeActionDisabled|null
*/
public $disabled;
/**
* The workspace edit this code action performs.
*
* @var WorkspaceEdit|null
*/
public $edit;
/**
* A command this code action executes. If a code action
* provides an edit and a command, first the edit is
* executed and then the command.
*
* @var Command|null
*/
public $command;
/**
* A data entry field that is preserved on a code action between
* a `textDocument/codeAction` and a `codeAction/resolve` request.
*
* @since 3.16.0
*
* @var mixed|null
*/
public $data;
/**
* Undocumented function
*
* @param string|null $title
* @param string|null $kind
* @param Diagnostic[]|null $diagnostics
* @param boolean|null $isPreferred
* @param CodeActionDisabled|null $disabled
* @param WorkspaceEdit|null $edit
* @param Command|null $command
* @param mixed $data
*/
public function __construct(
string $title = null,
string $kind = null,
array $diagnostics = null,
bool $isPreferred = null,
CodeActionDisabled $disabled = null,
WorkspaceEdit $edit = null,
Command $command = null,
$data = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->title = $title;
$this->kind = $kind;
$this->diagnostics = $diagnostics;
$this->isPreferred = $isPreferred;
$this->disabled = $disabled;
$this->edit = $edit;
$this->command = $command;
$this->data = $data;
}
/**
* This is needed because VSCode Does not like nulls
* meaning if a null is sent then this will not compute
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return array_filter(get_object_vars($this));
}
}

View File

@@ -0,0 +1,95 @@
<?php
namespace LanguageServerProtocol;
class CodeActionClientCapabilities
{
/**
* Whether code action supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* The client supports code action literals as a valid
* response of the `textDocument/codeAction` request.
*
* @since 3.8.0
*
* @var CodeActionClientCapabilitiesCodeActionLiteralSupport|null
*/
public $codeActionLiteralSupport;
/**
* Whether code action supports the `isPreferred` property.
*
* @since 3.15.0
*
* @var bool|null
*/
public $isPreferredSupport;
/**
* Whether code action supports the `disabled` property.
*
* @since 3.16.0
*
* @var bool|null
*/
public $disabledSupport;
/**
* Whether code action supports the `data` property which is
* preserved between a `textDocument/codeAction` and a
* `codeAction/resolve` request.
*
* @since 3.16.0
*
* @var bool|null
*/
public $dataSupport;
/**
* Whether the client supports resolving additional code action
* properties via a separate `codeAction/resolve` request.
*
* @since 3.16.0
*
* @var CodeActionClientCapabilitiesResolveSupport|null
*/
public $resolveSupport;
/**
* Whether the client honors the change annotations in
* text edits and resource operations returned via the
* `CodeAction#edit` property by for example presenting
* the workspace edit in the user interface and asking
* for confirmation.
*
* @since 3.16.0
*
* @var bool|null
*/
public $honorsChangeAnnotations;
public function __construct(
bool $dynamicRegistration = null,
CodeActionClientCapabilitiesCodeActionLiteralSupport $codeActionLiteralSupport = null,
bool $isPreferredSupport = null,
bool $disabledSupport = null,
bool $dataSupport = null,
CodeActionClientCapabilitiesResolveSupport $resolveSupport = null,
bool $honorsChangeAnnotations = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->codeActionLiteralSupport = $codeActionLiteralSupport;
$this->isPreferredSupport = $isPreferredSupport;
$this->disabledSupport = $disabledSupport;
$this->dataSupport = $dataSupport;
$this->resolveSupport = $resolveSupport;
$this->honorsChangeAnnotations = $honorsChangeAnnotations;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class CodeActionClientCapabilitiesCodeActionLiteralSupport
{
/**
* The code action kind is supported with the following value
* set.
*
* @var CodeActionClientCapabilitiesCodeActionLiteralSupportcodeActionKind
*/
public $codeActionKind;
public function __construct(CodeActionClientCapabilitiesCodeActionLiteralSupportcodeActionKind $codeActionKind)
{
$this->codeActionKind = $codeActionKind;
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace LanguageServerProtocol;
class CodeActionClientCapabilitiesCodeActionLiteralSupportcodeActionKind
{
/**
* The code action kind values the client supports. When this
* property exists the client also guarantees that it will
* handle values outside its set gracefully and falls back
* to a default value when unknown.
*
* @var string[]
* @see CodeActionKind
*/
public $valueSet;
/**
* Undocumented function
*
* @param string[] $valueSet
*/
public function __construct(array $valueSet)
{
$this->valueSet = $valueSet;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace LanguageServerProtocol;
class CodeActionClientCapabilitiesResolveSupport
{
/**
* The properties that a client can resolve lazily.
*
* @var string[]
*/
public $properties;
/**
* @param string[] $properties
*/
public function __construct(array $properties)
{
$this->properties = $properties;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace LanguageServerProtocol;
/**
* Contains additional diagnostic information about the context in which
* a code action is run.
*/
class CodeActionContext
{
/**
* An array of diagnostics known on the client side overlapping the range
* provided to the `textDocument/codeAction` request. They are provided so
* that the server knows which errors are currently presented to the user
* for the given range. There is no guarantee that these accurately reflect
* the error state of the resource. The primary parameter
* to compute code actions is the provided range.
*
* @var Diagnostic[]
*/
public $diagnostics;
/**
* Requested kind of actions to return.
*
* Actions not of this kind are filtered out by the client before being
* shown. So servers can omit computing them.
*
* @var string[]|null
* @see CodeActionKind
*/
public $only;
/**
* The reason why code actions were requested.
*
* @since 3.17.0
*
* @var int|null
* @see CodeActionTriggerKind
*/
public $triggerKind;
/**
* @param Diagnostic[] $diagnostics
*/
public function __construct(array $diagnostics = [])
{
$this->diagnostics = $diagnostics;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace LanguageServerProtocol;
class CodeActionDisabled
{
/**
* Human readable description of why the code action is currently
* disabled.
*
* This is displayed in the code actions UI.
*
* @var string
*/
public $reason;
public function __construct(string $reason)
{
$this->reason = $reason;
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace LanguageServerProtocol;
/**
* A set of predefined code action kinds.
*/
abstract class CodeActionKind
{
/**
* Empty kind.
*/
const EMPTY = '';
/**
* Base kind for quickfix actions: 'quickfix'.
*/
const QUICK_FIX = 'quickfix';
/**
* Base kind for refactoring actions: 'refactor'.
*/
const REFACTOR = 'refactor';
/**
* Base kind for refactoring extraction actions: 'refactor.extract'.
*
* Example extract actions:
*
* - Extract method
* - Extract function
* - Extract variable
* - Extract interface from class
* - ...
*/
const REFACTOR_EXTRACT = 'refactor.extract';
/**
* Base kind for refactoring inline actions: 'refactor.inline'.
*
* Example inline actions:
*
* - Inline function
* - Inline variable
* - Inline constant
* - ...
*/
const REFACTOR_INLINE = 'refactor.inline';
/**
* Base kind for refactoring rewrite actions: 'refactor.rewrite'.
*
* Example rewrite actions:
*
* - Convert JavaScript function to class
* - Add or remove parameter
* - Encapsulate field
* - Make method static
* - Move method to base class
* - ...
*/
const REFACTOR_REWRITE = 'refactor.rewrite';
/**
* Base kind for source actions: `source`.
*
* Source code actions apply to the entire file.
*/
const SOURCE = 'source';
/**
* Base kind for an organize imports source action:
* `source.organizeImports`.
*/
const SOURCE_ORGANIZE_IMPORTS = 'source.organizeImports';
/**
* Base kind for a 'fix all' source action: `source.fixAll`.
*
* 'Fix all' actions automatically fix errors that have a clear fix that
* do not require user input. They should not suppress errors or perform
* unsafe fixes such as generating new types or classes.
*
* @since 3.17.0
*/
const SOURCE_FIX_ALL = 'source.fixAll';
}

View File

@@ -0,0 +1,22 @@
<?php
namespace LanguageServerProtocol;
/**
* A set of predefined code action kinds.
*/
abstract class CodeActionTriggerKind
{
/**
* Code actions were explicitly requested by the user or by an extension.
*/
const INVOKED = 1;
/**
* Code actions were requested automatically.
*
* This typically happens when current selection in a file changes, but can
* also be triggered when file content changes.
*/
const AUTOMATIC = 2;
}

View File

@@ -0,0 +1,23 @@
<?php
namespace LanguageServerProtocol;
/**
* Structure to capture a description for an error code.
*
* @since 3.16.0
*/
class CodeDescription
{
/**
* An URI to open with more information about the diagnostic error.
*
* @var string
*/
public $href;
public function __construct(string $href)
{
$this->href = $href;
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
/**
* @param mixed $data
*/
public function __construct(Range $range = null, Command $command = null, $data = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->range = $range;
$this->command = $command;
$this->data = $data;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class CodeLensClientCapabilities
{
/**
* Whether text document synchronization supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace LanguageServerProtocol;
/**
* Code Lens options.
*/
class CodeLensOptions
{
/**
* Code lens has a resolve provider as well.
*
* @var bool|null
*/
public $resolveProvider;
public function __construct(bool $resolveProvider = null)
{
$this->resolveProvider = $resolveProvider;
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace LanguageServerProtocol;
class CodeLensWorkspaceClientCapabilities
{
/**
* Whether the client implementation supports a refresh request sent from the
* server to the client.
*
* Note that this event is global and will force the client to refresh all
* code lenses currently shown. It should be used with absolute care and is
* useful for situation where a server for example detect a project wide
* change that requires such a calculation.
*
* @var bool|null
*/
public $refreshSupport;
public function __construct(
bool $refreshSupport = null
) {
$this->refreshSupport = $refreshSupport;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace LanguageServerProtocol;
/**
* 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|null
*/
public $title;
/**
* The identifier of the actual command handler.
*
* @var string|null
*/
public $command;
/**
* Arguments that the command handler should be
* invoked with.
*
* @var mixed[]|null
*/
public $arguments;
/**
* @param mixed[]|null $arguments
*/
public function __construct(string $title = null, string $command = null, array $arguments = null)
{
$this->title = $title;
$this->command = $command;
$this->arguments = $arguments;
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace LanguageServerProtocol;
class CompletionClientCapabilities
{
/**
* Whether completion supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* The client supports the following `CompletionItem` specific
* capabilities.
*
* @var CompletionClientCapabilitiesCompletionItem|null
*/
public $completionItem;
/**
* The client supports to send additional context information for a
* `textDocument/completion` request.
*
* @var bool|null
*/
public $contextSupport;
/**
* The client's default when the completion item doesn't provide a
* `insertTextMode` property.
*
* @since 3.17.0 - proposed state
*
* @var int|null
* @see InsertTextFormat
*/
public $insertTextMode;
/**
* The client supports the following `CompletionList` specific
* capabilities.
*
* @since 3.17.0 - proposed state
*
* @var CompletionClientCapabilitiesCompletionList|null
*/
public $completionList;
public function __construct(
bool $dynamicRegistration = null,
CompletionClientCapabilitiesCompletionItem $completionItem = null,
bool $contextSupport = null,
int $insertTextMode = null,
CompletionClientCapabilitiesCompletionList $completionList = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->completionItem = $completionItem;
$this->contextSupport = $contextSupport;
$this->insertTextMode = $insertTextMode;
$this->completionList = $completionList;
}
}

View File

@@ -0,0 +1,140 @@
<?php
namespace LanguageServerProtocol;
class CompletionClientCapabilitiesCompletionItem
{
/**
* Client supports snippets as insert text.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are
* linked, that is typing in one will update others too.
*
* @var bool|null
*/
public $snippetSupport;
/**
* Client supports commit characters on a completion item.
*
* @var bool|null
*/
public $commitCharactersSupport;
/**
* Client supports the follow content formats for the documentation
* property. The order describes the preferred format of the client.
*
* @var string[]|null
*/
public $documentationFormat;
/**
* Client supports the deprecated property on a completion item.
*
* @var bool|null
*/
public $deprecatedSupport;
/**
* Client supports the preselect property on a completion item.
*
* @var bool|null
*/
public $preselectSupport;
/**
* Client supports the tag property on a completion item. Clients
* supporting tags have to handle unknown tags gracefully. Clients
* especially need to preserve unknown tags when sending a completion
* item back to the server in a resolve call.
*
* @since 3.15.0
*
* @var CompletionClientCapabilitiesCompletionItemTagSupport|null
*/
public $tagSupport;
/**
* Client supports insert replace edit to control different behavior if
* a completion item is inserted in the text or should replace text.
*
* @since 3.16.0
*
* @var bool|null
*/
public $insertReplaceSupport;
/**
* Indicates which properties a client can resolve lazily on a
* completion item. Before version 3.16.0 only the predefined properties
* `documentation` and `detail` could be resolved lazily.
*
* @since 3.16.0
*
* @var CompletionClientCapabilitiesCompletionItemResolveSupport|null
*/
public $resolveSupport;
/**
* The client supports the `insertTextMode` property on
* a completion item to override the whitespace handling mode
* as defined by the client (see `insertTextMode`).
*
* @since 3.16.0
*
* @var CompletionClientCapabilitiesCompletionItemInsertTextModeSupport|null
*/
public $insertTextModeSupport;
/**
* The client has support for completion item label
* details (see also `CompletionItemLabelDetails`).
*
* @since 3.17.0 - proposed state
*
* @var bool|null
*/
public $labelDetailsSupport;
/**
* Undocumented function
*
* @param boolean|null $snippetSupport
* @param boolean|null $commitCharactersSupport
* @param string[]|null $documentationFormat
* @param boolean|null $deprecatedSupport
* @param boolean|null $preselectSupport
* @param CompletionClientCapabilitiesCompletionItemTagSupport|null $tagSupport
* @param boolean|null $insertReplaceSupport
* @param CompletionClientCapabilitiesCompletionItemResolveSupport|null $resolveSupport
* @param CompletionClientCapabilitiesCompletionItemInsertTextModeSupport|null $insertTextModeSupport
* @param boolean|null $labelDetailsSupport
*/
public function __construct(
bool $snippetSupport = null,
bool $commitCharactersSupport = null,
array $documentationFormat = null,
bool $deprecatedSupport = null,
bool $preselectSupport = null,
CompletionClientCapabilitiesCompletionItemTagSupport $tagSupport = null,
bool $insertReplaceSupport = null,
CompletionClientCapabilitiesCompletionItemResolveSupport $resolveSupport = null,
CompletionClientCapabilitiesCompletionItemInsertTextModeSupport $insertTextModeSupport = null,
bool $labelDetailsSupport = null
) {
$this->snippetSupport = $snippetSupport;
$this->commitCharactersSupport = $commitCharactersSupport;
$this->documentationFormat = $documentationFormat;
$this->deprecatedSupport = $deprecatedSupport;
$this->preselectSupport = $preselectSupport;
$this->tagSupport = $tagSupport;
$this->insertReplaceSupport = $insertReplaceSupport;
$this->resolveSupport = $resolveSupport;
$this->insertTextModeSupport = $insertTextModeSupport;
$this->labelDetailsSupport = $labelDetailsSupport;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace LanguageServerProtocol;
class CompletionClientCapabilitiesCompletionItemInsertTextModeSupport
{
/**
* The tags supported by the client.
*
* @var int[]
*/
public $valueSet;
/**
* @param int[] $valueSet InsertTextMode
*/
public function __construct(
array $valueSet = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->valueSet = $valueSet;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace LanguageServerProtocol;
class CompletionClientCapabilitiesCompletionItemResolveSupport
{
/**
* The properties that a client can resolve lazily.
*
* @var string[]
*/
public $properties;
/**
* @param string[] $properties
*/
public function __construct(
array $properties = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->properties = $properties;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace LanguageServerProtocol;
class CompletionClientCapabilitiesCompletionItemTagSupport
{
/**
* The tags supported by the client.
*
* @var int[]
*/
public $valueSet;
/**
* @param int[]|null $valueSet CompletionItemTag
*/
public function __construct(
array $valueSet = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->valueSet = $valueSet;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace LanguageServerProtocol;
class CompletionClientCapabilitiesCompletionList
{
/**
* The client supports the the following itemDefaults on
* a completion list.
*
* The value lists the supported property names of the
* `CompletionList.itemDefaults` object. If omitted
* no properties are supported.
*
* @since 3.17.0 - proposed state
*
* @var string[]|null
*/
public $itemDefaults;
/**
* @param string[]|null $itemDefaults
*/
public function __construct(
array $itemDefaults = null
) {
$this->itemDefaults = $itemDefaults;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace LanguageServerProtocol;
/**
* 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)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->triggerKind = $triggerKind;
$this->triggerCharacter = $triggerCharacter;
}
}

View File

@@ -0,0 +1,248 @@
<?php
declare(strict_types = 1);
namespace LanguageServerProtocol;
class CompletionItem
{
/**
* The label of this completion item. By default
* also the text that is inserted when selecting
* this completion.
*
* @var string
*/
public $label;
/**
* Additional details for the label
*
* @since 3.17.0 - proposed state
*
* @var CompletionItemLabelDetails|null
*/
public $labelDetails;
/**
* The kind of this completion item. Based of the kind
* an icon is chosen by the editor.
*
* @var int|null
* @see CompletionItemKind
*/
public $kind;
/**
* Tags for this completion item.
*
* @since 3.15.0
*
* @var CompletionItemTag[]|null
*/
public $tags;
/**
* 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;
/**
* Indicates if this item is deprecated.
*
* @deprecated Use `tags` instead if supported.
*
* @var bool|null
*/
public $deprecated;
/**
* Select this item when showing.
*
* *Note* that only one completion item can be selected and that the
* tool / client decides which item that is. The rule is that the *first*
* item of those that match best is selected.
*
* @var bool|null
*/
public $preselect;
/**
* A string that should 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 into a document when selecting
* this completion. When `falsy` the label is used as the insert text
* for this item.
*
* The `insertText` is subject to interpretation by the client side.
* Some tools might not take the string literally. For example
* VS Code when code complete is requested in this example
* `con<cursor position>` and a completion item with an `insertText` of
* `console` is provided it will only insert `sole`. Therefore it is
* recommended to use `textEdit` instead since it avoids additional client
* side interpretation.
*
* @var string|null
*/
public $insertText;
/**
* The format of the insert text. The format applies to both the
* `insertText` property and the `newText` property of a provided
* `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
*
* Please note that the insertTextFormat doesn't apply to
* `additionalTextEdits`.
*
* @var int|null
* @see InsertTextFormat
*/
public $insertTextFormat;
/**
* How whitespace and indentation is handled during completion
* item insertion. If not provided the client's default value depends on
* the `textDocument.completion.insertTextMode` client capability.
*
* @since 3.16.0
* @since 3.17.0 - support for `textDocument.completion.insertTextMode`
*
* @var int|null
* @see InsertTextMode
*/
public $insertTextMode;
/**
* An edit which is applied to a document when selecting this completion.
* When an edit is provided the value of `insertText` is ignored.
*
* *Note:* The range of the edit must be a single line range and it must
* contain the position at which completion has been requested.
*
* Most editors support two different operations when accepting a completion
* item. One is to insert a completion text and the other is to replace an
* existing text with a completion text. Since this can usually not be
* predetermined by a server it can report both ranges. Clients need to
* signal support for `InsertReplaceEdit`s via the
* `textDocument.completion.completionItem.insertReplaceSupport` client
* capability property.
*
* *Note 1:* The text edit's range as well as both ranges from an insert
* replace edit must be a [single line] and they must contain the position
* at which completion has been requested.
* *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range
* must be a prefix of the edit's replace range, that means it must be
* contained and starting at the same position.
*
* @since 3.16.0 additional type `InsertReplaceEdit`
*
* @var TextEdit|null
*/
public $textEdit;
/**
* An optional array of additional text edits that are applied when
* selecting this completion. Edits must not overlap (including the same
* insert position) with the main edit nor with themselves.
*
* Additional text edits should be used to change text unrelated to the
* current cursor position (for example adding an import statement at the
* top of the file if the completion item will insert an unqualified type).
*
* @var TextEdit[]|null
*/
public $additionalTextEdits;
/**
* An optional set of characters that when pressed while this completion is
* active will accept it first and then type that character. *Note* that all
* commit characters should have `length=1` and that superfluous characters
* will be ignored.
*
* @var string[]|null
*/
public $commitCharacters;
/**
* 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
* @param int|null $insertTextFormat
*/
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,
int $insertTextFormat = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$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;
$this->insertTextFormat = $insertTextFormat;
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace LanguageServerProtocol;
/**
* 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::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;
case SymbolKind::STRING:
default:
return self::TEXT;
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace LanguageServerProtocol;
/**
* Additional details for a completion item label.
*
* @since 3.17.0 - proposed state
*/
class CompletionItemLabelDetails
{
/**
* An optional string which is rendered less prominently directly after
* {@link CompletionItem.label label}, without any spacing. Should be
* used for function signatures or type annotations.
*
* @var string|null
*/
public $detail;
/**
* An optional string which is rendered less prominently after
* {@link CompletionItemLabelDetails.detail}. Should be used for fully qualified
* names or file path.
*
* @var string|null
*/
public $description;
public function __construct(string $detail = null, string $description = null)
{
$this->detail = $detail;
$this->description = $description;
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace LanguageServerProtocol;
abstract class CompletionItemTag
{
/**
* Render a completion as obsolete, usually using a strike-out.
*/
const DEPRECATED = 1;
}

View File

@@ -0,0 +1,39 @@
<?php
namespace LanguageServerProtocol;
/**
* Represents a collection of completion items to be presented in
* the editor.
*/
class CompletionList
{
/**
* This list is not complete. Further typing should result in recomputing
* this list.
*
* Recomputed lists have all their items replaced (not appended) in the
* incomplete completion sessions.
*
* @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;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
/**
* @param string[]|null $triggerCharacters
*/
public function __construct(bool $resolveProvider = null, array $triggerCharacters = null)
{
$this->resolveProvider = $resolveProvider;
$this->triggerCharacters = $triggerCharacters;
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace LanguageServerProtocol;
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;
}

View File

@@ -0,0 +1,39 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
public function __construct(Range $range = null, int $rangeLength = null, string $text = null)
{
$this->range = $range;
$this->rangeLength = $rangeLength;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->text = $text;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace LanguageServerProtocol;
class DeclarationClientCapabilities
{
/**
* Whether declaration supports dynamic registration. If this is set to
* `true` the client supports the new `DeclarationRegistrationOptions`
* return value for the corresponding server capability as well.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* The client supports additional metadata in the form of declaration links.
*
* @var bool|null
*/
public $linkSupport;
public function __construct(
bool $dynamicRegistration = null,
bool $linkSupport = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->linkSupport = $linkSupport;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace LanguageServerProtocol;
class DefinitionClientCapabilities
{
/**
* Whether definition supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* The client supports additional metadata in the form of definition links.
*
* @since 3.14.0
*
* @var bool|null
*/
public $linkSupport;
public function __construct(bool $dynamicRegistration = null, bool $linkSupport = null)
{
$this->dynamicRegistration = $dynamicRegistration;
$this->linkSupport = $linkSupport;
}
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types = 1);
namespace LanguageServerProtocol;
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;
}
}

View File

@@ -0,0 +1,121 @@
<?php
namespace LanguageServerProtocol;
/**
* 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. which might appear in the user interface
*
* @var int|null
*/
public $code;
/**
* An optional property to describe the error code.
*
* @since 3.16.0
*
* @var CodeDescription|null
*/
public $codeDescription;
/**
* 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;
/**
* Additional metadata about the diagnostic.
*
* @since 3.15.0
*
* @var int[]|null
* @see DiagnosticTag
*/
public $tags;
/**
* An array of related diagnostic information, e.g. when symbol-names within
* a scope collide all definitions can be marked via this property.
*
* @var DiagnosticRelatedInformation[]|null
*/
public $relatedInformation;
/**
* A data entry field that is preserved between a
* `textDocument/publishDiagnostics` notification and
* `textDocument/codeAction` request.
*
* @since 3.16.0
*
* @var mixed|null
*/
public $data;
/**
* @param string|null $message The diagnostic's message
* @param Range|null $range The range at which the message applies
* @param int|null $code The diagnostic's code
* @param int|null $severity DiagnosticSeverity
* @param string|null $source A human-readable string describing the source of this diagnostic
* @param CodeDescription|null $codeDescription
* @param int[]|null $tags Additional metadata about the diagnostic
* @param DiagnosticRelatedInformation[]|null $relatedInformation Related diagnostic information
* @param mixed $data A data entry field that is preserved between a `textDocument/publishDiagnostics`
* notification and `textDocument/codeAction` request
*/
public function __construct(
string $message = null,
Range $range = null,
int $code = null,
int $severity = null,
string $source = null,
CodeDescription $codeDescription = null,
array $tags = null,
array $relatedInformation = null,
$data = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->message = $message;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->range = $range;
$this->code = $code;
$this->severity = $severity;
$this->source = $source;
$this->codeDescription = $codeDescription;
$this->tags = $tags;
$this->relatedInformation = $relatedInformation;
$this->data = $data;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace LanguageServerProtocol;
/**
* Represents a related message and source code location for a diagnostic.
* This should be used to point to code locations that cause or are related to
* a diagnostics, e.g when duplicating a symbol in a scope.
*/
class DiagnosticRelatedInformation
{
/**
* The location of this related diagnostic information.
*
* @var Location
*/
public $location;
/**
* The message of this related diagnostic information.
*
* @var string
*/
public $message;
public function __construct(Location $location, string $message)
{
$this->location = $location;
$this->message = $message;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace LanguageServerProtocol;
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;
}

View File

@@ -0,0 +1,27 @@
<?php
namespace LanguageServerProtocol;
/**
* How whitespace and indentation is handled during completion
* item insertion.
*
* @since 3.16.0
*/
abstract class DiagnosticTag
{
/**
* Unused or unnecessary code.
*
* Clients are allowed to render diagnostics with this tag faded out
* instead of having an error squiggle.
*/
const UNNECESSARY = 1;
/**
* Deprecated or obsolete code.
*
* Clients are allowed to rendered diagnostics with this tag strike through.
*/
const DEPRECATED = 2;
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class DidChangeConfigurationClientCapabilities
{
/**
* Did change configuration notification supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace LanguageServerProtocol;
class DidChangeWatchedFilesClientCapabilities
{
/**
* Did change watched files notification supports dynamic registration.
* Please note that the current protocol doesn't support static
* configuration for file changes from the server side.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class DocumentColorClientCapabilities
{
/**
* Whether text document synchronization supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class DocumentFormattingClientCapabilities
{
/**
* Whether text document synchronization supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
public function __construct(Range $range = null, int $kind = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->range = $range;
$this->kind = $kind;
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace LanguageServerProtocol;
class DocumentHighlightClientCapabilities
{
/**
* Whether references supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(bool $dynamicRegistration = null)
{
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace LanguageServerProtocol;
/**
* A document highlight kind.
*/
abstract class DocumentHighlightKind
{
/**
* A textual occurrence.
*/
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;
}

View File

@@ -0,0 +1,31 @@
<?php
namespace LanguageServerProtocol;
class DocumentLinkClientCapabilities
{
/**
* Whether text document synchronization supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* Whether the client supports the `tooltip` property on `DocumentLink`.
*
* @since 3.15.0
*
* @var bool|null
*/
public $tooltipSupport;
public function __construct(
bool $dynamicRegistration = null,
bool $tooltipSupport = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->tooltipSupport = $tooltipSupport;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class DocumentOnTypeFormattingClientCapabilities
{
/**
* Whether text document synchronization supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
/**
* @param string[]|null $moreTriggerCharacter
*/
public function __construct(string $firstTriggerCharacter = null, array $moreTriggerCharacter = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->firstTriggerCharacter = $firstTriggerCharacter;
$this->moreTriggerCharacter = $moreTriggerCharacter;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class DocumentRangeFormattingClientCapabilities
{
/**
* Whether text document synchronization supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace LanguageServerProtocol;
class DocumentSymbolClientCapabilities
{
/**
* Whether document symbol supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* Specific capabilities for the `SymbolKind` in the
* `textDocument/documentSymbol` request.
*
* @var DocumentSymbolClientCapabilitiesSymbolKind|null
*/
public $symbolKind;
/**
* The client supports hierarchical document symbols.
*
* @var bool|null
*/
public $hierarchicalDocumentSymbolSupport;
/**
* The client supports tags on `SymbolInformation`. Tags are supported on
* `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
* Clients supporting tags have to handle unknown tags gracefully.
*
* @since 3.16.0
*
* @var DocumentSymbolClientCapabilitiesTagSupport|null
*/
public $tagSupport;
/**
* The client supports an additional label presented in the UI when
* registering a document symbol provider.
*
* @since 3.16.0
*
* @var bool|null
*/
public $labelSupport;
public function __construct(
bool $dynamicRegistration = null,
DocumentSymbolClientCapabilitiesSymbolKind $symbolKind = null,
bool $hierarchicalDocumentSymbolSupport = null,
DocumentSymbolClientCapabilitiesTagSupport $tagSupport = null,
bool $labelSupport = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->symbolKind = $symbolKind;
$this->hierarchicalDocumentSymbolSupport = $hierarchicalDocumentSymbolSupport;
$this->tagSupport = $tagSupport;
$this->labelSupport = $labelSupport;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace LanguageServerProtocol;
/**
* Specific capabilities for the `SymbolKind` in the
* `textDocument/documentSymbol` request.
*/
class DocumentSymbolClientCapabilitiesSymbolKind
{
/**
* The symbol kind values the client supports. When this
* property exists the client also guarantees that it will
* handle values outside its set gracefully and falls back
* to a default value when unknown.
*
* If this property is not present the client only supports
* the symbol kinds from `File` to `Array` as defined in
* the initial version of the protocol.
*
* @var int[]
* @see SymbolKind
*/
public $valueSet;
/**
* Undocumented function
*
* @param int[]|null $valueSet
*/
public function __construct(array $valueSet = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->valueSet = $valueSet;
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace LanguageServerProtocol;
class DocumentSymbolClientCapabilitiesTagSupport
{
/**
* The symbol kind values the client supports. When this
* property exists the client also guarantees that it will
* handle values outside its set gracefully and falls back
* to a default value when unknown.
*
* If this property is not present the client only supports
* the symbol kinds from `File` to `Array` as defined in
* the initial version of the protocol.
*
* @var int[]
*/
public $valueSet;
/**
* Undocumented function
*
* @param int[]|null $valueSet
*/
public function __construct(array $valueSet = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->valueSet = $valueSet;
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
}

View File

@@ -0,0 +1,20 @@
<?php
namespace LanguageServerProtocol;
class ExecuteCommandClientCapabilities
{
/**
* Execute command supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace LanguageServerProtocol;
class ExecuteCommandOptions
{
/**
* The commands to be executed on the server
*
* @var string[]
*/
public $commands;
/**
* @param string[] $commands
*/
public function __construct(
array $commands
) {
$this->commands = $commands;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace LanguageServerProtocol;
/**
* Defines how the host (editor) should sync document changes to the language server.
*/
abstract class FailureHandlingKind
{
/**
* Applying the workspace change is simply aborted if one of the changes
* provided fails. All operations executed before the failing operation
* stay executed.
*/
const ABORT = 'abort';
/**
* All operations are executed transactional. That means they either all
* succeed or no changes at all are applied to the workspace.
*/
const TRANSACTIONAL = 'transactional';
/**
* If the workspace edit contains only textual file changes they are
* executed transactional. If resource changes (create, rename or delete
* file) are part of the change the failure handling strategy is abort.
*/
const TEXT_ONLY_TRANSACTIONAL = 'textOnlyTransactional';
/**
* The client tries to undo the operations already executed. But there is no
* guarantee that this is succeeding.
*/
const UNDO = 'undo';
}

View File

@@ -0,0 +1,24 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
}

View File

@@ -0,0 +1,33 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace LanguageServerProtocol;
class FoldingRangeClientCapabilities
{
/**
* Whether hover supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* The maximum number of folding ranges that the client prefers to receive
* per document. The value serves as a hint, servers are free to follow the
* limit.
*
* @var int|null
*/
public $rangeLimit;
/**
* If set, the client signals that it only supports folding complete lines.
* If set, client will ignore specified `startCharacter` and `endCharacter`
* properties in a FoldingRange.
*
* @var bool|null
*/
public $lineFoldingOnly;
public function __construct(
bool $dynamicRegistration = null,
int $rangeLimit = null,
bool $lineFoldingOnly = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->rangeLimit = $rangeLimit;
$this->lineFoldingOnly = $lineFoldingOnly;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace LanguageServerProtocol;
/**
* 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.
public function __construct(int $tabSize = null, bool $insertSpaces = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->tabSize = $tabSize;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->insertSpaces = $insertSpaces;
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace LanguageServerProtocol;
/**
* The result of a hover request.
*/
class Hover
{
/**
* The hover's content
*
* @var string|MarkedString|string[]|MarkedString[]|MarkupContent
*/
public $contents;
/**
* An optional range
*
* @var Range|null
*/
public $range;
/**
* @param string|MarkedString|string[]|MarkedString[]|MarkupContent $contents The hover's content
* @param Range $range An optional range
*/
public function __construct($contents = null, $range = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->contents = $contents;
$this->range = $range;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace LanguageServerProtocol;
class HoverClientCapabilities
{
/**
* Whether hover supports dynamic registration.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* Client supports the follow content formats if the content
* property refers to a `literal of type MarkupContent`.
* The order describes the preferred format of the client.
*
* @var string[]|null
* @see MarkupKind
*/
public $contentFormat;
/**
* @param boolean|null $dynamicRegistration
* @param string[]|null $contentFormat
*/
public function __construct(
bool $dynamicRegistration = null,
array $contentFormat = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->contentFormat = $contentFormat;
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace LanguageServerProtocol;
class ImplementationClientCapabilities
{
/**
* Whether implementation supports dynamic registration. If this is set to
* `true` the client supports the new `ImplementationRegistrationOptions`
* return value for the corresponding server capability as well.
*
* @var bool|null
*/
public $dynamicRegistration;
/**
* The client supports additional metadata in the form of definition links.
*
* @since 3.14.0
*
* @var boolean|null
*/
public $linkSupport;
public function __construct(
bool $dynamicRegistration = null,
bool $linkSupport = null
) {
$this->dynamicRegistration = $dynamicRegistration;
$this->linkSupport = $linkSupport;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace LanguageServerProtocol;
class InitializeResult
{
/**
* The capabilities the language server provides.
*
* @var ServerCapabilities
*/
public $capabilities;
/**
* Information about the server.
*
* @since 3.15.0
*
* @var InitializeResultServerInfo|null
*/
public $serverInfo;
public function __construct(ServerCapabilities $capabilities = null, InitializeResultServerInfo $serverInfo = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->capabilities = $capabilities;
$this->serverInfo = $serverInfo;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace LanguageServerProtocol;
class InitializeResultServerInfo
{
/**
* The name of the server as defined by the server.
*
* @var string
*/
public $name;
/**
* The server's version as defined by the server.
*
* @var string|null
*/
public $version;
public function __construct(string $name, string $version = null)
{
$this->name = $name;
$this->version = $version;
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace LanguageServerProtocol;
/**
* Defines whether the insert text in a completion item should be interpreted as
* plain text or a snippet.
*/
abstract class InsertTextFormat
{
/**
* The primary text to be inserted is treated as a plain string.
*/
const PLAIN_TEXT = 1;
/**
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*/
const SNIPPET = 2;
}

View File

@@ -0,0 +1,32 @@
<?php
namespace LanguageServerProtocol;
/**
* How whitespace and indentation is handled during completion
* item insertion.
*
* @since 3.16.0
*/
abstract class InsertTextMode
{
/**
* The insertion or replace strings is taken as it is. If the
* value is multi line the lines below the cursor will be
* inserted using the indentation defined in the string value.
* The client will not apply any kind of adjustments to the
* string.
*/
const AS_IS = 1;
/**
* The editor adjusts leading whitespace of new lines so that
* they match the indentation up to the cursor of the line for
* which the item is accepted.
*
* Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
* multi line completion item is indented using 2 tabs and all
* following lines inserted will be indented using 2 tabs as well.
*/
const ADJUST_INDENTATION = 2;
}

View File

@@ -0,0 +1,23 @@
<?php
namespace LanguageServerProtocol;
class LinkedEditingRangeClientCapabilities
{
/**
* Whether implementation supports dynamic registration.
* If this is set to `true` the client supports the new
* `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace LanguageServerProtocol;
/**
* Represents a location inside a resource, such as a line inside a text file.
*/
class Location
{
/**
* @var string
*/
public $uri;
/**
* @var Range
*/
public $range;
public function __construct(string $uri = null, Range $range = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->uri = $uri;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->range = $range;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace LanguageServerProtocol;
/**
* The log message notification is sent from the server to the client to ask the client to log a particular message.
*/
class LogMessage
{
/**
* The message type. See {@link MessageType}
*
* @var int
* @see MessageType
*/
public $type;
/**
* The actual message
*
* @var string
*/
public $message;
public function __construct(int $type, string $message)
{
$this->type = $type;
$this->message = $message;
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace LanguageServerProtocol;
/**
* A notification to log the trace of the servers execution.
* The amount and content of these notifications depends on the
* current trace configuration. If trace is 'off', the server
* should not send any logTrace notification. If trace is
* 'messages', the server should not add the 'verbose' field in
* the LogTraceParams.
*
* $/logTrace should be used for systematic trace reporting.
* For single debugging messages, the server should send
* window/logMessage notifications.
*/
class LogTrace
{
/**
* The message to be logged.
*
* @var string
*/
public $message;
/**
* Additional information that can be computed if the `trace` configuration
* is set to `'verbose'`
*
* @var string|null
*/
public $verbose;
public function __construct(string $message, string $verbose = null)
{
$this->message = $message;
$this->verbose = $verbose;
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace LanguageServerProtocol;
class MarkdownClientCapabilities
{
/**
* The name of the parser.
*
* @var string
*/
public $parser;
/**
* The version of the parser.
*
* @var string|null
*/
public $version;
/**
* A list of HTML tags that the client allows / supports in
* Markdown.
*
* @since 3.17.0
*
* @var string[]|null
*/
public $allowedTags;
/**
* @param string|null $parser
* @param string|null $version
* @param string[]|null $allowedTags
*/
public function __construct(
string $parser = null,
string $version = null,
array $allowedTags = null
) {
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->parser = $parser;
$this->version = $version;
$this->allowedTags = $allowedTags;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace LanguageServerProtocol;
class MarkedString
{
/**
* @var string
*/
public $language;
/**
* @var string
*/
public $value;
public function __construct(string $language = null, string $value = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->language = $language;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->value = $value;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace LanguageServerProtocol;
/**
* A `MarkupContent` literal represents a string value which content is interpreted base on its
* kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
*
* If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
* See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
*
* Here is an example how such a string can be constructed using JavaScript / TypeScript:
* ```ts
* let markdown: MarkdownContent = {
* kind: MarkupKind.Markdown,
* value: [
* '# Header',
* 'Some text',
* '```typescript',
* 'someCode();',
* '```'
* ].join('\n')
* };
* ```
*
* *Please Note* that clients might sanitize the return markdown. A client could decide to
* remove HTML from the markdown to avoid script execution.
*/
class MarkupContent
{
/**
* @var string the type of the Markup (from MarkupKind)
*/
public $kind;
/**
* @var string the content itself
*/
public $value;
/**
* @param string $kind the type of the Markup
* @param string $value the content itself
*/
public function __construct(string $kind = null, string $value = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->kind = $kind;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->value = $value;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace LanguageServerProtocol;
/**
* Describes the content type that a client supports in various
* result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
*
* Please note that `MarkupKinds` must not start with a `$`. This kinds
* are reserved for internal usage.
*/
abstract class MarkupKind
{
/**
* Plain text is supported as a content format
*/
const PLAINTEXT = 'plaintext';
/**
* Markdown is supported as a content format
*/
const MARKDOWN = 'markdown';
}

View File

@@ -0,0 +1,19 @@
<?php
namespace LanguageServerProtocol;
class MessageActionItem
{
/**
* A short title like 'Retry', 'Open Log' etc.
*
* @var string
*/
public $title;
public function __construct(string $title = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->title = $title;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace LanguageServerProtocol;
/**
* 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;
}

View File

@@ -0,0 +1,23 @@
<?php
namespace LanguageServerProtocol;
class MonikerClientCapabilities
{
/**
* Whether implementation supports dynamic registration. If this is set to
* `true` the client supports the new `(TextDocumentRegistrationOptions &
* StaticRegistrationOptions)` return value for the corresponding server
* capability as well.
*
* @var bool|null
*/
public $dynamicRegistration;
public function __construct(
bool $dynamicRegistration = null
) {
$this->dynamicRegistration = $dynamicRegistration;
}
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types = 1);
namespace LanguageServerProtocol;
/**
* 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)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->name = $name;
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace LanguageServerProtocol;
/**
* Represents a parameter of a callable-signature. A parameter can
* have a label and a doc-comment.
*/
class ParameterInformation
{
/**
* The label of this parameter information.
*
* Either a string or an inclusive start and exclusive end offsets within its containing
* signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
* string representation as `Position` and `Range` does.
*
* *Note*: a label of type string should be a substring of its containing signature label.
* Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
*
* @var string|int[]
*/
public $label;
/**
* The human-readable doc-comment of this signature. Will be shown
* in the UI but can be omitted.
*
* @var MarkupContent|string|null
*/
public $documentation;
/**
* Create ParameterInformation
*
* @param string|int[] $label The label of this parameter information.
* @param MarkupContent|string|null $documentation The human-readable doc-comment of this signature.
* Will be shown in the UI but can be omitted.
*/
public function __construct($label, $documentation = null)
{
$this->label = $label;
$this->documentation = $documentation;
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace LanguageServerProtocol;
/**
* 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)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->line = $line;
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$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;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace LanguageServerProtocol;
abstract class PrepareSupportDefaultBehavior
{
/**
* The client's default behavior is to select the identifier
* according the to language's syntax rule.
*/
const IDENTIFIER = 1;
}

View File

@@ -0,0 +1,67 @@
<?php
namespace LanguageServerProtocol;
class PublishDiagnosticsClientCapabilities
{
/**
* Whether the clients accepts diagnostics with related information.
*
* @var bool|null
*/
public $relatedInformation;
/**
* Client supports the tag property to provide meta data about a diagnostic.
* Clients supporting tags have to handle unknown tags gracefully.
*
* @since 3.15.0
*
* @var PublishDiagnosticsClientCapabilitiesTagSupport|null
*/
public $tagSupport;
/**
* Whether the client interprets the version property of the
* `textDocument/publishDiagnostics` notification's parameter.
*
* @since 3.15.0
*
* @var bool|null
*/
public $versionSupport;
/**
* Client supports a codeDescription property
*
* @since 3.16.0
*
* @var bool|null
*/
public $codeDescriptionSupport;
/**
* Whether code action supports the `data` property which is
* preserved between a `textDocument/publishDiagnostics` and
* `textDocument/codeAction` request.
*
* @since 3.16.0
*
* @var bool|null
*/
public $dataSupport;
public function __construct(
bool $relatedInformation = null,
PublishDiagnosticsClientCapabilitiesTagSupport $tagSupport = null,
bool $versionSupport = null,
bool $codeDescriptionSupport = null,
bool $dataSupport = null
) {
$this->relatedInformation = $relatedInformation;
$this->tagSupport = $tagSupport;
$this->versionSupport = $versionSupport;
$this->codeDescriptionSupport = $codeDescriptionSupport;
$this->dataSupport = $dataSupport;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace LanguageServerProtocol;
class PublishDiagnosticsClientCapabilitiesTagSupport
{
/**
* The tags supported by the client.
*
* @var int[]
* @see DiagnosticTag
*/
public $valueSet;
/**
* @param int[]|null $valueSet
*/
public function __construct(array $valueSet = null)
{
/** @psalm-suppress PossiblyNullPropertyAssignmentValue */
$this->valueSet = $valueSet;
}
}

Some files were not shown because too many files have changed in this diff Show More