GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - phpactor/language-server-protocol

BranchesTags
Open more actions menu

Latest commit

 

History

98 Commits
98 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
tests/Unit
tests/Unit
 
 
ts
ts
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
phpstan.neon
phpstan.neon
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 
tsconfig.json
tsconfig.json
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

PHP Language Server Protocol Generator

CI

This package transpiles the vscode-language-server-protocol library to PHP, providing the protocol classes required to create Language Server with PHP.

Notes on using the library

Most (if not all) of the upstream Typescript types have no constructors, therefore the argument order of the constructors can change on every release.

It is therefore strongly recommended to use named arguments.

Generation

Generating the code:

  • npm run generate: Build and transpile
  • npm run watch: Watch and compile on Typescript changes.

Running the PHP tests:

  • composer integrate

Usage

Deserialization

This library will use the type information form typescript to generate fromArray static constructors for each type:

$item = CompletionItem::fromArray([
    'label' => 'Foobar',
    'kind' => 1,
    'detail' => 'This is foobar',
    'documentation' => [
        'kind' => 'markdown',
        'value' => 'Foobar',
    ],
    'additionalTextEdits' => [
        [
            'range' => [
                'start' => [
                    'line' => 5,
                    'character' => 10,
                ],
                'end' => [
                    'line' => 10,
                    'character' => 10,
                ],
            ],
            'newText' => 'Foobar',
        ],
    ],
    'command' => [
        'title' => 'Foobar',
        'command' => 'my.command',
    ],
]);

Will return a fully hydrated completion item with concrete sub-types.

NOTE: that when deserializing from a language server client request, it is probably a good idea to ignore additional parameters (the second argument to fromArray). This is because it is perfectly valid to pass unknown properties to some of the LSP objects.

Serialization

Properties in classes are public to enable JSON serialization. Call json_encode($lspObject) to get the valid LSP JSON object.

Contributing

This package is open source and welcomes contributions! Feel free to open a pull request on this repository.

Support

  • Create an issue on the main Phpactor repository.
  • Join the #phpactor channel on the Slack Symfony Devs channel.

About

No description, website, or topics provided.

Resources

Readme
License
Activity
Custom properties

Stars

12 stars

Watchers

2 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.