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

Fix of signature help feature when typing '(' symbol #11696

Merged
merged 2 commits into from Oct 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -11,6 +11,8 @@
*/
package org.eclipse.che.plugin.languageserver.ide.editor.signature;

import static com.google.common.base.Strings.isNullOrEmpty;

import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
Expand Down Expand Up @@ -62,7 +64,7 @@ public LanguageServerSignatureHelp(

@Override
public Promise<Optional<SignatureHelp>> signatureHelp(Document document, int offset) {
TextDocumentPositionParams paramsDTO = helper.createTDPP(document, offset);
TextDocumentPositionParams paramsDTO = helper.createTDPP(document, offset + 1);
Promise<org.eclipse.lsp4j.SignatureHelp> promise = client.signatureHelp(paramsDTO);
return promise
.then(
Expand Down Expand Up @@ -106,7 +108,14 @@ public void install(final TextEditor editor) {
new DocumentChangedHandler() {
@Override
public void onDocumentChanged(DocumentChangedEvent event) {
if (triggerCharacters.contains(event.getText())) {
String eventText = event.getText();

if (isNullOrEmpty(eventText)) {
return;
}

String candidate = String.valueOf(eventText.charAt(0));
if (triggerCharacters.contains(candidate)) {
((HandlesTextOperations) editor)
.doOperation(TextEditorOperations.SIGNATURE_HELP);
}
Expand Down