Backslash added during LSP autocomplete function expansion

Hi!

A problem with the LSP integration was recently brought to my attention; when autocompleting a function (maybe any multi-line autocompletion?) Nova adds a backslash to the code for some reason. This happens with the Intelephense language server integration that I’ve been maintaining.

I haven’t added any custom handlers for any of the LSP messages being sent between Nova and Intelephense — and this issue has been confirmed to not occur in other editors with LSP integration — so I think this may be a bug in Nova.

The easiest way to reproduce the bug:

  1. Install Intelephense in Nova.
  2. Disable all other extensions.
  3. Create a new PHP file and save it as test.php
  4. Restart Intelephense (this is necessary for Intelephense to find the file you just created)
  5. Create a class:
<?php

class Testing {
}
  1. Start adding the constructor:
<?php

class Testing {
    public function __construct
}
  1. You should see an autocomplete menu pop up. Choose the “__construct” option and expand it. The result should look something like this:
<?php

class Testing {
    public function __construct( ... )
{

\}    // <-- note the backslash at the beginning of the line, and incorrect indentation.
}

Screenshots

Additional thoughts

I guess this could also be because Intelephense uses some non-standard way to instruct the editor to insert the code completion? Maybe it would be better for me to add my own handler for these types of completions?

It feels like this should be standardized and handled, but maybe that’s not the case? I’m really not sure what to make of the issue :slight_smile:

Any thoughts you have would be welcome!

1 Like

I just want to add another comment here to bring attention to this problem. I can still reproduce this using the instructions above in Nova 9.1.

1 Like

Ack. I had this on my list but missed it for our release.

Looking into the as well now. Thank you for your patience.

Logan

2 Likes

Hi @logan any news about this one? :eyes: the cheeky \ is still sneaking in for all magic and __x methods. :hear_no_evil:

1 Like