Skip to content

PHP LSP Extension Skeleton Project

License

Notifications You must be signed in to change notification settings

php-lsp/skeleton

Repository files navigation

About Language Server Protocol

[ALARM] This is not the final version!


LSP is a protocol for interaction with a client using the JSON-RPC 2.0 codec, where arbitrary editors and IDEs act as clients.

The protocol is supported by many clients, such as:

Most Popular Editors:

Most Popular IDE:

This project gives you the opportunity to write your own plugins for any editor or IDE using the PHP language!

Installation

# create an extension application
composer create-project php-lsp/skeleton

# allow build script to run (required once)
chmod +x bin/build

Running Extension Server

Run From Sources

php ./bin/lsp serve App\\Application --port=5007

Run From Code

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

$app = new \App\Application('dev', true);
$app->listen('tcp://127.0.0.1:5007');

Build And Run (Using Composer)

# build server assembly
composer build

# run server assembly
composer run

Build And Run (Using Binaries)

# build server assembly
./bin/build

# run server assembly
php ./var/prod/build.phar serve App\\Application --port=5007

Running Extension Client

Please note that these are just extension examples. Unification of the assembly without code (JS, Java, C#, etc) modification will come later, perhaps.

VSCode

See client/vscode/package.json to modify the configuration.

  1. Build and run editor:
    # move to vscode workspace
    cd client/vscode
    
    # install dependencies
    npm install
    
    # run client
    code .
  2. Then press F5 (in editor) to run extension

About

PHP LSP Extension Skeleton Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published