rescript-lang / rescript-lang/vim-rescript

Omni completion duplicate prefix

Offen
#58 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Vim Script
Sterne
164
Forks
17
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

When I select an entry from the omni completion menu, the existing prefix is duplicated. I'm using the latest vim-rescript and the suggested omni completion configuration (without coc-vim).

The problem can be demonstrated (once issue #56 has been fixed) by first creating an empty .res file, compiling the project, opening the file in VIM or Neovim and then typing out the following:

Js.Un

Hit <C-x><C-o> in insert mode with the cursor at the end of the line. The only match (Undefined) will be selected as expected. Afterwards the buffer will look like this:

Js.UnUndefined

The plugin most probably shouldn't end up duplicating the common prefix.

It looks like VS Code does the right thing by default and "will replace the word until the cursor with the given label or insertText" in cases like this:

https://code.visualstudio.com/api/references/vscode-api#CompletionItem

This might be a bit problematic to fix client side, because it looks like the plugin must know the correct location when the completion function is first called (when findstart is set to 1). Could the bulk of the logic be moved there so that the second invocation would just return the already-populated list?

Or could the analysis binary be amended to include insertText?

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei der Omni-Vervollständigungsfunktion des Plugins, insbesondere beim Pfad findstart=1, und reproduziere das Problem mit einer leeren .res-Datei und der Eingabe Js.Un. Vergleiche das Vervollständigungsverhalten mit der vorgeschlagenen Omni-Konfiguration und überprüfe, dass die Auswahl von Undefined Js.Undefined zurücklässt, statt das Präfix zu duplizieren; das Issue identifiziert außerdem die Analyse-Binärdatei als möglichen Integrationspunkt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
vim
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.