prabirshrestha / asyncomplete.vim

async completion in pure vim script for vim8 and neovim
MIT License
932 stars 60 forks source link

Popup doesn't show for eclipse-jdt-ls #273

Closed nguyennk92 closed 2 years ago

nguyennk92 commented 2 years ago

Hi, I am having trouble getting auto-complete to show up for java projects. My setup work flawlessly with go and other languages, just java causing me trouble. I see eclipse-jdt-ls already having response for complettion, but somehow asyncomplete refuse to pick it up.

eclipse-jdt-ls log

Thu Apr  7 10:58:43 2022:["--->",1,"eclipse-jdt-ls",{"method":"textDocument/completion","on_notification":"---funcref---","params":{"textDocument":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java"},"position":{"character":8,"line":7}}}]
Thu Apr  7 10:58:43 2022:["<---",1,"eclipse-jdt-ls",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Apr 7, 2022, 10:58:43 AM >> document/completion","type":3}}}]
Thu Apr  7 10:58:43 2022:["<---",1,"eclipse-jdt-ls",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Apr 7, 2022, 10:58:43 AM Completion request completed","type":3}}}]
Thu Apr  7 10:58:43 2022:["<---",1,"eclipse-jdt-ls",{"response":{"id":7,"jsonrpc":"2.0","result":{"isIncomplete":false,"items":[{"label":"x : int","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"0","rid":"2","decl_signature":"Lcom.nguyennk.Main$Obj;","name":"x"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"x"},"sortText":"999999034","kind":5,"insertTextFormat":1,"insertText":"x","detail":"Main.Obj.x : int"},{"label":"y : int","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"1","rid":"2","decl_signature":"Lcom.nguyennk.Main$Obj;","name":"y"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"y"},"sortText":"999999034","kind":5,"insertTextFormat":1,"insertText":"y","detail":"Main.Obj.y : int"},{"label":"equals(Object obj) : boolean","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"2","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"(Ljava.lang.Object;)Z","name":"equals"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"equals"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"equals","detail":"Object.equals(Object obj) : boolean"},{"label":"getClass() : Class<?>","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"3","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"()Ljava.lang.Class<*>;","name":"getClass"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"getClass"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"getClass","detail":"Object.getClass() : Class<?>"},{"label":"hashCode() : int","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"4","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"()I","name":"hashCode"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"hashCode"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"hashCode","detail":"Object.hashCode() : int"},{"label":"notify() : void","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"5","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"()V","name":"notify"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"notify"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"notify","detail":"Object.notify() : void"},{"label":"notifyAll() : void","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"6","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"()V","name":"notifyAll"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"notifyAll"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"notifyAll","detail":"Object.notifyAll() : void"},{"label":"toString() : String","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"7","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"()Ljava.lang.String;","name":"toString"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"toString"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"toString","detail":"Object.toString() : String"},{"label":"wait(long timeoutMillis, int nanos) : void","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"8","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"(JI)V","name":"wait"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"wait"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"wait","detail":"Object.wait(long timeoutMillis, int nanos) : void"},{"label":"wait(long timeoutMillis) : void","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"9","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"(J)V","name":"wait"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"wait"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"wait","detail":"Object.wait(long timeoutMillis) : void"},{"label":"wait() : void","data":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java","pid":"10","rid":"2","decl_signature":"Ljava.lang.Object;","signature":"()V","name":"wait"},"textEdit":{"range":{"end":{"character":8,"line":7},"start":{"character":8,"line":7}},"newText":"wait"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"wait","detail":"Object.wait() : void"}]}},"request":{"id":7,"jsonrpc":"2.0","method":"textDocument/completion","params":{"textDocument":{"uri":"file:///Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java"},"position":{"character":8,"line":7}}}}]

asyncomplete.log

["core","s:trigger",{"status":"success","ctx":{"lnum":8,"bufnr":3,"col":9,"changedtick":10,"typed":"    obj.","filetype":"java","curpos":[0,8,9,0,9],"filepath":"/Users/nguyennk92/projects/playground/javavim/src/main/java/com/nguyennk/Main.java"},"startcol":5,"items":[{"word":"x","abbr":"x : int","user_data":"{\"vim-lsp/key\":\"61\"}","kind":"field","empty":1,"dup":1,"icase":1},{"word":"y","abbr":"y : int","user_data":"{\"vim-lsp/key\":\"62\"}","kind":"field","empty":1,"dup":1,"icase":1},{"word":"equals","abbr":"equals(Object obj) : boolean","user_data":"{\"vim-lsp/key\":\"63\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"getClass","abbr":"getClass() : Class<?>","user_data":"{\"vim-lsp/key\":\"64\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"hashCode","abbr":"hashCode() : int","user_data":"{\"vim-lsp/key\":\"65\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"notify","abbr":"notify() : void","user_data":"{\"vim-lsp/key\":\"66\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"notifyAll","abbr":"notifyAll() : void","user_data":"{\"vim-lsp/key\":\"67\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"toString","abbr":"toString() : String","user_data":"{\"vim-lsp/key\":\"68\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"wait","abbr":"wait(long timeoutMillis, int nanos) : void","user_data":"{\"vim-lsp/key\":\"69\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"wait","abbr":"wait(long timeoutMillis) : void","user_data":"{\"vim-lsp/key\":\"70\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"wait","abbr":"wait() : void","user_data":"{\"vim-lsp/key\":\"71\"}","kind":"method","empty":1,"dup":1,"icase":1}],"refresh":false}]
["core","s:update_pum"]
["core","s:recompute_pum"]
["core","asyncomplete#preprocess_complete"]
["core","asyncomplete#preprocess_complete calling complete()",0,[]]

Strangely enough, it only doesn't show up when im trying to get autocomplete for fields/method within some obj:

image

It shows up perfectly fine for variable/class/interface type I think:

image
brookhong commented 2 years ago

+1

mattn commented 2 years ago

Could you please try

let b:asyncomplete_refresh_pattern = "\\(/\\|\\k\\+\\)$"

FYI, this should be done before completion.

typecampo commented 2 years ago

Similar issue here. Completion works for most things but not in specific cases. For example. Im calling an a function using await and there is no autocompletion on the resulting object. If I remove await, completion works.

["asyncomplete#complete","asyncomplete_lsp_typescript-language-server",{"lnum":13,"bufnr":1,"col":6,"changedtick":36,"typed":"\tsub.","filetype":"typescript","curpos":[0,13,6,0,13],"filepath":"/home/vader/Projects/app-ibs/src/services/stream.ts"},5,false,[{"word":"callback","abbr":"callback~","user_data":"{\"vim-lsp/key\":\"62\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"closed","abbr":"closed","user_data":"{\"vim-lsp/key\":\"63\"}","kind":"field","empty":1,"dup":1,"icase":1},{"word":"consumerInfo","abbr":"consumerInfo~","user_data":"{\"vim-lsp/key\":\"64\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"destroy","abbr":"destroy~","user_data":"{\"vim-lsp/key\":\"65\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"drain","abbr":"drain~","user_data":"{\"vim-lsp/key\":\"66\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"getID","abbr":"getID~","user_data":"{\"vim-lsp/key\":\"67\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"getMax","abbr":"getMax~","user_data":"{\"vim-lsp/key\":\"68\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"getPending","abbr":"getPending~","user_data":"{\"vim-lsp/key\":\"69\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"getProcessed","abbr":"getProcessed~","user_data":"{\"vim-lsp/key\":\"70\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"getReceived","abbr":"getReceived~","user_data":"{\"vim-lsp/key\":\"71\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"getSubject","abbr":"getSubject~","user_data":"{\"vim-lsp/key\":\"72\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"isClosed","abbr":"isClosed~","user_data":"{\"vim-lsp/key\":\"73\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"isDraining","abbr":"isDraining~","user_data":"{\"vim-lsp/key\":\"74\"}","kind":"method","empty":1,"dup":1,"icase":1},{"word":"[Symbol]","abbr":"Symbol","user_data":"{\"vim-lsp/key\":\"75\"}","kind":"variable","empty":1,"dup":1,"icase":1},{"word":"unsubscribe","abbr":"unsubscribe~","user_data":"{\"vim-lsp/key\":\"76\"}","kind":"method","empty":1,"dup":1,"icase":1}]]
["core","s:update_pum"]
["core","s:recompute_pum"]
["core","asyncomplete#preprocess_complete"]
["core","asyncomplete#preprocess_complete calling complete()",0,[]]

Seems also like #138

typecampo commented 2 years ago

Found on the ones that work, base is 'empty base', the ones that dont work base is '.' Then disabling fuzzymatch, this line fails resulting in empty array. https://github.com/prabirshrestha/asyncomplete.vim/blob/9c7651894c2c6d656c0dc71e87cfabbbb71b9c78/autoload/asyncomplete.vim#L474

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Urfoex commented 1 year ago

Could you please try

let b:asyncomplete_refresh_pattern = "\\(/\\|\\k\\+\\)$"

FYI, this should be done before completion.

Just faced the same issue. Had to put a space after the . to get the completion. Putting your let in, it directly completes after the . Thank you!