Coder Social home page Coder Social logo

intelephense-docs's People

Contributors

bmewburn avatar yaegassy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

intelephense-docs's Issues

Support intersections and unions type

Not sure this is the right place for such a "feature demand", but here goes.

Even though it is not really "official" per se, we can see more and more the syntax to define types using intersections and unions, such as Collection&iterable<Foo>, or variants such as Collection|Foo[].

This doesn't seem to be supported on intelephense and reports an error (while it is supported by e.g phpstan). Would be awesome to have such a support.

Cheers.

Add an option to the formatter not to move namespace to it's own line

Hello, I am a big fan of your vscode extension and a premium user but I tend to prefer phpfmt to the formatter included in the extension for two reasons. This is an issue about the first which is very minor:

I like to specify my namespace on the same line as the first php opening bracket like such:

<?php namespace App\Services;

// ...

but when I use your formatter it moves the namespace decleration to it's own line:

<?php 

namespace App\Services;

// ...

I would appreciate it if there was an option to disable this behavior

Paid version does not work

I just bought the licensed version and it doesn't work. I'm thinking about asking for a refund.

Communication log:

Params: {
    "textDocument": {
        "uri": "file:///Users/flavius.aspra/workspace/shopsystems/magento-2.3.0/vendor/magento/module-payment/Model/PaymentMethodList.php"
    },
    "position": {
        "line": 64,
        "character": 48
    }
}

Result: []

Using vim 8.2 (macvim) with coc.nvim.

The snippet of code was:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Payment\Model;

use Magento\Payment\Api\Data\PaymentMethodInterface;

/**
 * Payment method list class.
 */
class PaymentMethodList implements \Magento\Payment\Api\PaymentMethodListInterface
{
    /**
     * @var \Magento\Payment\Api\Data\PaymentMethodInterfaceFactory
     */
    private $methodFactory;

    /**
     * @var \Magento\Payment\Helper\Data
     */
    private $helper;

    /**
     * @param \Magento\Payment\Api\Data\PaymentMethodInterfaceFactory $methodFactory
     * @param \Magento\Payment\Helper\Data $helper
     */
    public function __construct(
        \Magento\Payment\Api\Data\PaymentMethodInterfaceFactory $methodFactory,
        \Magento\Payment\Helper\Data $helper
    ) {
        $this->methodFactory = $methodFactory;
        $this->helper = $helper;
    }

    /**
     * {@inheritdoc}
     */
    public function getList($storeId)
    {
        $methodsCodes = array_keys($this->helper->getPaymentMethods());

        $methodsInstances = array_map(
            function ($code) {
                return $this->helper->getMethodInstance($code);
            },
            $methodsCodes
        );

        $methodsInstances = array_filter($methodsInstances, function (MethodInterface $method) {
            return !($method instanceof \Magento\Payment\Model\Method\Substitution);
        });

        @uasort(
            $methodsInstances,
            function (MethodInterface $a, MethodInterface $b) use ($storeId) {
                return (int)$a->getConfigData('sort_order', $storeId) - (int)$b->getConfigData('sort_order', $storeId);
            }
        );

        $methodList = array_map(
            function (MethodInterface $methodInstance) use ($storeId) {

                return $this->methodFactory->create([
                    'code' => (string)$methodInstance->getCode(),
                    'title' => (string)$methodInstance->getTitle(),
                    'storeId' => (int)$storeId,
                    'isActive' => (bool)$methodInstance->isActive($storeId)
                ]);
            },
            $methodsInstances
        );

        return array_values($methodList);
    }

    /**
     * {@inheritdoc}
     */
    public function getActiveList($storeId)
    {
        $methodList = array_filter(
            $this->getList($storeId),
            function (PaymentMethodInterface $method) {
                return $method->getIsActive();
            }
        );

        return array_values($methodList);
    }
}

linter give error if mocks are used

Hi,
inteliphense linter is giving error when mocks are used.

$orderMock = $this->createMock(Order::class);
$invoice = new Invoice($orderMock);

[intelephense 10006] Expected type 'App\Order'. Found 'PHPUnit\Framework\MockObject\MockObject'. [E]

[DOC]: Better way to get WordPress intellisense

Hi,

First of all thank you very much for this awesome package. Your package is one of many reasons why I moved from Sublimetext to VSCode (don't mean to start a war here though).

I have been fiddling around a bit, and have been trying various methods to add WordPress intellisense. My preference has always been to just add the plugin/theme directory to vscode workspace. But in order to get intellisense of WordPress core functions, I had to add WordPress source in the workspace too. Not a great fan of this.

Then I came across this and since I use composer anyway, getting intellisense was a breeze.

I would've wanted to contribute to some doc, but since I didn't find any, I am opening an issue explaining the method and I leave it upto you to do what-so-ever you wish.

These are just the steps one need to follow to get WP intellisense.

  1. First increase the default fileSize to 3MB or greater (VSCode > Preference > User Settings) "intelephense.file.maxSize": 3000000.
  2. Now if you are using composer then composer require --dev giacocorsiglia/wordpress-stubs.
  3. If you are not using composer then simply download wordpress-stubs.php and put it in your project directory (you probably don't want to track it with git).
  4. Now from vscode command palette simply do a Intelephense: Clear Cache and Reload.
  5. Also disable any WordPress core snippets extension you might have.

And from then on, it just works. Here's a video.

WP Intelephense

factory functions do not resolve

Hi,

functions that act as factories for objects, does not resolve to the objects; e.g. in Laravel

$user = auth()->user();

the intelephense does not recognize the function user which is valid for a \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard which is documented as function's return types, so it has a red squiggly line beneath.

Thanks!

How to use socket?

When I try to execute the following command:

intelephense "--socket=127.0.0.1:9901"

The process exits immediately.

Missing Intellisense for Eloquent Relationship Methods

Eloquent relationship methods aren't appearing in the autocomplete popup.

Although if you type the method out manually and hover over the method name the correct information is displayed.

hover

Edit: they are showing in VSCode but not in Sublime using the LSP package.

Please provide an example of a valid `workspace/configuration` response

https://github.com/bmewburn/intelephense-docs/blob/master/installation.md#configuration-options provides example JSON for configuring intelephense, but provides no clues as to where you're supposed to write this data to, beyond the mysterious phrase "workspace/configuration request data".

What does that mean?

Could the documentation please be updated to say what the config filename is, or otherwise clarify where we put this config JSON data?

dont understand information from lsp: symbol is declared but not used

i have the following code snippet:

public static function delPage($d) {
        if ($d['perm'] != 2)  return array('m'=>'not allowed ('.__LINE__.')');
}

intelephense is complaining:

lsp-flycheck 1003 Symbol '$d' is declared but not used. (lsp)

in my opinion symbol $d is declared AND user in the if-statement. how can i avoid such messages? or, how to disable such informational messages?

maxSize not working in kate editor

I am trying to setup the language server with kate editor. Here is my config

{
    "servers": {
        "php": {
            "command": ["intelephense", "--stdio"],
            "rootIndicationFileNames": ["composer.json"],
            "highlightingModeRegex": "^PHP.*$",
            "settings": {
                "intelephense.files.maxSize": 3000000
            }
        }
    }
}

But the maxSize config is not applied. I am still getting warnings like file:///some/path/vendor/composer/autoload_static.php is over the maximum file size of 1000000 bytes.

I am unable to detect what I am doing wrong. Please suggest.

Please update document

@bmewburn Thanks for this language server.

When I checked "configuration" of vscode-intelephense, it seems that there are many things that are not reflected in intelephense-docs.

e.g. intelephense.diagnostics.*.

Could you please update "Configuration Options" of intelephense-docs?

Gettext stub has stopped working

Hi! From some time to now I'm getting the following warning in all my projects.

image

When I started to use this language server I had this same problem and I solved it by adding the "gettext" stub, but without changing any configuration (I think after an upgrade) it came again.

Core functions undefined?

I bet I'm missing something simple. I've installed the server with npm install -g intelephense and I can see it running. It marks references to core functions like file_get_contents (and many others) as undefined. I see the stubs down in the lib/stub directory.

I have attached a log from vim-lsp. I can see them talking. It looks like intelephense is not finding the stubs.

Am I missing a configuration step?

lsp.log

Implementation not found when method is implemented in a trait

The Implementation is not found when method is implemented in a trait used in a class that implements the interface

an example:

interface EngineInterface
{
    public function run(): void;
}


trait Engine
{
    public function run(): void
    {
        echo "brum"; 
    }
}


class Veichle implements EngineInterface
{
    use Engine;
}

finding implementations for run() method inside the Engine Interface result in implementation not found instead of pointing on run() method inside the Engine trait

Is there a possibility to run as a CLI linting tool?

I was wondering about the possibility of running Intelephense as a command line tool like phplint, to implement a git pre-commit hook for validating the code before commiting it. Is there a possibility to run Intelephense like this?

Intelephense confused with same file in two project

Hello,

I am using intelephense in Emacs lsp-mode.

I have two unrelated projects that both use the same shared library. This library is included in both projects as a git submodule, making a directory structure like this:

ProjectA/

  • FileA1.php
  • FileA2.php
  • Library/
    • Shared1.php << this defines \Library\Shared1 class
    • Shared2.php

ProjectB/

  • FileB1.php
  • FileB2.php
  • Library/
    • Shared1.php << this defines \Library\Shared1 class, too
    • Shared2.php

If I open both project in the same workspace, then after some time intelephense will have a problem jumping to files in the shared library. For example, if I edit ProjectA/FileA1.php and jump to definition of Shared1 class, it will open ProjectB/Library/Shared1.php file.

I'd expect it to jump to the file in the same project.

Please let me know if I can provide any more details to help.

Thanks.

Resolve untyped variables or inherited type variables

Sometimes we use Interface types to declare variable in methods parameters like myfunction(SomeInterface $var), but we use derived class objects when using that method, eg class SomeObject implements SomeInterface and this SomeObject may have methods not declared in the interface.
After then, intelephense is not able to resolve methods from SomeObject in the code and says they're undefined. I know the correct thing should be to use an annotation with correct type, but the doctype should not indicate another type than the one declared in the method parameter (which could not be resolved)

The real question is : Is there a way to force intelephense to check a correct type for a var without an annotation (with a config solution or something like that, configured outside of source code because everything cannot be versionned)

Expand single line (if, while, foreach, etc..) blocks

Hello, I am a big fan of your vscode extension and a premium user but I tend to prefer phpfmt to the formatter included in the extension for two reasons. This is an issue about the second one:

Phpfmt will expand the following code:

if($bool) doSomething(); else doSomethingElse();
while(isTrue()) doSomething();
foreach($array as $key => $val) doSomethingWith($key, $val);

to

if ($bool) {
    doSomething();
} else {
    doSomethingElse();
}

while (isTrue()) {
    doSomething();
}

foreach ($array as $key => $val) {
    doSomethingWith($key, $val);
}

It would be great if you had this functionality as well.

How to remove licence ?

Hello,

Everything is in the title, I have a PC that I will not use anymore and I would like to remove my licence, is there a way to do it?

Bye

php-7.4

Hi, thanks a lot for great language server!

Is there any news about support php7.4?

LS cannot find a class in the workspace

Hey. I'm facing with an issue when LS couldn't find a class in the workspace.

My code structure:

www/
...pages/
......some_class.php
tests/
...pages/
......SomeClassTest.php

some_class.php:

class Someclass
{

}

SomeClassTest.php:

class SomeClassTest extends Test 
{
   public function test()
   {
        $obj = new \SomeClass();
    }
}

LSP returns an error Undefined type SomeClass. It's interesting that LSP can find other classes that in the global namespace, including classes in the same directory that some_class.php file is. It's 40k lines long, btw, perhaps that's an issue?

Can you please help me to resolve this issue?

Intelephense premium doesn't seem to work with coc.nvim

Greetings and thanks for the great language server. I recently bought the premium version and I've been trying to make it work with (neo)vim and the plugin called coc.nvim.

I've configured intelephense as proposed here
I'm using
- Intelephense: v1.2.3
- CoC.nvim: v0.0.74
- Neovim: v0.5.0

This is my actual configuration with the key redacted:

{
    "languageserver": {
        "intelephense": {
            "command": "intelephense",
            "args": ["--stdio"],
            "filetypes": ["php"],
            "trace.server": "verbose",
            "initializationOptions": {
                "storagePath": "/tmp/intelephense",
                "licenceKey": "XXXXXXXXXXXXXXX"
            }
        }
    }
}

Sadly when I try to go to the implementation of a parent class it doesn't work.

Here's the Detail log which I've inspected in https://microsoft.github.io/language-server-protocol/inspector/ and it seems that the implementationProvider is returning false at the initialization.

client-server-key-redacted.log

[Trace - 2:01:33 PM] Sending request 'initialize - (0)'.
Params: {
    "processId": 30652,
    "rootPath": "/home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper",
    "rootUri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional"
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                }
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "definition": {
                "dynamicRegistration": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                }
            },
            "codeAction": {
                "dynamicRegistration": true,
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true
            },
            "documentLink": {
                "dynamicRegistration": true
            },
            "typeDefinition": {
                "dynamicRegistration": true
            },
            "implementation": {
                "dynamicRegistration": true
            },
            "declaration": {
                "dynamicRegistration": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            }
        }
    },
    "initializationOptions": {
        "storagePath": "/tmp/intelephense",
        "licenceKey": "XXXXXXXXXXXXXXX"
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper",
            "name": "ampersand-magento2-upgrade-patch-helper"
        }
    ]
}


[Trace - 2:01:33 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Initialising intelephense 1.2.3"
}


[Info  - 2:01:33 PM] Initialising intelephense 1.2.3
[Trace - 2:01:33 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Reading state from /tmp/intelephense/19a84881."
}


[Info  - 2:01:33 PM] Reading state from /tmp/intelephense/19a84881.
[Trace - 2:01:33 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Initialised in 14 ms"
}


[Info  - 2:01:33 PM] Initialised in 14 ms
[Trace - 2:01:33 PM] Received response 'initialize - (0)' in 446ms.
Result: {
    "capabilities": {
        "textDocumentSync": 2,
        "documentSymbolProvider": true,
        "workspaceSymbolProvider": true,
        "completionProvider": {
            "triggerCharacters": [
                "$",
                ">",
                ":",
                "\\",
                "/",
                ".",
                "<"
            ],
            "resolveProvider": true
        },
        "signatureHelpProvider": {
            "triggerCharacters": [
                "(",
                ","
            ]
        },
        "definitionProvider": true,
        "documentFormattingProvider": false,
        "documentRangeFormattingProvider": false,
        "referencesProvider": true,
        "hoverProvider": true,
        "documentHighlightProvider": true,
        "foldingRangeProvider": false,
        "implementationProvider": false,
        "declarationProvider": false,
        "workspace": {
            "workspaceFolders": {
                "supported": true,
                "changeNotifications": true
            }
        },
        "renameProvider": false,
        "typeDefinitionProvider": false
    }
}


[Trace - 2:01:33 PM] Sending notification 'initialized'.
Params: {}


[Trace - 2:01:33 PM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper/Command/AnalyseCommand.php",
        "languageId": "php",
        "version": 1,
        "text": "<?php\nnamespace Ampersand\\PatchHelper\\Command;\n\nuse Symfony\\Component\\Console\\Helper\\Table;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Ampersand\\PatchHelper\\Helper;\nuse Ampersand\\PatchHelper\\Patchfile;\n\nclass AnalyseCommand extends Command\n{\n    protected function configure()\n    {\n        $this\n            ->setName('ampersand:analyse')\n            ->addArgument('project', InputArgument::REQUIRED, 'The path to the magento2 project')\n            ->addOption('sort-by-type', null, InputOption::VALUE_NONE, 'Sort the output by override type')\n            ->setDescription('Analyse a magento2 project which has had a ./vendor.patch file manually created');\n    }\n\n    protected function execute(InputInterface $input, OutputInterface $output)\n    {\n        $projectDir = $input->getArgument('project');\n        if (!(is_string($projectDir) && is_dir($projectDir))) {\n            throw new \\Exception(\"Invalid project directory specified\");\n        }\n\n        $patchDiffFilePath = $projectDir . DIRECTORY_SEPARATOR . 'vendor.patch';\n        if (!(is_string($patchDiffFilePath) && is_file($patchDiffFilePath))) {\n            throw new \\Exception(\"$patchDiffFilePath does not exist, see README.md\");\n        }\n\n        $magento2 = new Helper\\Magento2Instance($projectDir);\n        $output->writeln('<info>Magento has been instantiated</info>', OutputInterface::VERBOSITY_VERBOSE);\n        $patchFile = new Patchfile\\Reader($patchDiffFilePath);\n        $output->writeln('<info>Patch file has been parsed</info>', OutputInterface::VERBOSITY_VERBOSE);\n\n        $summaryOutputData = [];\n        $patchFilesToOutput = [];\n        foreach ($patchFile->getFiles() as $patchFile) {\n            // Gets files changed in vendor, including files like mageplaza/ Popup\n            // string(58) \"file: vendor/mageplaza/module-better-popup/Block/Popup.php\"\n            $file = $patchFile->getPath();\n            try {\n                $patchOverrideValidator = new Helper\\PatchOverrideValidator($magento2, $patchFile);\n                if (!$patchOverrideValidator->canValidate()) {\n                    $output->writeln(\"<info>Skipping $file</info>\", OutputInterface::VERBOSITY_VERY_VERBOSE);\n                    continue;\n                }\n\n                // Better Popup makes it through canValidate\n                $output->writeln(\"<info>Validating $file</info>\", OutputInterface::VERBOSITY_VERBOSE);\n\n                // here is ze magic\n                foreach ($patchOverrideValidator->validate()->getErrors() as $errorType => $errors) {\n                    if (!isset($patchFilesToOutput[$file])) {\n                        // assigns patchfiles\n                        $patchFilesToOutput[$file] = $patchFile;\n                    }\n                    foreach ($errors as $error) {\n                        $summaryOutputData[] = [$errorType, $file, ltrim(str_replace($projectDir, '', $error), '/')];\n                    }\n                }\n            } catch (\\InvalidArgumentException $e) {\n                $output->writeln(\"<error>Could not understand $file: {$e->getMessage()}</error>\", OutputInterface::VERBOSITY_VERY_VERBOSE);\n            }\n        }\n\n        if ($input->getOption('sort-by-type')) {\n            usort($summaryOutputData, function ($a, $b) {\n                if (strcmp($a[0], $b[0]) !== 0) {\n                    return strcmp($a[0], $b[0]);\n                }\n                if (strcmp($a[1], $b[1]) !== 0) {\n                    return strcmp($a[1], $b[1]);\n                }\n                return strcmp($a[2], $b[2]);\n            });\n        }\n\n        $outputTable = new Table($output);\n        $outputTable->setHeaders(['Type', 'Core', 'To Check']);\n        $outputTable->addRows($summaryOutputData);\n        $outputTable->render();\n\n        $countToCheck = count($summaryOutputData);\n        $newPatchFilePath = rtrim($projectDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'vendor_files_to_check.patch';\n        $output->writeln(\"<comment>You should review the above $countToCheck items alongside $newPatchFilePath</comment>\");\n        file_put_contents($newPatchFilePath, implode(PHP_EOL, $patchFilesToOutput));\n    }\n}\n"
    }
}


[Trace - 2:01:33 PM] Received request 'client/registerCapability - (0)'.
Params: {
    "registrations": [
        {
            "id": "2b612513-5841-4062-9bdb-5cafaa8e5677",
            "method": "workspace/didChangeWorkspaceFolders",
            "registerOptions": {}
        }
    ]
}


[Trace - 2:01:33 PM] Sending response 'client/registerCapability - (0)'. Processing request took 1ms
No result returned.


[Trace - 2:01:33 PM] Received request 'workspace/configuration - (1)'.
Params: {
    "items": [
        {
            "section": "intelephense"
        },
        {
            "section": "intelephense",
            "scopeUri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper"
        }
    ]
}


[Trace - 2:01:33 PM] Sending response 'workspace/configuration - (1)'. Processing request took 1ms
Result: [
    {},
    {}
]


[Trace - 2:01:33 PM] Received request 'client/registerCapability - (2)'.
Params: {
    "registrations": [
        {
            "id": "248f8292-8721-4685-8f3f-a8a196a2be83",
            "method": "textDocument/foldingRange",
            "registerOptions": {}
        },
        {
            "id": "df399582-2408-45fd-ac6e-66bb6175b239",
            "method": "textDocument/implementation",
            "registerOptions": {
                "documentSelector": [
                    {
                        "language": "php",
                        "scheme": "file"
                    },
                    {
                        "language": "php",
                        "scheme": "untitled"
                    }
                ]
            }
        },
        {
            "id": "a69b6b79-b263-4b62-b8a1-1287a5c365ab",
            "method": "textDocument/declaration",
            "registerOptions": {
                "documentSelector": [
                    {
                        "language": "php",
                        "scheme": "file"
                    },
                    {
                        "language": "php",
                        "scheme": "untitled"
                    }
                ]
            }
        },
        {
            "id": "aa260f11-65ca-468c-aab9-5a621763c19f",
            "method": "textDocument/rename",
            "registerOptions": {
                "prepareProvider": true,
                "documentSelector": [
                    {
                        "language": "php",
                        "scheme": "file"
                    },
                    {
                        "language": "php",
                        "scheme": "untitled"
                    }
                ]
            }
        },
        {
            "id": "6daa6666-0fdb-4498-8577-8f368e22b033",
            "method": "textDocument/typeDefinition",
            "registerOptions": {
                "documentSelector": [
                    {
                        "language": "php",
                        "scheme": "file"
                    },
                    {
                        "language": "php",
                        "scheme": "untitled"
                    }
                ]
            }
        }
    ]
}


[Trace - 2:01:33 PM] Sending response 'client/registerCapability - (2)'. Processing request took 2ms
No result returned.


[Trace - 2:01:33 PM] Received request 'client/registerCapability - (3)'.
Params: {
    "registrations": [
        {
            "id": "024ccd09-e3f2-4bd7-9d7d-d1f07a4072c2",
            "method": "textDocument/formatting",
            "registerOptions": {
                "documentSelector": [
                    {
                        "language": "php",
                        "scheme": "file"
                    },
                    {
                        "language": "php",
                        "scheme": "untitled"
                    }
                ]
            }
        },
        {
            "id": "0d5fe686-2ec6-4d2e-a848-6b629f9386f3",
            "method": "textDocument/rangeFormatting",
            "registerOptions": {
                "documentSelector": [
                    {
                        "language": "php",
                        "scheme": "file"
                    },
                    {
                        "language": "php",
                        "scheme": "untitled"
                    }
                ]
            }
        }
    ]
}


[Trace - 2:01:33 PM] Sending response 'client/registerCapability - (3)'. Processing request took 2ms
No result returned.


[Trace - 2:01:33 PM] Received request 'client/registerCapability - (4)'.
Params: {
    "registrations": [
        {
            "id": "b7366236-3ad1-4c09-b373-246eec0756ef",
            "method": "workspace/didChangeWatchedFiles",
            "registerOptions": {
                "watchers": [
                    {
                        "globPattern": "**/*.{php,phtml}"
                    }
                ]
            }
        }
    ]
}


[Trace - 2:01:33 PM] Sending response 'client/registerCapability - (4)'. Processing request took 5ms
No result returned.


[Trace - 2:01:33 PM] Received request 'client/registerCapability - (5)'.
Params: {
    "registrations": [
        {
            "id": "111bcf35-8ed8-4e67-b3f5-6e9afd86f919",
            "method": "workspace/didChangeConfiguration",
            "registerOptions": {
                "section": "intelephense"
            }
        }
    ]
}


[Trace - 2:01:33 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
    "settings": {
        "intelephense": {}
    }
}


[Trace - 2:01:33 PM] Sending response 'client/registerCapability - (5)'. Processing request took 1ms
No result returned.


[Trace - 2:01:33 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Indexing started."
}


[Info  - 2:01:33 PM] Indexing started.
[Trace - 2:01:33 PM] Received request 'workspace/configuration - (6)'.
Params: {
    "items": [
        {
            "section": "intelephense"
        },
        {
            "section": "intelephense",
            "scopeUri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper"
        }
    ]
}


[Trace - 2:01:33 PM] Sending response 'workspace/configuration - (6)'. Processing request took 2ms
Result: [
    {},
    {}
]


[Trace - 2:01:34 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper/Command/AnalyseCommand.php",
    "diagnostics": []
}


[Trace - 2:01:35 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Indexing ended. 122 files indexed in 1s."
}


[Info  - 2:01:35 PM] Indexing ended. 122 files indexed in 1s.
[Trace - 2:01:35 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Writing state to /tmp/intelephense/19a84881."
}


[Info  - 2:01:35 PM] Writing state to /tmp/intelephense/19a84881.
[Trace - 2:01:35 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Wrote state in 0.4s."
}


[Info  - 2:01:35 PM] Wrote state in 0.4s.
[Trace - 2:01:37 PM] Sending request 'textDocument/documentSymbol - (1)'.
Params: {
    "textDocument": {
        "uri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper/Command/AnalyseCommand.php"
    }
}


[Trace - 2:01:37 PM] Received response 'textDocument/documentSymbol - (1)' in 24ms.
Result: [
    {
        "name": "Ampersand\\PatchHelper\\Command",
        "kind": 3,
        "range": {
            "start": {
                "line": 1,
                "character": 0
            },
            "end": {
                "line": 1,
                "character": 40
            }
        },
        "selectionRange": {
            "start": {
                "line": 1,
                "character": 10
            },
            "end": {
                "line": 1,
                "character": 39
            }
        }
    },
    {
        "name": "Table",
        "kind": 5,
        "range": {
            "start": {
                "line": 3,
                "character": 4
            },
            "end": {
                "line": 3,
                "character": 42
            }
        },
        "selectionRange": {
            "start": {
                "line": 3,
                "character": 4
            },
            "end": {
                "line": 3,
                "character": 42
            }
        }
    },
    {
        "name": "Command",
        "kind": 5,
        "range": {
            "start": {
                "line": 4,
                "character": 4
            },
            "end": {
                "line": 4,
                "character": 45
            }
        },
        "selectionRange": {
            "start": {
                "line": 4,
                "character": 4
            },
            "end": {
                "line": 4,
                "character": 45
            }
        }
    },
    {
        "name": "InputInterface",
        "kind": 5,
        "range": {
            "start": {
                "line": 5,
                "character": 4
            },
            "end": {
                "line": 5,
                "character": 50
            }
        },
        "selectionRange": {
            "start": {
                "line": 5,
                "character": 4
            },
            "end": {
                "line": 5,
                "character": 50
            }
        }
    },
    {
        "name": "OutputInterface",
        "kind": 5,
        "range": {
            "start": {
                "line": 6,
                "character": 4
            },
            "end": {
                "line": 6,
                "character": 52
            }
        },
        "selectionRange": {
            "start": {
                "line": 6,
                "character": 4
            },
            "end": {
                "line": 6,
                "character": 52
            }
        }
    },
    {
        "name": "InputArgument",
        "kind": 5,
        "range": {
            "start": {
                "line": 7,
                "character": 4
            },
            "end": {
                "line": 7,
                "character": 49
            }
        },
        "selectionRange": {
            "start": {
                "line": 7,
                "character": 4
            },
            "end": {
                "line": 7,
                "character": 49
            }
        }
    },
    {
        "name": "InputOption",
        "kind": 5,
        "range": {
            "start": {
                "line": 8,
                "character": 4
            },
            "end": {
                "line": 8,
                "character": 47
            }
        },
        "selectionRange": {
            "start": {
                "line": 8,
                "character": 4
            },
            "end": {
                "line": 8,
                "character": 47
            }
        }
    },
    {
        "name": "Helper",
        "kind": 5,
        "range": {
            "start": {
                "line": 9,
                "character": 4
            },
            "end": {
                "line": 9,
                "character": 32
            }
        },
        "selectionRange": {
            "start": {
                "line": 9,
                "character": 4
            },
            "end": {
                "line": 9,
                "character": 32
            }
        }
    },
    {
        "name": "Patchfile",
        "kind": 5,
        "range": {
            "start": {
                "line": 10,
                "character": 4
            },
            "end": {
                "line": 10,
                "character": 35
            }
        },
        "selectionRange": {
            "start": {
                "line": 10,
                "character": 4
            },
            "end": {
                "line": 10,
                "character": 35
            }
        }
    },
    {
        "name": "AnalyseCommand",
        "kind": 5,
        "range": {
            "start": {
                "line": 12,
                "character": 0
            },
            "end": {
                "line": 93,
                "character": 1
            }
        },
        "selectionRange": {
            "start": {
                "line": 12,
                "character": 6
            },
            "end": {
                "line": 12,
                "character": 20
            }
        },
        "children": [
            {
                "name": "configure",
                "kind": 6,
                "range": {
                    "start": {
                        "line": 14,
                        "character": 4
                    },
                    "end": {
                        "line": 21,
                        "character": 5
                    }
                },
                "selectionRange": {
                    "start": {
                        "line": 14,
                        "character": 23
                    },
                    "end": {
                        "line": 14,
                        "character": 32
                    }
                }
            },
            {
                "name": "execute",
                "kind": 6,
                "range": {
                    "start": {
                        "line": 23,
                        "character": 4
                    },
                    "end": {
                        "line": 92,
                        "character": 5
                    }
                },
                "selectionRange": {
                    "start": {
                        "line": 23,
                        "character": 23
                    },
                    "end": {
                        "line": 23,
                        "character": 30
                    }
                },
                "children": [
                    {
                        "name": "$input",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 23,
                                "character": 31
                            },
                            "end": {
                                "line": 23,
                                "character": 52
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 23,
                                "character": 46
                            },
                            "end": {
                                "line": 23,
                                "character": 52
                            }
                        }
                    },
                    {
                        "name": "$output",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 23,
                                "character": 54
                            },
                            "end": {
                                "line": 23,
                                "character": 77
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 23,
                                "character": 70
                            },
                            "end": {
                                "line": 23,
                                "character": 77
                            }
                        }
                    },
                    {
                        "name": "$projectDir",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 25,
                                "character": 8
                            },
                            "end": {
                                "line": 25,
                                "character": 19
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 25,
                                "character": 8
                            },
                            "end": {
                                "line": 25,
                                "character": 19
                            }
                        }
                    },
                    {
                        "name": "$patchDiffFilePath",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 30,
                                "character": 8
                            },
                            "end": {
                                "line": 30,
                                "character": 26
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 30,
                                "character": 8
                            },
                            "end": {
                                "line": 30,
                                "character": 26
                            }
                        }
                    },
                    {
                        "name": "$magento2",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 35,
                                "character": 8
                            },
                            "end": {
                                "line": 35,
                                "character": 17
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 35,
                                "character": 8
                            },
                            "end": {
                                "line": 35,
                                "character": 17
                            }
                        }
                    },
                    {
                        "name": "$patchFile",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 37,
                                "character": 8
                            },
                            "end": {
                                "line": 37,
                                "character": 18
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 37,
                                "character": 8
                            },
                            "end": {
                                "line": 37,
                                "character": 18
                            }
                        }
                    },
                    {
                        "name": "$summaryOutputData",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 40,
                                "character": 8
                            },
                            "end": {
                                "line": 40,
                                "character": 26
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 40,
                                "character": 8
                            },
                            "end": {
                                "line": 40,
                                "character": 26
                            }
                        }
                    },
                    {
                        "name": "$patchFilesToOutput",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 41,
                                "character": 8
                            },
                            "end": {
                                "line": 41,
                                "character": 27
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 41,
                                "character": 8
                            },
                            "end": {
                                "line": 41,
                                "character": 27
                            }
                        }
                    },
                    {
                        "name": "$file",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 45,
                                "character": 12
                            },
                            "end": {
                                "line": 45,
                                "character": 17
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 45,
                                "character": 12
                            },
                            "end": {
                                "line": 45,
                                "character": 17
                            }
                        }
                    },
                    {
                        "name": "$patchOverrideValidator",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 47,
                                "character": 16
                            },
                            "end": {
                                "line": 47,
                                "character": 39
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 47,
                                "character": 16
                            },
                            "end": {
                                "line": 47,
                                "character": 39
                            }
                        }
                    },
                    {
                        "name": "$errorType",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 57,
                                "character": 77
                            },
                            "end": {
                                "line": 57,
                                "character": 87
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 57,
                                "character": 77
                            },
                            "end": {
                                "line": 57,
                                "character": 87
                            }
                        }
                    },
                    {
                        "name": "$errors",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 57,
                                "character": 91
                            },
                            "end": {
                                "line": 57,
                                "character": 98
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 57,
                                "character": 91
                            },
                            "end": {
                                "line": 57,
                                "character": 98
                            }
                        }
                    },
                    {
                        "name": "$error",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 62,
                                "character": 40
                            },
                            "end": {
                                "line": 62,
                                "character": 46
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 62,
                                "character": 40
                            },
                            "end": {
                                "line": 62,
                                "character": 46
                            }
                        }
                    },
                    {
                        "name": "$e",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 66,
                                "character": 47
                            },
                            "end": {
                                "line": 66,
                                "character": 49
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 66,
                                "character": 47
                            },
                            "end": {
                                "line": 66,
                                "character": 49
                            }
                        }
                    },
                    {
                        "name": "#Function#6e92fcc3",
                        "kind": 12,
                        "range": {
                            "start": {
                                "line": 72,
                                "character": 38
                            },
                            "end": {
                                "line": 80,
                                "character": 13
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 72,
                                "character": 38
                            },
                            "end": {
                                "line": 80,
                                "character": 13
                            }
                        },
                        "children": [
                            {
                                "name": "$a",
                                "kind": 13,
                                "range": {
                                    "start": {
                                        "line": 72,
                                        "character": 48
                                    },
                                    "end": {
                                        "line": 72,
                                        "character": 50
                                    }
                                },
                                "selectionRange": {
                                    "start": {
                                        "line": 72,
                                        "character": 48
                                    },
                                    "end": {
                                        "line": 72,
                                        "character": 50
                                    }
                                }
                            },
                            {
                                "name": "$b",
                                "kind": 13,
                                "range": {
                                    "start": {
                                        "line": 72,
                                        "character": 52
                                    },
                                    "end": {
                                        "line": 72,
                                        "character": 54
                                    }
                                },
                                "selectionRange": {
                                    "start": {
                                        "line": 72,
                                        "character": 52
                                    },
                                    "end": {
                                        "line": 72,
                                        "character": 54
                                    }
                                }
                            }
                        ]
                    },
                    {
                        "name": "$outputTable",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 83,
                                "character": 8
                            },
                            "end": {
                                "line": 83,
                                "character": 20
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 83,
                                "character": 8
                            },
                            "end": {
                                "line": 83,
                                "character": 20
                            }
                        }
                    },
                    {
                        "name": "$countToCheck",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 88,
                                "character": 8
                            },
                            "end": {
                                "line": 88,
                                "character": 21
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 88,
                                "character": 8
                            },
                            "end": {
                                "line": 88,
                                "character": 21
                            }
                        }
                    },
                    {
                        "name": "$newPatchFilePath",
                        "kind": 13,
                        "range": {
                            "start": {
                                "line": 89,
                                "character": 8
                            },
                            "end": {
                                "line": 89,
                                "character": 25
                            }
                        },
                        "selectionRange": {
                            "start": {
                                "line": 89,
                                "character": 8
                            },
                            "end": {
                                "line": 89,
                                "character": 25
                            }
                        }
                    }
                ]
            }
        ]
    }
]


[Trace - 2:01:37 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper/Command/AnalyseCommand.php",
    "diagnostics": []
}



[Trace - 2:01:57 PM] Sending request 'textDocument/implementation - (2)'.
Params: {
    "textDocument": {
        "uri": "file:///home/weigla/Documents/git/ampersand-magento2-upgrade-patch-helper/Command/AnalyseCommand.php"
    },
    "position": {
        "line": 12,
        "character": 34
    }
}


[Trace - 2:01:57 PM] Received response 'textDocument/implementation - (2)' in 5ms.
Result: []

I've also searched through the issues and this issue might be similar to the problem I'm having.

Any suggestions to getting intelephense premium to work would be great. If further data is needed I will provide it.

Hability to customize generated docblock

It would be great to be able to customize the generated method docblocks. For example the code snippet:

public function bar(int $int, bool $bool): array
{
    return [$int, $string, $bool];
}

Generating the docblock would give me:

    /**
     * 
     * @param int $int 
     * @param bool $bool 
     * @return array 
     */

It would be nice to be able to say that I want an empty line between the last @param line and @return.

Also it would be nice to be able insert standard tags like @author.

Configuration when using ALE/Vim?

I use ALE within Vim to take advantage of Intelephense. However, I cannot for the life of me figure out how I would pass any configuration to Intelephense.

I've noticed an (empty) folder (intelephense) in my home directory, could that possibly have anything to do with configuration?

Proprietary? Since when? Is there a commercial offering now?

Long time PHP developer here, although have been on a bit of a hiatus and using other tech stacks in recent times. Anyway I am back working on a PHP project and came back to install intelephense only to discover half of it's been hidden away.

@bmewburn I understand it's your prerogative to make the underlying language server proprietary, I have no issue with that. Although I admit I was a bit taken aback at first.

It just seems like it's fallen off the planet without any discussion, no blog posts, no new announcements of a commercial offering. Unless I am just looking in all the wrong places?

Anyway it's a great product and hope there is something in the pipeline that your soon to announce to the PHP community.

UnhandledPromiseRejectionWarning

I get the following warning when running intelephense using Emacs and lsp-mode:

(node:14388) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of null
    at connection.sendRequest.then (c:\Users\anste.NIRADYNAMICS\AppData\Roaming\npm\node_modules\intelephense\node_modules\vscode-languageserver\lib\configuration.js:27:60)
    at <anonymous>
(node:14388) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14388) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Using php package not in the vendor direcory

Hi ,

in symfony framework the phpunit/phpunit package isn't placed under the vendor directory as usual but inside bin/.phpunit

I think that this is the reason why intelephense can't autocomplete and lint files that involve classes related to phpunit/phpunit package properly.

Is it possible to solve this issue?

Thank you

Atom plugin

Hey @bmewburn
Not sure where to post this but I wanted to let you know that I just published a package for Atom.
Haven't really used it thoroughly yet but at least the following features seam to work :

Basic features

  • Code completion
  • Signature help
  • Go to definition
  • Find all references
  • Symbol search
  • Diagnostics
  • Formatting (Not sure)
  • Embedded language support (Not sure)
  • Hover
  • Highlight

Premium features

Initialization options are passed to the client here and the storage paths are taken into account, but I'm not sure about the license key, eg. Go To Declaration doesn't seem to work.
Any help/guidance on implementing the remaining features would be greatly appreciated.

Anyway, I've been using other php lsp implementations for a while and recently decided to switch to VSCode just to use intelephense as it's way faster and more robust than others I've tried, but I miss Atom for a variety of other reasons ;)
Great work, thank you!!

Please Excuse my question here

First please excuse me for posting a hot to question here. I looked around and couldn't figure out how to add a php function to vs-code intelephense. I found the stub config but it didn't seem to be where it needed to be added. Please Advise

PHP 8 "match" Errors in Sublime Text 4

Hi, in my Sublime Text 4 Intelephense seems to be throwing errors on all my match codes even though they work perfectly fine.

Here's a working snippet from a Laravel project:

line 80:        return match($this->investorable_type) {
line 81:            'App\Models\Person' => "/people/{$this->id}",
line 82:            'App\Models\Organization' => "/companies/{$this->id}",
line 83:        };

And I would get these errors despite the fully functional codes:

80:16  info    Array or string offset access with curly braces deprecated in PHP 7.4. Targeting PHP 8.0.10. ​
80:16  error   Undefined function 'App\Models\match'. ​intelephense:1010intelephense:1034
81:32  error   Unexpected '=>'. Expected '}'. ​intelephense:1001
81:57  error   Unexpected ','. ​intelephense:1001
82:43  error   Unexpected 'EncapsulatedAndWhitespace'. Expected ';'. ​intelephense:1001
82:65  error   Unexpected '"'. ​intelephense:1001

Are there any settings that I may be missing that could be causing match to be flagged as errors?

Here's a copy of my LSP-intelephense.sublime-settings:

// Settings in here override those in "LSP-json/LSP-json.sublime-settings"

{
    "enabled": true,
    "command": [
        "intelephense",
        "--stdio",
    ],
    "scopes": ["source.php", "embedding.php"],
    "syntaxes": ["Packages/PHP/PHP.sublime-syntax"],
    "languageId": "php",
    "initializationOptions": {
        "clearCache": true,
        "licenceKey": "xxxxx",
    },
    "settings": {
        "intelephense":
        {
            "environment":
            {
                "phpVersion": "8.0.10"
            },
            "diagnostics":
            {
                "undefinedTypes": false,
                // "undefinedConstants": false,
                // "undefinedFunctions": false,
                // "undefinedSymbols": false
            },
            "files":
            {
                "associations": [
                    "*.php",
                    "*.phtml",
                    "*.inc"
                ],
                "exclude": [
                    "**/.git/**",
                    "**/.svn/**",
                    "**/.hg/**",
                    "**/CVS/**",
                    "**/.DS_Store/**",
                    "**/node_modules/**",
                    "**/bower_components/**",
                    "**/vendor/**/{Tests,tests}/**",
                    "/var/**",
                    "/framework/**",
                     "**/vendor/**/{Example,example,Examples,examples}/**"
                ]
            },
            "trace":
            {
                "server": "off"
            }
        }
    },
}

Thanks.

Syntax error: "(" unexpected, when running intelephense from terminal

[email protected]
Ubuntu 18.10

Trying to run intelephense --stdio directly in terminal, results in an error:

λ  ~  intelephense --stdio
/home/predrag/.npm-global/bin/intelephense: 1: /home/predrag/.npm-global/bin/intelephense: /*!: not found
/home/predrag/.npm-global/bin/intelephense: 2: /home/predrag/.npm-global/bin/intelephense: 2019-03-03-130858_817x354_scrot.png: not found
/home/predrag/.npm-global/bin/intelephense: 3: /home/predrag/.npm-global/bin/intelephense: 2019-03-03-130858_817x354_scrot.png: not found
/home/predrag/.npm-global/bin/intelephense: 4: /home/predrag/.npm-global/bin/intelephense: Syntax error: "(" unexpected

But running λ ~ node ./.npm-global/bin/intelephense --stdio works.
I can verify that intelephense is available in my $PATH.

If you need any information, please say.

Implementation feature only works after file has been opened

Hello,

I can't get the "Find all implementations" feature work properly.

The server finds implementations of an interface only if I've already opened the corresponding file before.

Let's say I have :

  • one interface : interface IAccount in lib/public
  • one implementation : class Account implements IAccount in lib/private

From IAccount, Account is not found if I don't open it first. If I open Account and come back to IAccount, then the feature works properly.

I am using Neovim with 0.4.3 + LanguageClient-neovim 0.1.157.

I am using intelephense 1.3.11 paid version (licence key activated).

Here go the config files.

init.vim :

let g:LanguageClient_serverCommands = {
            \ 'php': ['intelephense', '--stdio'],
            \ }
let g:LanguageClient_settingsPath = "/some/path/intelephense.json"

intelephense.json (I could have named it settings.json ) :

{
    "initializationOptions": {
        "storagePath": "/tmp/intelephense",
        "licenceKey": "myKey",
        "clearcache": true
    },
    "intelephense.completion.insertUseDeclaration": true, 
    "intelephense.completion.maxItems": 100,
    "intelephense.files.associations": ["*.php", "*.phtml"]
}

Any idea what I could do ? Could it come from vim's buffers ?

Also, is the syntax in my intelephense.json correct ? (I have found several different syntax, and I don't know which one I should be using).

Thanks

EDIT: i just tried with vim-lsp plugin, and it does exactly the same thing. So problem is not likely to come from the lsp client.

Action to implement contracts

This is a feature request. I've been using intelephense premium for about six months, and I'm almost happy with it. What makes me feel unhappy is the lack of some refactoring features I used to use with Phpactor, especially its "Implement contracts" function. I'd be cool if you could add this function.

Thanks.

Extremely high CPU and RAM consumption

Conditions

intelephense version: 1.3.2
coc-phpls version: 2.1.2

Total number of PHP files in the project: 64598
Total amount of RAM: 16G
CPU: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz

OS: Gentoo Linux
Arch: amd64

The Issue

The project is big, and the number of PHP files is big, but I would expect intelephense to use the system resources (both CPU and RAM) less aggressively. Here is a snippet from the output of top command:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
84136 ruslan    20   0 2335080   1.1g  24504 R 125.2   7.1   0:31.21 /usr/bin/node /home/ruslan/.config/coc/extensions/node_modules/coc-phpls/node_modules/intelephense/lib/intelephense.js --node-ipc --clientProcessId=83517

Eventually, the kernel began to use the swap, which even caused the X server to hang for 5-10 seconds. This is something I have never experienced since the time I bought a new PC with SSD and 16G of RAM.

Long story short, intelephense is not usable with my project even on a middle-to-high-end machine. I would like to have control on how much memory is used or similar configuration option.

Related Issue

Meanwhile, the node process produced a number of core dumps. Here is one of them:

ruslan@osmanov-pc ~ $ sudo coredumpctl gdb 83812
Password: 
           PID: 83812 (node)
           UID: 1000 (ruslan)
           GID: 1000 (ruslan)
        Signal: 6 (ABRT)
     Timestamp: Sat 2019-12-07 19:25:22 MSK (41s ago)
  Command Line: /usr/bin/node /home/ruslan/.config/coc/extensions/node_modules/coc-phpls/node_modules/intelephense/lib/intelephense.js --node-ipc --clientProcessId=83517
    Executable: /usr/bin/node
 Control Group: /system.slice/system-urxvtd.slice/[email protected]
          Unit: [email protected]
         Slice: system-urxvtd.slice
       Boot ID: 3a56143e76d343309f741239070372a9
    Machine ID: c3fc8fcb47c928f2d370e71a5c9cce00
      Hostname: osmanov-pc
       Storage: /var/lib/systemd/coredump/core.node.1000.3a56143e76d343309f741239070372a9.83812.1575735922000000000000.lz4
       Message: Process 83812 (node) of user 1000 dumped core.

GNU gdb (Gentoo 8.3 vanilla) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/node...
[New LWP 83812]
[New LWP 83814]
[New LWP 83813]
[New LWP 83815]
[New LWP 83817]
[New LWP 83821]
[New LWP 83820]
[New LWP 83819]
[New LWP 83818]
[New LWP 83816]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/bin/node /home/ruslan/.config/coc/extensions/node_modules/coc-phpls/node_m'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007f4f71a0c2cb in raise () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7f4f74557740 (LWP 83812))]
(gdb) bt
#0  0x00007f4f71a0c2cb in raise () from /lib64/libc.so.6
#1  0x00007f4f719f58c5 in abort () from /lib64/libc.so.6
#2  0x0000559aa5ce5ba1 in node::Abort() ()
#3  0x0000559aa5ce5bde in node::OnFatalError(char const*, char const*) ()
#4  0x0000559aa5e56296 in v8::Utils::ReportOOMFailure(char const*, bool) ()
#5  0x0000559aa5e564c6 in v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) ()
#6  0x0000559aa616be19 in v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) ()
#7  0x0000559aa616c142 in v8::internal::Factory::NewStringFromOneByte(v8::internal::Vector<unsigned char const>, v8::internal::PretenureFlag) ()
#8  0x0000559aa5e62caa in v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) ()
#9  0x0000559aa5d678a4 in node::StringBytes::Encode(v8::Isolate*, char const*, unsigned long, node::encoding, v8::Local<v8::Value>*) ()
#10 0x0000559aa5cff543 in void node::Buffer::(anonymous namespace)::StringSlice<(node::encoding)1>(v8::FunctionCallbackInfo<v8::Value> const&) ()
#11 0x0000559aa5e86a18 in v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) ()
#12 0x0000559aa5ee7d2f in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) ()
#13 0x0000559aa5ee8113 in v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) ()
#14 0x000012931c8842fd in ?? ()
#15 0x00000493f0e8b1c1 in ?? ()
#16 0x000012931c884241 in ?? ()
#17 0x00007ffc4cffa770 in ?? ()
#18 0x0000000000000006 in ?? ()
#19 0x00007ffc4cffa828 in ?? ()
#20 0x000012931c93d1d6 in ?? ()
#21 0x000039af6f3022d1 in ?? ()
#22 0x000031ea36a86891 in ?? ()
#23 0x0000000600000000 in ?? ()
#24 0x000944e500000000 in ?? ()
#25 0x0000000000000000 in ?? ()
(gdb) 

Compared to PhpStorm

I hate to say this, but PhpStorm does a very good job of indexing, it still uses a whale of a lot of resources (two cores of the CPU and 2G of RAM), but it doesn't cause my system to hang, and the whole project is processed in a minute or so. I would really like to use Vim instead :-( But I believe we are close to the point where PhpStorm will be completely replaced.

P.S.

I think @marlonfan, the author of https://github.com/marlonfan/coc-phpls, should be interested in this issue as well

(By the way, what a strange choice of a language, just why NodeJS? 🤔)

node process don't use swap for memory?

--------edit----------------------------
My question is "is this extension written in a way to use swap memory? because from my testing, it doesn't use swap memory"
---------edit ends here------------
Hi there,

I am testing out this lsp on two of my servers.

  1. First server, in Digital Ocean $5 plan, 1GB ram + 2GB swap
  • Big project Magento 1, the RAM used by the first node process can go up to 600+MB, it finished building the cache of 37MB in /tmp/intelephense less than 1 minute.
  • New small project YIi2, cache built around 9MB
  1. Second server, AWS LightSail $3.5 plan, 512MB RAM + 3GB swap
    • Same big Magento 1 project, the RAM used is always less than 400MB, never build any cache, using 100% process like forever
    • Same new small project Yii2, cache built around 9MB

I am on latest Debian Buster, using neovim with coc nvim plugin.

It looks like it doesn't use swap at all on both of my servers. I try command to increase nodeJS memory limit also unhelpful
source

export NODE_OPTIONS=--max_old_space_size=4096,--optimize-for-size,--max-executable-size=8192

Is it like Java, that we shouldn't use swap?

source1
source2

edit: is there a requirement that what PHP packages should be installed? AFAIK the problem is not due to this

edit: found one question relevant to AWS limiting CPU usage source3
source4
, from source4, I think even though there is CPU burst for 100%, the RAM still isn't swapped to disk by node, doesn't matter on CPU throttling to around 30%

Missing undefined check on initializationOptions

I was trying to integrate intelephense in Gnome Builder, but intelephense crashes with Request initialize failed with message: Cannot read property 'dataPaths' of undefined. I grepped the released intelephense code for this and found that you don't have an undefined check on initializationOptions before accessing dataPaths on it. According to the LSP spec this field does not need to be defined https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#initialize.

Failed to apply changes to file warning in Kate editor

Hi @bmewburn,

I have a problem integrating Intelephense to Kate editor. I don't know if this problem is from Kate's side or Intelephense's side, so I am opening issues here and also in Kate's side (https://bugs.kde.org/show_bug.cgi?id=439671). Here is the details of the problem.

SUMMARY

I have installed Kate version 21.04.1 on Manjaro Linux. I also have Intelephense LSP installed and added to PATH. It can be used from other text editor such as Sublime Text, Atom, or VSCode. Intelephense can be started successfully from Kate, but failed to provide autocompletion or any other feature.

STEPS TO REPRODUCE

  1. Add Intelephense configuration to kate_lsp_client.json
  2. Open PHP project folder
  3. Open PHP file from project
  4. Try calling autocompletion feature

OBSERVED RESULT

17:17:01 LSP Server Warning intelephense@/home/path/to/project
Failed to apply changes to file://home/path/to/project/src/File.php

EXPECTED RESULT

LSP features should work

SOFTWARE/OS VERSIONS

Linux: Manjaro with GNOME 40.1.0

ADDITIONAL INFORMATION
LSP configuration

"intelephense": {
    "command": ["/usr/bin/intelephense", "--stdio"],
    "url": "https://github.com/bmewburn/intelephense-docs",
    "highlightingModeRegex": "^PHP.*$",
    "rootIndicationFileNames": ["composer.json"]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.