Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Autocompletion for C++ preprocessor directives doesn't delete existing text properly #220

Open
rianneogi opened this issue May 25, 2018 · 4 comments

Comments

@rianneogi
Copy link

rianneogi commented May 25, 2018

Hi, I'm using ide-cquery package for C++ autocompletion.

When I type #include <stdi, the completion returns #include <stdio.h>.
However, if I press enter to trigger the completion the resulting string will be #include <#include <stdio.h>. It doesn't seem to delete the text before the <.

Another example: Type #def, autocomplete will suggest #define but ##define (double hashtag) is inserted upon pressing enter, it doesn't delete the first #.

@fredemmott
Copy link

Seeing what appears to be the same issue with Hack, when completing variable names:

  1. Use a variable $foo
  2. Type $f to trigger autocomplete
  3. Gets completed to $$foo instead of $foo

If not setting useTextEditAutocomplete in initializationOptions, this is inserted text, and appears to be buggy in Hack - it does not work correctly in vscode or vim. However, if that option is set, TextEdits are sent, which work correctly in vscode and vim, but not atom.

@YusufMohammedUH
Copy link

I have the same problem here using ide-cquery for autocompletion. Does anyone have a solution?

@fargies
Copy link

fargies commented Apr 16, 2020

Seems to be related to the fact that those completions have an empty insertText and that their label is used instead.

The following modification seems to do the trick, but not sure if this is the best thing to do:

--- a/lib/adapters/autocomplete-adapter.ts
+++ b/lib/adapters/autocomplete-adapter.ts
@@ -393,7 +393,7 @@ export default class AutocompleteAdapter {
     item: CompletionItem,
     suggestion: TextSuggestion,
   ) {
-    suggestion.text = item.insertText || item.label;
+    suggestion.text = item.insertText || "";
     suggestion.filterText = item.filterText || item.label;
     suggestion.displayText = item.label;
     suggestion.type = AutocompleteAdapter.completionKindToSuggestionType(item.kind);

@UziTech
Copy link

UziTech commented Oct 19, 2020

Development of atom-languageclient has officially moved to https://github.com/atom-ide-community/atom-languageclient 🎉

If this is still an issue please consider opening an issue on that repo.

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

No branches or pull requests

5 participants