bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.63k stars 94 forks source link

Multiple includePaths #2338

Closed florentsorel closed 2 years ago

florentsorel commented 2 years ago

Describe the bug When I setup multiple environment.includePaths I have some diagnostics that should not be displayed.

To Reproduce I use Neovim, my configuration is:

require("lspconfig").intelephense.setup({
  on_attach = on_attach,
  capabilities = capabilities,
  settings = {
    intelephense = {
      stubs = {
        "apache",
        "bcmath",
        "bz2",
        "calendar",
        "com_dotnet",
        "Core",
        "ctype",
        "curl",
        "date",
        "dba",
        "dom",
        "enchant",
        "exif",
        "FFI",
        "fileinfo",
        "filter",
        "fpm",
        "ftp",
        "gd",
        "gettext",
        "gmp",
        "hash",
        "iconv",
        "imap",
        "intl",
        "json",
        "ldap",
        "libxml",
        "mbstring",
        "meta",
        "mysqli",
        "oci8",
        "odbc",
        "openssl",
        "pcntl",
        "pcre",
        "PDO",
        "pdo_ibm",
        "pdo_mysql",
        "pdo_pgsql",
        "pdo_sqlite",
        "pgsql",
        "Phar",
        "posix",
        "pspell",
        "readline",
        "Reflection",
        "session",
        "shmop",
        "SimpleXML",
        "snmp",
        "soap",
        "sockets",
        "sodium",
        "SPL",
        "sqlite3",
        "standard",
        "superglobals",
        "sysvmsg",
        "sysvsem",
        "sysvshm",
        "tidy",
        "tokenizer",
        "xml",
        "xmlreader",
        "xmlrpc",
        "xmlwriter",
        "xsl",
        "Zend OPcache",
        "zip",
        "zlib",
        "redis",
      },
      environment = {
        includePaths = {
          "/usr/local/lib/php",
          "~/code/metacore/core/classes",
        },
      },
    },
  },
})

Expected behavior Diagnostics about classes inside the classes folder should not be displayed. If I put includePaths = "~/kinow/metacore/core/classes" it's work, there is no diagnostics but I have other diagnostics, for example array_filter() show me a diagnostics like if the default config was overridden. It's why I have a lot of stubs, I just need to add redis stub but I think it's erase the default config so I put every default stubs inside.

I even tried to add ~/.config/composer/vendor/jetbrains/phpstorm-stubs to the list of includePaths with no success.

Screenshots

With a lua table (json array) I have diagnostics but the includePaths is defined with multiple value then it shouldn't be display diagnostics. image

With only one string I have no diagnostics and it should be display the diagnostic about array_filter because Supplier is inside the path in includePaths, so no need diagnostics in the Supplier line image

Platform and version Linux Mint and Intelephense 1.8.2

florentsorel commented 2 years ago

I put a table with a single value and it's working. I don't know why I try to put a string instead of a table... :smiling_face_with_tear: