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

replacementPrefix generated by textEdit for autocompletion suggestions is overruled #266

Closed
Gert-dev opened this issue May 27, 2019 · 3 comments

Comments

@Gert-dev
Copy link

The Serenata server generates autocompletion suggestions that carry a textEdit property that can replace characters, for example:

<?php

/**
 * @inh
 */

In this docblock, with the cursor after the @inh text, a suggestion with text @inheritDoc is generated, which includes a textEdit that includes the range of the existing @inh text to ensure it is replaced in its entirety, along with the @ sign.

Currently, this @ sign is not replaced and the result of selecting the completion is:

<?php

/**
 * @@inheritDoc
 */

I did some digging and it turns out that the AutocompleteAdapter first properly resolves the textEdit to the replacementPrefix of value @. However, afterwards, that (correct) replacementPrefix is then trampled and overwritten by this code in AutocompleteAdapter::getSuggestions:

// As the user types more characters to refine filter we must replace those characters on acceptance
const replacementPrefix = (triggerChar !== '' && triggerOnly) ? '' : request.prefix;
for (const suggestion of suggestions) {
   suggestion.replacementPrefix = replacementPrefix;
}

This resets the replacementPrefix of @ to an empty value and seems to be the cause of the double @ symbol being inserted.

@Aerijo
Copy link
Contributor

Aerijo commented May 27, 2019

@Gert-dev This may be fixed on master, could you confirm?

@Gert-dev
Copy link
Author

@Aerijo I can and it seems to be fixed on latest master, presumably by 3f44ceb.

Thanks! Feel free to close this ticket. I'll keep a lookout for a new stable release to target that contains it.

@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.

@Gert-dev Gert-dev closed this as completed Nov 6, 2020
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

3 participants