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

lsp-completion: Fix triggerKind on manual invokation #2864

Merged
merged 2 commits into from May 14, 2021

Conversation

gexplorer
Copy link
Contributor

Related to issue #2857.

If space is among a servers triggerCharacters for completion, it does not return any results after a space.

This happens because lsp-completion--get-context returns CompletionTriggerKind = 2 when completion is invoked manually but the previous character is one of triggerCharacters.

Steps to Reproduce

See example project

  • Inside a vue file

Failed completion

  • Try completion with cursor separated one space from the curly bracket:
import { | } from 'vue';
  • The request is:
Params: {
  "textDocument": {
    "uri": "file:///Users/eder/Projects/veturpack/src/Test.vue"
  },
  "position": {
    "line": 7,
    "character": 9
  },
  "context": {
    "triggerKind": 2,
    "triggerCharacter": " "
  }
}
  • It won't return results

Correct completion

  • Try completion with cursor right after the curly bracket
import {|  } from 'vue';
  • The request is:
Params: {
  "textDocument": {
    "uri": "file:///Users/eder/Projects/veturpack/src/Test.vue"
  },
  "position": {
    "line": 7,
    "character": 8
  },
  "context": {
    "triggerKind": 1
  }
}

@gexplorer
Copy link
Contributor Author

Hey @kiennq do you know about the errors in the build? I'm not sure they are related to what I changed 😖

@yyoncho
Copy link
Member

yyoncho commented May 12, 2021

Hey @kiennq do you know about the errors in the build? I'm not sure they are related to what I changed

Errors seem to be unrelated.

@kiennq
Copy link
Member

kiennq commented May 12, 2021

Hey @kiennq do you know about the errors in the build? I'm not sure they are related to what I changed 😖

We're not using Cask on Windows so I think you will need to update windows-boostrap.el to include el-mock

lsp-completion.el Outdated Show resolved Hide resolved
test/lsp-completion-test.el Outdated Show resolved Hide resolved
@gexplorer gexplorer requested review from yyoncho and kiennq May 13, 2021 14:07
@kiennq kiennq merged commit e9d5cea into emacs-lsp:master May 14, 2021
@kiennq
Copy link
Member

kiennq commented May 14, 2021

Thank you

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

Successfully merging this pull request may close these issues.

None yet

3 participants