rescript-lang / rescript-lang/vim-rescript

Omni completion duplicate prefix

Aperta
#58 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Vim Script
Stelle
164
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla funzione di completamento omni del plugin, in particolare dal percorso findstart=1, e riproduci il problema con un file .res vuoto e l’input Js.Un. Confronta il comportamento del completamento con la configurazione omni suggerita e verifica che la selezione di Undefined lasci Js.Undefined invece di duplicare il prefisso; l’issue identifica inoltre il binario di analisi come possibile punto di integrazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
vim
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.