rescript-lang / rescript-lang/vim-rescript
Omni completion for items without documentation
まだ誰も着手していません。
- 主要言語
- Vim Script
- スター
- 164
- フォーク
- 17
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Under the hood, rescript-editor-analysis.exe returns null instead of an object/dict when a completion item has no documentation. This results in multiple errors in rescript#Complete.
A minimal example with vim-plug and the latest versions of vim-rescript and rescript (tested in VIM 8.2 and in Neovim 0.6.1):
~/.vimrc or ~/.config/nvim/init.vim:
call plug#begin()
Plug 'rescript-lang/vim-rescript'
call plug#end()
set omnifunc=rescript#Complete
set completeopt+=preview
Example.res:
let myInteger = 1
let myString = "2"
Also needed:
- complete/completion mismatch fix: #56
Make sure the project is built. Type let my as the last line of Example.res and hit <C-x><C-o> in insert mode. You'll get the following errors twice:
Error detected while processing function rescript#Complete:
line 36:
E121: Undefined variable: value
Press ENTER or type command to continue
Error detected while processing function rescript#Complete:
line 38:
E121: Undefined variable: entry
Press ENTER or type command to continue
Error detected while processing function rescript#Complete:
line 38:
E116: Invalid arguments for function add(l:ret, entry)
Press ENTER or type command to continue
After hitting ENTER enough times:
-- Omni completion (^O^N^P) Pattern not found
I think the problem lies here:
item.documentation is null for undocumented matches.
I tried to replace the offending line with the following, and now omni completion works both for built-in items and for undocumented local items (but I'm no expert in vimscript, so this may be a silly way to do it):
if type(item.documentation) == v:t_dict
let l:info = item.documentation.value
else
let l:info = item.detail " or some default value
endif
let entry = { 'word': item.label, 'kind': l:kind, 'info': l:info }
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
autoload/rescript.vim の369行目付近から始め、Vim または Neovim で issue の補完ケースを再現する前にプロジェクトをビルドします。item.documentation が null の場合の処理を、#56 の補完不一致の修正を context として確認します。組み込みのローカル項目とドキュメントのないローカル項目が、報告されたエラーなしで補完されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- vim
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 68/100