-
Notifications
You must be signed in to change notification settings - Fork 26
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
Suggested snippets for something already completed (c/c++ includes as an example) #21
Comments
This is caused by #20. The reason why it is triggering self completion incorrectly is that company-lsp The results of this is:
@Sarcasm I'll use the completion suffix to detect if self-completion should be triggered. The current logic not only causes issue with cquery, but also java auto-import. |
The current logic checks whether (point) changes before and after post completion actions to determine if re-triggering completion is desired. However, this logic is not robust enough. It incorrectly re-triggers completion when the post-completion action adds import statements by Javacomp, or fixes the duplicated `#` characters by cquery (see #21). This change proposes comparing the suffix of the completion before and after post-completion editing. I tested that it still works for the desired case (std::) while not re-triggering completion for either the cquery include or Javacomp auto-import case.
The current logic checks whether (point) changes before and after post completion actions to determine if re-triggering completion is desired. However, this logic is not robust enough. It incorrectly re-triggers completion when the post-completion action adds import statements by Javacomp, or fixes the duplicated `#` characters by cquery (see #21). This change proposes comparing the suffix of the completion before and after post-completion editing. I tested that it still works for the desired case (std::) while not re-triggering completion for either the cquery include or Javacomp auto-import case.
The current logic checks whether (point) changes before and after post completion actions to determine if re-triggering completion is desired. However, this logic is not robust enough. It incorrectly re-triggers completion when the post-completion action adds import statements by Javacomp, or fixes the duplicated # characters by cquery (see #21). This change proposes only re-trigger completion when the completed text before point is any of the trigger characters. An additional custom variable is added allowing users to turn this feature on/off. I tested that it still works for the desired case (std::) while not re-triggering completion for Javacomp auto-import case. However, it still re-triggers completion for the cquery include case because `>' is one of the trigger characters. Due to this reason, this feature is turned off by default.
The current logic checks whether (point) changes before and after post completion actions to determine if re-triggering completion is desired. However, this logic is not robust enough. It incorrectly re-triggers completion when the post-completion action adds import statements by Javacomp, or fixes the duplicated # characters by cquery (see #21). This change proposes only re-trigger completion when the completed text before point is any of the trigger characters. An additional custom variable is added allowing users to turn this feature on/off. I tested that it still works for the desired case (std::) while not re-triggering completion for Javacomp auto-import case. However, it still re-triggers completion for the cquery include case because `>' is one of the trigger characters. Due to this reason, this feature is turned off by default.
I do not remember being bothered with this issue. What can I do for help? |
I should have updated this issue. The issue is now mitigated by #22. I kept this issue open because the root cause is lsp-mode/company-lsp and cquery has different view of the completion prefix. If a user completes at this point: #include| where The result is, all candidates returned by cquery are prefixed with Users don't see two leading The best solution is allowing clients to define their own functions to get the prefix bounds. This requires fundamental changes to lsp-mode. I have a PR for lsp-mode to enable this: emacs-lsp/lsp-mode#281 |
Is there an update on this? lsp-mode has that PR merged to master, and I believe I am up to date with all components of lsp and cquery, but I face the same issue(jacobdufault/cquery#401). Edit: To add to this, all candidates are not just prefixed with "#" but "#include <" for me, all of the string being redundant since that was the triggering prefix. |
As referenced at the bottom of this thread (there are also unrelated topics):
jacobdufault/cquery#401
If you complete an
include header
in c/c++, company-lsp seems to suggest a snippet for what you've just done.The text was updated successfully, but these errors were encountered: