andy-blum / drupal-smart-snippets

This extension adds rich language support for Drupal Hooks, Services, and Render Elements to VS Code.
https://marketplace.visualstudio.com/items?itemName=andrewdavidblum.drupal-smart-snippets
MIT License
21 stars 4 forks source link

Conflict with other VS Code extensions? #8

Closed ultimike closed 1 year ago

ultimike commented 2 years ago

Hi Andy,

On my install of VSCode (Mac OS X, version 1.67.0), when, on a new line, I start typing hook_form I see the list of matching hooks appear, when I select one and hit "enter", I get the following:

hook_form_alter()

But, when I type function hook_form and then select the same hook, I get:

function /**
 * Implements hook_form_alter().
 */
function drupaleasy_repositories_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

}

(including the initial function above the comment)

I believe this is being caused by some type of conflict with the PHP Intelephense extension (which I also have installed). When I disable PHP Intelephense, I get the correct behavior from Drupal Smart Snippets. Any idea if there's anything that can be done either on my end with a config change or in your extension to fix this?

thanks, -mike

andy-blum commented 2 years ago

Hey @ultimike!

I think this is a VS Code specific setting, see the intellisense documentation

By default, VS Code pre-selects the previously used suggestion in the suggestion list. This is very useful as you can quickly insert the same completion multiple times. If you'd like different behavior, for example, always select the top item in the suggestion list, you can use the editor.suggestSelection setting.

Also, see the editor.snippetSuggestions setting - this is the one I use to always float snippets to the top of the list. This might be less helpful for someone that uses intelliphense heavily.

By default, VS Code shows snippets and completion proposals in one widget. You can control the behavior with the editor.snippetSuggestions setting. To remove snippets from the suggestions widget, set the value to "none". If you'd like to see snippets, you can specify the order relative to suggestions; at the top ("top"), at the bottom ("bottom"), or inline ordered alphabetically ("inline"). The default is "inline".

ultimike commented 2 years ago

Ah - makes sense. Thanks so much. I just added the following to my settings.json:

    // Use this to prioritize Drupal Smart Snippets in the UI.
    "editor.snippetSuggestions": "top",

-mike

ultimike commented 1 year ago

Re-opening as something has changed - the "editor.snippetSuggestions": "top", trick isn't working anymore. In fact, unless I completely disable PHP Intelephense extension, I don't see the Drupal Smart Snippets snippets.

Perhaps a recent PHP Intelephense update broke something?

thanks, -mike

andy-blum commented 1 year ago

There appear to be a couple of other issues on the intelephense repo suggesting it's broken autocomplete, for example: https://github.com/bmewburn/vscode-intelephense/issues/2493

andy-blum commented 1 year ago

https://github.com/bmewburn/vscode-intelephense/issues/2495

andy-blum commented 1 year ago

This was an issue with VS Code 1.75.0, and should be fixed as part of 1.75.1

https://github.com/microsoft/vscode/issues/173244#issuecomment-1420986719