Closed kgiglia closed 4 years ago
So just to clarify is it only happening while you are developing a SS module?
That seems to be the case, though even from module to module performance seems to vary a fair bit. The context where it seems to be struggling the most is while adding code to a private function in a class extending SilverStripe\Control\Controller
, but I'm not quite sure what differentiates one controller from another in the same project where the problem isn't quite as pronounced.
It could be tied to the length of the class being edited, trying to edit something like this for example causes Intellisense to hang for nearly a full minute when I hit ctrl+space on an empty line.
Hmm could be tied to the php parser then. Its used to inject use item namespaces. If you follow the instructions here: https://github.com/gorriecoe/silverstripe-sanchez#custom-settings-and-snippets to disable use items does that make a difference?
Yeah, with that disabled it appears to be performing normally.
I also noticed Intellisense isn't always being populated with the SilverStripe snippets, e.g. the Intellisense dropdown that appears after typing $this->
only has the normal php suggestions, but hitting esc
and then ctrl
+space
shows snippets as well.
Ok so I think I can improve the performance. VsCode is probably running the php parser multiple times for each snippet at this point. I'll move the this function https://github.com/adrhumphreys/vscode-silverstripe/blob/master/src/silverstripeCompletionProvider.ts#L38-L51 to after snippet itself is injected.
Alrighty, I have started off by moving that function as mentioned above. https://github.com/adrhumphreys/vscode-silverstripe/commit/c6a00f54f34276859f33fb79de181ba841cb0636. Hopefully this will help as it should only run the php-parser once the snippet is selected.
As for the $this->
are you able to give me a screenshot or something. I found this really helpful when debugging. https://github.com/adrhumphreys/vscode-silverstripe/issues/13#issuecomment-658901046
Thanks for that!
Here's what I see at the moment with $this->
:
The second pop-up is triggered by ctrl
+space
.
I think that is a setting isn't it. For me ctrl + space
triggers a detailed description of auto completes.
Are you able to check your key bindings? =)
Sorry if that clip's a bit confusing - the initial suggestion box pops up on its own once I stop typing (I think this is controlled by the editor.quickSuggestions
and editor.quickSuggestionsDelay
preferences), then I'm hitting esc
to dismiss it, then ctrl
+space
to bring it up again. I'm only seeing the SS snippets once bringing it up manually.
I haven't changed the default keybindings for ctrl
+space
:
Ok I'm not able to replicate this issue. What I'll do is get @adrhumphreys to publish an update. Then I you are happy with the performance get you to sign off on that and create a new issue for the ctrl + space
.
That sounds good to me. Thanks again for this fix!
1.0.5 has been published. Let me know if this helps?
Seems to be much better. I also got a couple coworkers that were able to recreate the issue to test 1.0.5 and it looks good.
Awesome!
I've been having on-and-off bad performance with Intellisense in PHP for the past few days, and seem to have tracked it down to only occurring when I have this module enabled, and a specific folder open (either on its own, or as part of a workspace).
In the
composer.json
for that folder:When I've got this folder open, it takes a few seconds for the Intellisense list to be populated, and if I close the folder, or roll this module back to 0.0.5, it seems to be working normally.
This doesn't appear to be happening when working in a proper SilverStripe project, i.e. no
type
key in thecomposer.json
.Any idea why this could be happening?