I've been trying to use this VSCode extension for years now. At first it had major memory leak issues (I reported these). I believe these to mostly be resolved. I then decided to give it another shot and have spent a few months using it and I must say, it's very frustrating.

It's just too slow. You can make a change and then you have to wait around 5 seconds for it to reparse all the code and update the file. It doesn't always do this. But it's quite frequent. Sometimes it never updates too. It'll report something like "Call to unknown method", when in fact it's not. The method call is perfectly fine. It's like the cache never gets updated.

I don't know what other objectives there are with this extension, or what the overall goals are for it. But to say that this is the most important issue is an understatement. This is a pre-requisite. You guys need to drop everything else you're doing and fix this. Until then, it's not usable and I'll be switching back to Intelliphense again. I don't even know if I'll give this extension another shot, to be honest.

It's running on an M1 Max, which is very fast. It's not a resources issue.

    jacob Thank you for your feedback! I appreciate it. We're unaware of such an issue, so I'll be happy to replicate it and make it work as expected.

    The code is re-parsed immediately, but updating some features is delayed, sometimes by VSCode itself, sometimes by us by purpose.

    Specifically, updating problems is delayed ~ 1 second after the user stops modifying the code. It is a 10-year-old decision, so maybe it's time to re-think this.


    May I ask for a few more details about your codebase?

    • would you have a video/gif of the behavior?
    • how many lines of code in the edited document (we have a work-in-progress issue if the file is significantly large)
      8 days later

      Hi, I confirm, I have the same issue since maybe 3 or 4 releases.
      Sometime it keep old code in memory too, sometime it takes time to check errors.

      Few weeks ago I did not have these issues at all.

        No, I don't have Laravel framework.
        I have Symfony framework in vendor folder and another libraries but in fact I don't use them a lot.
        I don't use MVC or anything else because my project is a CLI project, so It is not a WEB project.

        I develop a lot of custom classes and unit tests with PHPUnit.
        I can debug different things for you if needed.

          This is the details for my project:

          phploc 7.0.2 by Sebastian Bergmann.
          
          Directories                                        235
          Files                                             1047
          
          Size
            Lines of Code (LOC)                           148303
            Comment Lines of Code (CLOC)                   39811 (26.84%)
            Non-Comment Lines of Code (NCLOC)             108492 (73.16%)
            Logical Lines of Code (LLOC)                   28707 (19.36%)
              Classes                                      28070 (97.78%)
                Average Class Length                          27
                  Minimum Class Length                         0
                  Maximum Class Length                       486
                Average Method Length                          4
                  Minimum Method Length                        0
                  Maximum Method Length                      256
                Average Methods Per Class                      5
                  Minimum Methods Per Class                    0
                  Maximum Methods Per Class                   89
              Functions                                      192 (0.67%)
                Average Function Length                        0
              Not in classes or functions                    445 (1.55%)
          
          Cyclomatic Complexity
            Average Complexity per LLOC                     0.42
            Average Complexity per Class                   12.27
              Minimum Class Complexity                      1.00
              Maximum Class Complexity                    298.00
            Average Complexity per Method                   2.96
              Minimum Method Complexity                     1.00
              Maximum Method Complexity                   141.00
          
          Dependencies
            Global Accesses                                   56
              Global Constants                                44 (78.57%)
              Global Variables                                 0 (0.00%)
              Super-Global Variables                          12 (21.43%)
            Attribute Accesses                             18127
              Non-Static                                   17981 (99.19%)
              Static                                         146 (0.81%)
            Method Calls                                   12632
              Non-Static                                   10867 (86.03%)
              Static                                        1765 (13.97%)
          
          Structure
            Namespaces                                       235
            Interfaces                                       121
            Traits                                            20
            Classes                                          892
              Abstract Classes                               181 (20.29%)
              Concrete Classes                               711 (79.71%)
                Final Classes                                335 (47.12%)
                Non-Final Classes                            376 (52.88%)
            Methods                                         5986
              Scope
                Non-Static Methods                          5481 (91.56%)
                Static Methods                               505 (8.44%)
              Visibility
                Public Methods                              4349 (72.65%)
                Protected Methods                           1620 (27.06%)
                Private Methods                               17 (0.28%)
            Functions                                        561
              Named Functions                                 78 (13.90%)
              Anonymous Functions                            483 (86.10%)
            Constants                                       1334
              Global Constants                                12 (0.90%)
              Class Constants                               1322 (99.10%)
                Public Constants                             794 (60.06%)
                Non-Public Constants                         528 (39.94%)

            @Jean-FrancoisHIVERT thank you! I appreciate your help.

            We've implemented Laravel/Symfony features that should not affect performance, but most probably it does in this case.

            • CPU and MEM seem alright
            • TIME+ is the run time right, not the total CPU time?

            I'll prepare a debug info that may provide additional information.

               29. TIME  --  CPU Time
                   Total CPU time the task has used since it started.  When Cumulative mode is On,  each  process  is  listed
                   with  the cpu time that it and its dead children have used.  You toggle Cumulative mode with `S', which is
                   both a command-line option and an interactive command.  See the `S'  interactive  command  for  additional
                   information regarding this mode.
              
               30. TIME+  --  CPU Time, hundredths
                   The same as TIME, but reflecting more granularity through hundredths of a second.

              Let me know if you need something or if you want I try a specific debug release or options.

              FYI, I use a lot of the generic feature, I don't use PHPStan attributes, and this is my config:

              {
                  /**
                   * Visual Studio Code
                   */
                  "editor.formatOnType": false,
                  "editor.formatOnSave": false,
                  "editor.formatOnPaste": false,
                  "editor.codeActionsOnSave": {
                      "source.organizeImports": "never",
                      "source.source.sortImports": "never",
                      "source.source.sortAndRemoveImports": "never",
                  },
                  "files.insertFinalNewline": false,
                  // Exclude files in the VS explorer
                  "files.exclude": {
                      /**
                       * DO NOT EXCLUDE vendor and phpunit else
                       * these folders will be not include
                       * in Devsense PHPTools anymore
                       */
                      "vendor": false,
                      "phpunit": false,
                      "development": true,
                      "documentation": true,
                      "bin": true,
                      "build": true,
                      /**
                       * Devsense bug:
                       *    - https://community.devsense.com/d/828-yaml-functions-and-constants-are-missing/
                       *    - https://community.devsense.com/d/894-php-problems-exclude-should-be-case-sensitive-or-enforce-relative-paths/
                       *
                       * This is a workaround to avoid to match all tools subfolder instead of the root folder only
                       */
                      "tools": false,
                      "src/**/tools": false,
                  },
                  "search.exclude": {
                      "bin": true,
                      "build": true,
                      "tools": true,
                      "**/dist": true,
                      "**/.angular": true,
                      "**/node_modules": true,
                      "phpclishell/vendor": true,
                      "phpclishell/development": true,
                      "phpclishell/phpunit/tests": true,
                      "phpclishell/documentation": true,
                  },
                  "php.version": "8.3.9",
                  "php.suggest.basic": false,
                  "php.validate.enable": false,
              
                  /**
                   * DEVSENSE PHP Tools
                   */
                  "composer.workingPath": "phpclishell/",
                  "php.workspace.includePath": "phpclishell/",
              
                  // Disables some notifications about premium features like code actions.
                  "phpTools.suppressPremiumFeatures": false,
                  // AI suggestions
                  "intelliphp.inlineSuggestionsEnabled" : false,
                  "php.format.codeStyle": "Off",
                  "php.format.rules.nullConstantCasing": "lowercase",
                  "php.format.rules.booleanConstantCasing": "lowercase",
                  "php.format.rules.groupUseNewLineBeforeFirstDeclaration": true,
                  "php.format.rules.newLineAfterImplements": true,
                  "php.format.rules.openBraceOnNewLineForFunctions": true,
                  "php.format.rules.openBraceOnNewLineForLambdas": true,
                  "php.format.rules.openBraceOnNewLineForAnonymousClasses": true,
                  "php.format.rules.openBraceOnNewLineForTypes": true,
                  "php.format.rules.indentBraces": false,
                  "php.format.rules.elseOnNewLine": true,
                  "php.format.rules.catchOnNewLine": true,
                  "php.format.rules.finallyOnNewLine": true,
                  "php.format.rules.spaceAfterCast": true,
                  "php.format.rules.alignConsecutiveAssignments": false,
                  "php.format.rules.alignMatchArmBodies": true,
                  "php.format.rules.alignProperties": false,
                  "php.format.rules.spaceBeforeParenthesesInControlStatements": false,
                  "php.format.rules.spaceBeforeParenthesesInDeclarations": false,
                  "php.format.rules.addCommaAfterLastArrayElement": true,
                  "php.format.rules.arrayInitializersNewLineAfterLastElement": true,
                  "php.format.rules.arrayInitializersNewLineBeforeFirstElement": true,
                  "php.format.rules.arrayInitializersAlignKeyValuePairs": false,
              
                  // Adds the full class member name at the top of tooltip (including the fully qualified name of the class) (disabled by default) (#808).
                  "php.hover.fullname": true,
                  // Lets you to enable/disable showing class name as a part of a function tool-tip (enabled by default).
                  "php.hover.containingClass": true,
                  // show full type names (shortened tu the current namespace) in tool tips.
                  "php.hover.parametersFullName": true,
                  // Inlay hints settings can be enabled
                  "php.inlayHints.parameters.enabled": false,
                  "php.inlayHints.types.lambdaParameter": false,
                  "php.inlayHints.types.return": false,
                  "php.docblock.variableSnippet": {
                      "singleline": false,
                  },
                  "php.completion.parameters": "none",
                  "php.completion.autoimport": "none",
                  "php.stubs": [ "*", "pcntl", "posix", "ssh2", "yaml" ],
                  "php.problems.scope": "all",
                  "php.problems.exclude": {
                      "phpclishell/bin/" : true,
                      "phpclishell/vendor/" : true,
                      "phpclishell/development/": true,
                      "phpclishell/phpunit/": true,
                      "phpclishell/tests/": [ 416, 6602, 6606 ],
                      /**
                       * 0416 : Undefined property
                       * 6602 : Property x accessed via magic method
                       * 6406 : Type x has been deprecated
                       * 6606 : Constant from class X referenced through child
                       */
                      "phpclishell/src/phpCliShell/": [ 6406, 6606 ],
                      "phpclishell/src/phpCliShell/Application/": [ 6602 ],
                      "phpclishell/src/phpCliShell/Application/Netbox/": [ 416 ],
                      "phpclishell/src/phpCliShell/Application/Firewall/Gui/**/node_modules/": true,
                      "phpclishell/src/phpCliShell/Application/Firewall/Controller/Ipam.php": true,
                  },
              
                  /**
                   * PHP CS Fixer
                   */
                  "php-cs-fixer.executablePath": "${workspaceFolder}/phpclishell/vendor/bin/php-cs-fixer",
                  "php-cs-fixer.rules": "@PSR12",
                  "php-cs-fixer.autoFixBySemicolon": false,
                  "php-cs-fixer.autoFixByBracket": false,
                  "php-cs-fixer.config": "phpclishell/phpcsfixer.php",
                  "php-cs-fixer.onsave": true,
                  "php-cs-fixer.documentFormattingProvider": true,
              }

              I use PHP CS Fixer, but not the format feature from your tool.
              I will try to ignore a specific folder where I have HTML, CSS and typescript files.

              Jean-FrancoisHIVERT Thank you for the settings; I'll try to address your notes/our bugs there.


              I may suggest a few cleanups if you'd be interested:

              disabled formatting

              If you have disabled our formatter using the setting:

                  "[php]": { "editor.defaultFormatter": "<something-else>" }
              • you can remove "php.format.codeStyle"
              • you can remove "php.format.rules***"
              • note, that we are the only extension providing format-on-type and format-selection for both PHP and mixed PHP/HTML/CSS/JS code.

              "intelliphp.inlineSuggestionsEnabled": false

              Instead, (if you are also not interested in AI code completion pre-select) you can uninstall or disable the extension "IntelliPHP". This will give you >200MB of RAM

              disabled inlay hints

              • you can remove "php.inlayHints***" and set "editor.inlayHints.enabled": "off"

              "php.problems.scope": "all"

              It's a great feature that we are proud of, but be aware it takes RAM.

                @Jean-FrancoisHIVERT

                Those numbers are insane - CPU time should be just a few seconds.

                I'll prepare a development version that will measure exactly what is going on.

                  Jean-FrancoisHIVERT

                  There is pre-release 1.57.17062 with (experimental) diagnostic performance self-profiling;

                  Following works in pre-release version of the extension on Windows:

                  If you notice persistent high CPU, may I ask to collect performance data:

                  • After Language Server starts, run the command "Begin Profiling Language Server ..."
                  • Click OK, it downloads a component (48MB) and starts collecting data:
                  • Do whatever is laggy or just let it collect data about the high CPU usage ...
                  • Click Cancel to stop
                  • Click Open Folder or navigate to .../tmp/devsense/selfprofile
                  • Please zip the files (.dtp and .dtp.xxxx) and send it to us

                  Thanks!


                  NOTE 1: The data won't contain any workspace information, there are no sources. It's a bit experimental, we haven't tested all the environments yet.
                  NOTE 2: profiling makes sense only during lags or when the CPU% is currently high
                  NOTE 3: it is normal to have a high CPU% after opening the workspace

                    Thank you, I did what you asked but after few seconds maybe 20 or 30s, I got a popup with the following error:

                      Jean-FrancoisHIVERT Thank you,

                      • is it Windows running a WSL/Ubuntu workspace?
                      • In the lower-right corner - did you click OK or Cancel?
                        status

                        It is a linux VM, I use VS Code from my Windows, and connect to my VM with SSH.

                        I clicked to OK and the button Cancel appeared correct.

                        Jean-FrancoisHIVERT thanks;

                        After more in-depth research we can do the profiling reliably only on Windows. Linux/Mac would be technically more tricky for now.

                        I'll get back to it

                          Write a Reply...