yaegassy / coc-intelephense

intelephense (PHP language server) extension for coc.nvim. intelephense’s various LSP features and this extension's additional features are available.
https://www.npmjs.com/package/@yaegassy/coc-intelephense
MIT License
98 stars 4 forks source link

feat: add "autoCloseDocCommentDoSuggest" feature #24

Closed yaegassy closed 2 years ago

yaegassy commented 2 years ago

Description

"intelephense" will suggest the completion item /** [Intelephense PHPDoc] */ in the case of /**| */.

In vscode-intelephense, */ is automatically inserted in the "Language Configuration" function of the VSCode itself. https://code.visualstudio.com/api/language-extensions/language-configuration-guide

This is not a problem with vscode-intelephense, but it is a problem when used from Vim. Completion items are also suggested in the following cases, but there is a glitch.

Before:

| is the cursor.

    /**|
    public function dummy1()
    {
      // ...snip
    }

    /**
     *
     */
    public function dummy2()
    {
      // ...snip
    }

After:

This is a bug that causes the dummy2 method to disappear... :(

    /**
     * 
     * @return void 
     */
    public function dummy1()
    {
        //
    }

Add feature

Added the ability to behave as follows.

  1. Auto insert */ by typing /**.
  2. Text will be /**| */. (| is the cursor)
  3. Automatically triggers completion at the current cursor position.
  4. /** [Intelephense PHPDoc] */ complemention items are suggested.

If this feature is not needed, it can be disabled. Set intelephense.client.autoCloseDocCommentDoSuggest to false.

yaegassy commented 2 years ago

DEMO (mp4)

https://user-images.githubusercontent.com/188642/161670727-b7a3f6d7-4833-4279-a21d-611992a40760.mp4