Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docblock does not work. #81

Open
alalfakawma opened this issue Nov 5, 2020 · 13 comments
Open

Docblock does not work. #81

alalfakawma opened this issue Nov 5, 2020 · 13 comments
Assignees

Comments

@alalfakawma
Copy link

alalfakawma commented Nov 5, 2020

Describe the bug
Docblock does not work. Typing /** should trigger it, but does not show anything. I have bought intelephense premium too.

To Reproduce
Steps to reproduce the behavior:
Type in a function, go 1 line above the function, type /**, you won't get a snippet list.

Expected behavior
I should see a snippet that is waiting to be completed by pressing the completion mapping.

Screenshots
https://i.imgur.com/0los5vH.png

Additional context

versions

vim version: NVIM v0.4.4
node version: v14.12.0
coc.nvim version: 0.0.79-3e5fbe3a93
coc.nvim directory: /home/aseem/.vim/plugged/coc.nvim
term: xterm-256color
platform: linux

Log of coc.nvim

2020-11-05T20:20:00.860 INFO (pid:622078) [plugin] - coc.nvim 0.0.79-3e5fbe3a93 initialized with node: v14.12.0 after 464ms
2020-11-05T20:20:01.981 INFO (pid:622078) [watchman] - watchman watching project: /home/aseem/Code/Projects/test
2020-11-05T20:20:05.578 INFO (pid:622078) [coc-phpls] - intelephense module (builtin) is ready to be started
2020-11-05T20:20:05.619 INFO (pid:622078) [language-client-index] - phpls started with 622671
2020-11-05T20:20:05.898 INFO (pid:622078) [language-client-index] - tailwindCSS started with 622851
2020-11-05T20:20:09.175 INFO (pid:622078) [completion-complete] - Results from: file
2020-11-05T20:20:10.790 ERROR (pid:622078) [languages] - Complete "phpls-1" error: TypeError: Cannot read property 'hasOwnProperty' of null
at /home/aseem/.config/coc/extensions/node_modules/coc-phpls/lib/index.js:97:29
at async Object.doComplete (/home/aseem/.vim/plugged/coc.nvim/build/index.js:71822:30)
2020-11-05T20:20:12.022 INFO (pid:622078) [willSaveHandler] - Will save cost: 62
2020-11-05T20:20:13.012 INFO (pid:622078) [completion-complete] - Results from: file
2020-11-05T20:20:13.412 ERROR (pid:622078) [languages] - Complete "phpls-1" error: TypeError: Cannot read property 'hasOwnProperty' of null
at /home/aseem/.config/coc/extensions/node_modules/coc-phpls/lib/index.js:97:29
at async Object.doComplete (/home/aseem/.vim/plugged/coc.nvim/build/index.js:71822:30)
2020-11-05T20:21:11.877 INFO (pid:622078) [willSaveHandler] - Will save cost: 63

@d0nth4x
Copy link

d0nth4x commented Jan 7, 2021

Same situation here. Any solutions?

@alalfakawma
Copy link
Author

alalfakawma commented Jan 10, 2021

Not yet. Looks like this extension is not maintained anymore. But i'm still using it.

EDIT: Looks like it is still maintained. My bad on assuming.

@d0nth4x
Copy link

d0nth4x commented Jan 13, 2021

I solved this problem by disabling fixer provided by 'dense-analysis/ale'.
Now I use 'stephpy/vim-php-cs-fixer' with @PhpCsFixer rule and it works!
@alalfakawma can you check your plugins and confirm this solution?

EDIT: Proper coc/ale config

@alalfakawma
Copy link
Author

I solved this problem by disabling fixer provided by 'dense-analysis/ale'.
Now I use 'stephpy/vim-php-cs-fixer' with @PhpCsFixer rule and it works!
@alalfakawma can you check your plugins and confirm this solution?

EDIT: Proper coc/ale config

I'm not using the lint plugins you mentioned, so I cannot confirm this.

@d0nth4x
Copy link

d0nth4x commented Jan 21, 2021

After few days I have same problem as before my fix.
I have one solution for that: clear cache
rm -rf ~/.config/coc/extensions/coc-phpls-data

@yaegassy
Copy link
Contributor

yaegassy commented Jan 22, 2021

@alalfakawma /** is displayed by VSCode's snippet feature.

The intelephense language server does not return completion suggestions for /**, so it may not be easy for coc-phpls to handle this.

There is another way to go about doc comment.

You can use the CodeAction feature to support doc comment.

See: #38 (comment)

@alalfakawma
Copy link
Author

@alalfakawma /** is displayed by VSCode's snippet feature.

The intelephense language server does not return completion suggestions for /**, so it may not be easy for coc-phpls to handle this.

There is another way to go about doc comment.

You can use the CodeAction feature to support doc comment.

See: #38 (comment)

I mean. It does work sometimes, that's the thing that's bothering me. Sometimes when I create a random php file and create a class, it suddenly works, but adds unnecessary lines in the doc. Meaning, it is capable of working, and there has to be a solution to make it work consistently.

@alalfakawma
Copy link
Author

After few days I have same problem as before my fix.
I have one solution for that: clear cache
rm -rf ~/.config/coc/extensions/coc-phpls-data

Will try this and get back with the result.

@yaegassy
Copy link
Contributor

I mean. It does work sometimes, that's the thing that's bothering me. Sometimes when I create a random php file and create a class, it suddenly works, but adds unnecessary lines in the doc. Meaning, it is capable of working, and there has to be a solution to make it work consistently.

Do you have any coc extensions installed, such as coc-snippets, or Vim plugins, such as ultisnips?

Is there any chance that those snippet feature are working?

If you can find a reproducible procedure, I may be able to help you with something.

@alalfakawma
Copy link
Author

alalfakawma commented Jan 22, 2021

I mean. It does work sometimes, that's the thing that's bothering me. Sometimes when I create a random php file and create a class, it suddenly works, but adds unnecessary lines in the doc. Meaning, it is capable of working, and there has to be a solution to make it work consistently.

Do you have any coc extensions installed, such as coc-snippets, or Vim plugins, such as ultisnips?

Is there any chance that those snippet feature are working?

If you can find a reproducible procedure, I may be able to help you with something.

Yeah I do have coc-snippets enabled, and they do work. Everything is working except the docblock, I can go to references, go to implementations, etc. As you can see in the logs above, I kept an eye on CocInfo to get the logs and this is the line that keeps popping up whenever it doesn't try to autocomplete the docblock for me -

2020-11-05T20:20:10.790 ERROR (pid:622078) [languages] - Complete "phpls-1" error: TypeError: Cannot read property 'hasOwnProperty' of null
at /home/aseem/.config/coc/extensions/node_modules/coc-phpls/lib/index.js:97:29
at async Object.doComplete (/home/aseem/.vim/plugged/coc.nvim/build/index.js:71822:30)

I have gone into the file and checked on the line but I'm not too familiar with what it is trying to do, so did not try to poke my head into it too much.

@yaegassy
Copy link
Contributor

yaegassy commented Jan 22, 2021

@alalfakawma Unfortunately, it's probably just a log of coc-phpls' lack of null handling, and has nothing to do with the /** docblock.

However, I have found a way to complement the docblock.

/**|*/ (| is the position of the cursor.)

I found out that if I do the completion with this |, I get a candidate.

intelephense-ls-snippets

Code

<?php

/**|*/
function check(string $hoge)
{
}

@alalfakawma
Copy link
Author

@alalfakawma Unfortunately, it's probably just a log of coc-phpls' lack of null handling, and has nothing to do with the /** docblock.

However, I have found a way to complement the docblock.

/**|*/ (| is the position of the cursor.)

I found out that if I do the completion with this |, I get a candidate.

intelephense-ls-snippets

Code

<?php

/**|*/
function check(string $hoge)
{
}

Oh alright. I will try it out as soon as I get to my PC. I've never tried what you have suggested. And will report if it works or not.

@alalfakawma
Copy link
Author

alalfakawma commented Jan 22, 2021

I can confirm this does work. I will just create my own snippet that creates a /*|*/, and moves the cursor where the | is. I know it's not the perfect solution, but it should do for now. But I really hope this can get fixed somehow. @yaegassy Thank you for your time mate. @d0nth4x you should try this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants