Closed JoeHFB closed 3 years ago
Can you include logs and see if completionItem include "documentation". some language servers don't send it and we need to do a completion/resolve request but we currently don't do this for documentation. I do plan to add it.
Hi @prabirshrestha -
I did the exact same thing as I did in the two screenshots above after adding
let g:lsp_log_verbose = 1
let g:lsp_log_file = expand('~/tmp/vim-lsp-logs/javalsp.log')
for the two languages.
[~/tmp/vim-lsp-logs]$ ls
javalsp.log pythonlsp.log
[~/tmp/vim-lsp-logs]$ rg -i "completionitem" pythonlsp.log
10:Thu 14 Jan 2021 01:20:09 PM EST:["--->",1,"pyls",{"method":"initialize","params":{"rootUri":"file:///REDACTED","capabilities":{"workspace":{"configuration":true,"applyEdit":true},"window":{"workDoneProgress":false},"textDocument":{"semanticHighlightingCapabilities":{"semanticHighlighting":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false},"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat":["plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy":false,"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol":{"symbolKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymbolSupport":false},"synchronization":{"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight":{"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"REDACTED","clientInfo":{"name":"vim-lsp"},"processId":2116486,"trace":"off"}}]
13:Thu 14 Jan 2021 01:20:09 PM EST:["<---",1,"pyls",{"response":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"executeCommandProvider":{"commands":[]},"documentHighlightProvider":true,"hoverProvider":true,"referencesProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",","="]},"foldingRangeProvider":true,"codeActionProvider":true,"textDocumentSync":{"save":{"includeText":true},"change":2,"openClose":true},"codeLensProvider":{"resolveProvider":false},"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"definitionProvider":true,"documentRangeFormattingProvider":true,"documentFormattingProvider":true,"documentSymbolProvider":true,"experimental":{},"renameProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":["."]}}}},"request":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"rootUri":"file:///REDACTED","capabilities":{"workspace":{"configuration":true,"applyEdit":true},"window":{"workDoneProgress":false},"textDocument":{"semanticHighlightingCapabilities":{"semanticHighlighting":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false},"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat":["plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy":false,"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol":{"symbolKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymbolSupport":false},"synchronization":{"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight":{"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"REDACTED","clientInfo":{"name":"vim-lsp"},"processId":2116486,"trace":"off"}}}]
For this one, I don't see a field called documentation
but I do see this: "documentationFormat":["plaintext"]
This time I looked for document
specifically within the lines that mention completionitem
rg -i "completionitem" javalsp.log | rg -i "document"
Thu 14 Jan 2021 01:22:11 PM EST:["--->",1,"eclipse.jdt.ls",{"method":"initialize","params":{"rootUri":"file://REDACTED","capabilities":{"workspace":{"configuration":true,"applyEdit":true},"window":{"workDoneProgress":false},"textDocument":{"semanticHighlightingCapabilities":{"semanticHighlighting":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false},"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat":["plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy":false,"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol":{"symbolKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymbolSupport":false},"synchronization":{"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight":{"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"REDACTED","clientInfo":{"name":"vim-lsp"},"processId":2117509,"trace":"off"}}]
Thu 14 Jan 2021 01:22:12 PM EST:["<---",1,"eclipse.jdt.ls",{"response":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"referencesProvider":true,"codeLensProvider":{},"hoverProvider":true,"documentFormattingProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"foldingRangeProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"renameProvider":{"prepareProvider":true},"definitionProvider":true,"textDocumentSync":2,"codeActionProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["."]}}}},"request":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"rootUri":"file://REDACTED","capabilities":{"workspace":{"configuration":true,"applyEdit":true},"window":{"workDoneProgress":false},"textDocument":{"semanticHighlightingCapabilities":{"semanticHighlighting":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false},"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat":["plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy":false,"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol":{"symbolKind":{"valueSet":[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymbolSupport":false},"synchronization":{"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight":{"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"REDACTED","clientInfo":{"name":"vim-lsp"},"processId":2117509,"trace":"off"}}}]
Same thing here - I see "documentationFormat":["plaintext"]
but I don't see any field just called documentation
I’m interested in response for textDocument/completion
Ah, yes.
Looks like the python one has something
[~/tmp/vim-lsp-logs]$ rg -i "textdocument/completion" pythonlsp.log | rg -i "documentation" | wc -l
4
[~/tmp/vim-lsp-logs]$
Thu 14 Jan 2021 01:21:09 PM EST:["<---",1,"pyls",{"response":{"id":30,"jsonrpc":"2.0","result":{"isIncomplete":false,"items":[{"label":"client(args, kwargs)","insertText":"client","sortText":"aclient","kind":3,"documentation":"client(*args, **kwargs)\n\nCreate a low-level service client by name using the default session.\n\nSee :py:meth:`boto3.session.Session.client`.","detail":"boto3"},{"label":"compat","insertText":"compat","sortText":"acompat","kind":9,"documentation":"","detail":"boto3.compat"},{"label":"data","insertText":"data","sortText":"adata","kind":9,"documentation":"","detail":"boto3.data"},{"label":"DEFAULT_SESSION","insertText":"DEFAULT_SESSION","sortText":"aDEFAULT_SESSION","kind":14,"documentation":"","detail":"boto3"},{"label":"docs","insertText":"docs","sortText":"adocs","kind":9,"documentation":"","detail":"boto3.docs"},{"label":"dynamodb","insertText":"dynamodb","sortText":"adynamodb","kind":9,"documentation":"","detail":"boto3.dynamodb"},{"label":"ec2","insertText":"ec2","sortText":"aec2","kind":9,"documentation":"","detail":"boto3.ec2"},{"label":"exceptions","insertText":"exceptions","sortText":"aexceptions","kind":9,"documentation":"","detail":"boto3.exceptions"},{"label":"logging","insertText":"logging","sortText":"alogging","kind":9,"documentation":"Logging package for Python. Based on PEP 282 and comments thereto in\ncomp.lang.python.\n\nCopyright (C) 2001-2017 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!","detail":"boto3"},{"label":"NullHandler","insertText":"NullHandler","sortText":"aNullHandler","kind":7,"documentation":"NullHandler(level: _Level=...)","detail":"boto3"},{"label":"resource(args, kwargs)","insertText":"resource","sortText":"aresource","kind":3,"documentation":"resource(*args, **kwargs)\n\nCreate a resource service client by name using the default session.\n\nSee :py:meth:`boto3.session.Session.resource`.","detail":"boto3"},{"label":"resources","insertText":"resources","sortText":"aresources","kind":9,"documentation":"","detail":"boto3.resources"},{"label":"s3","insertText":"s3","sortText":"as3","kind":9,"documentation":"","detail":"boto3.s3"},{"label":"Session","insertText":"Session","sortText":"aSession","kind":7,"documentation":"Session(aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, region_name=None, botocore_session=None, profile_name=None)\n\nA session stores configuration state and allows you to create service\nclients and resources.\n\n:type aws_access_key_id: string\n:param aws_access_key_id: AWS access key ID\n:type aws_secret_access_key: string\n:param aws_secret_access_key: AWS secret access key\n:type aws_session_token: string\n:param aws_session_token: AWS temporary session token\n:type region_name: string\n:param region_name: Default region when creating new connections\n:type botocore_session: botocore.session.Session\n:param botocore_session: Use this Botocore session instead of creating\n a new default one.\n:type profile_name: string\n:param profile_name: The name of a profile to use. If not given, then\n the default profile is used.","detail":"boto3"},{"label":"session","insertText":"session","sortText":"asession","kind":9,"documentation":"","detail":"boto3.session"},{"label":"set_stream_logger(name, level, format_string)","insertText":"set_stream_logger","sortText":"aset_stream_logger","kind":3,"documentation":"set_stream_logger(name='boto3', level=logging.DEBUG, format_string=None)\n\nAdd a stream handler for the given name and level to the logging module.\nBy default, this logs all boto3 messages to ``stdout``.\n\n >>> import boto3\n >>> boto3.set_stream_logger('boto3.resources', logging.INFO)\n\nFor debugging purposes a good choice is to set the stream logger to ``''``\nwhich is equivalent to saying \"log everything\".\n\n.. WARNING::\n Be aware that when logging anything from ``'botocore'`` the full wire\n trace will appear in your logs. If your payloads contain sensitive data\n this should not be used in production.\n\n:type name: string\n:param name: Log name\n:type level: int\n:param level: Logging level, e.g. ``logging.INFO``\n:type format_string: str\n:param format_string: Log message format","detail":"boto3"},{"label":"setup_default_session(kwargs)","insertText":"setup_default_session","sortText":"asetup_default_session","kind":3,"documentation":"setup_default_session(**kwargs)\n\nSet up a default session, passing through any parameters to the session\nconstructor. There is no need to call this unless you wish to pass custom\nparameters, because a default session will be created for you.","detail":"boto3"},{"label":"utils","insertText":"utils","sortText":"autils","kind":9,"documentation":"","detail":"boto3.utils"},{"label":"_get_default_session()","insertText":"_get_default_session","sortText":"z_get_default_session","kind":3,"documentation":"_get_default_session()\n\nGet the default session, creating one if needed.\n\n:rtype: :py:class:`~boto3.session.Session`\n:return: The default session","detail":"boto3"},{"label":"__author__","insertText":"__author__","sortText":"z__author__","kind":14,"documentation":"","detail":"boto3"},{"label":"__doc__","insertText":"__doc__","sortText":"z__doc__","kind":18,"documentation":"","detail":"boto3"},{"label":"__file__","insertText":"__file__","sortText":"z__file__","kind":18,"documentation":"","detail":"boto3"},{"label":"__name__","insertText":"__name__","sortText":"z__name__","kind":18,"documentation":"","detail":"boto3"},{"label":"__package__","insertText":"__package__","sortText":"z__package__","kind":18,"documentation":"","detail":"boto3"},{"label":"__version__","insertText":"__version__","sortText":"z__version__","kind":14,"documentation":"","detail":"boto3"}]}},"request":{"id":30,"jsonrpc":"2.0","method":"textDocument/completion","params":{"context":{"triggerKind":1},"textDocument":{"uri":"file://REDACTED"},"position":{"character":6,"line":4}}}}]
Whereas Java one doesn't
[~/tmp/vim-lsp-logs]$ rg -i "textdocument/completion" javalsp.log | rg -i "documentation"
[~/tmp/vim-lsp-logs]$
You would want to follow up with server folks.
Even with explicit completion/resolve
request documentation
doesn't seem to be populated. ref: https://github.com/prabirshrestha/vim-lsp/pull/1052
{
"response": {
"id": 8,
"jsonrpc": "2.0",
"result": {
"label": "print(Object obj) : void",
"textEdit": {
"range": {
"end": {
"character": 16,
"line": 19
},
"start": {
"character": 15,
"line": 19
}
},
"newText": "print"
},
"sortText": "999999035",
"kind": 2,
"insertTextFormat": 2,
"insertText": "print",
"detail": "PrintStream.print(Object obj) : void"
}
},
"request": {
"id": 8,
"jsonrpc": "2.0",
"method": "completionItem/resolve",
"params": {
"label": "print(Object obj) : void",
"data": {
"uri": "file:///home/prabirshrestha/code/others/helloworld/src/main/java/com/coveros/demo/helloworld/HelloWorld.java",
"pid": "12",
"rid": "0",
"decl_signature": "Ljava.io.PrintStream;",
"signature": "(Ljava.lang.Object;)V",
"name": "print"
},
"textEdit": {
"range": {
"end": {
"character": 16,
"line": 19
},
"start": {
"character": 15,
"line": 19
}
},
"newText": "print"
},
"sortText": "999999035",
"kind": 2,
"insertTextFormat": 2,
"insertText": "print",
"detail": "PrintStream.print(Object obj) : void"
}
}
}
not a bug in vim-lsp.
Hi @prabirshrestha -
I tried this again with eclipse.jdt.ls
, and it looks like in the logs the server IS returning documentation. To confirm, is this that vim-lsp isn't accounting for another place where docs can be returned? Or is this a server issue that they're returning the documentation in the wrong spot?
If it's a vim-lsp extension that's needed, I'll submit a new issue.
Comparing this to the javadocs, the documentation does look correct: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#compareTo(java.lang.String)
Wed 03 Feb 2021 12:44:24 PM EST:["<---",1,"eclipse.jdt.ls",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Feb 3, 2021, 12:44:24 PM >> document/didChange","type":3}}}]
Wed 03 Feb 2021 12:44:24 PM EST:["<---",1,"eclipse.jdt.ls",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Feb 3, 2021, 12:44:24 PM >> document/foldingRange","type":3}}}]
Wed 03 Feb 2021 12:44:24 PM EST:["<---",1,"eclipse.jdt.ls",{"response":{"method":"window/logMessage","jsonrpc":"2.0","params":{"message":"Feb 3, 2021, 12:44:24 PM >> document/resolveCompletionItem","type":3}}}]
Wed 03 Feb 2021 12:44:24 PM EST:["<---",1,"eclipse.jdt.ls",{"response":{"id":27,"jsonrpc":"2.0","result":{"label":"compareTo(String anotherString) : int","textEdit":{"range":{"end":{"character":15,"line":17},"start":{"character":15,"line":17}},"newText":"compareTo"},"insertText":"compareTo","sortText":"999999035","kind":2,"insertTextFormat":1,"documentation":{"kind":"markdown","value":"Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this `String` object is compared lexicographically to the character sequence represented by the argument string. The result is a negative integer if this `String` object lexicographically precedes the argument string. The result is a positive integer if this `String` object lexicographically follows the argument string. The result is zero if the strings are equal; `compareTo` returns `0` exactly when the equals(Object) method would return `true`.\n\nThis is the definition of lexicographic ordering. If two strings are different, then either they have different characters at some index that is a valid index for both strings, or their lengths are different, or both. If they have different characters at one or more index positions, let *k* be the smallest such index; then the string whose character at position *k* has the smaller value, as determined by using the `<` operator, lexicographically precedes the other string. In this case, `compareTo` returns the difference of the two character values at position `k` in the two string -- that is, the value:\n\n> this.charAt(k)-anotherString.charAt(k)\n\nIf there is no index position at which they differ, then the shorter string lexicographically precedes the longer string. In this case, `compareTo` returns the difference of the lengths of the strings -- that is, the value:\n\n> this.length()-anotherString.length()\n\nFor finer-grained String comparison, refer to java.text.Collator.\n\n * **Parameters:**\n \n * **anotherString** the `String` to be compared.\n * **Returns:**\n \n * the value `0` if the argument string is equal to this string; a value less than `0` if this string is lexicographically less than the string argument; and a value greater than `0` if this string is lexicographically greater than the string argument."},"detail":"String.compareTo(String anotherString) : int"}},"request":{"id":27,"jsonrpc":"2.0","method":"completionItem/resolve","params":{"label":"compareTo(String anotherString) : int","data":{"uri":"file:///home/joe/code/java-language-server/src/main/java/org/javacs/LogFormat.java","pid":"6","rid":"1","decl_signature":"Ljava.lang.String;","signature":"(Ljava.lang.String;)I","name":"compareTo"},"textEdit":{"range":{"end":{"character":15,"line":17},"start":{"character":15,"line":17}},"newText":"compareTo"},"sortText":"999999035","kind":2,"insertTextFormat":1,"insertText":"compareTo","detail":"String.compareTo(String anotherString) : int"}}}]
Hi vim-lsp folks,
First off, thanks for all the work you guys do.
Could someone help me find what the problem is here? I'm seeing that the floating popup window thing that shows the documentation of the current selection from the autocompletion window is not showing up for Java, even though it IS showing up for python.
Language servers I use
python-language-server
eclipse.jdt.ls
and java-language-serverProblem
Nothing shows up when there should be a second window with docs for my current selection for Java
What I expected
I would've expected the contents from javadocs to show up in a second window. For the example in the screenshot, this one: https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#sort(int[])
As you can see, java-language-server supports this feature so I'm wondering why vim-lsp isn't showing it. https://github.com/georgewfraser/java-language-server#autocomplete-symbols-with-auto-import
Python works... kind of.
Funny thing is an autocomplete doc from boto3 seems to be correct...
example minimal vimrc I used to reproduce
misc info
3bca7e8c8a794fde38075e7df9d14c286d055a84