-
Notifications
You must be signed in to change notification settings - Fork 74
Add file preview #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I think it should be moved to |
|
Can I add documentation there? |
|
You should add source.resolve = function(completion_item, callback)
-- read file and add documentation here.
end |
|
just did. things to consider:
|
|
nvim-cmp will pass custom option like https://github.com/hrsh7th/cmp-buffer/blob/main/lua/cmp_buffer/init.lua#L28
|
but how to access that in |
|
You can pass the option to data field. |
|
Hm... Probably, we should pass option to the |
|
well, copying the options through the data seems hackish... |
|
Hmm. resolve and execute only accept items and functions according to the LSP specification. (google translated) |
|
well, maybe add a parameter to the |
source.new = function()
local self = setmetatable({}, source);
self.option = { ... default ... }
return self
end
source.complete = function(self, request, callback)
self.option = request.option
...
endI think it will be work. |
|
Yeah, but its still hackish... I though about adding an argument like this: and then use |
|
I think it is impossible. Hm... we should introduce |
|
Interesting. But you should have good semantics regarding when |
|
Yes. I think it is very hard to define semantics because sometimes the source is loaded lazily... |
|
Well, I can add a specific source config interface, but I think this should be solved in a more general fashion. |
|
anything new on this? |
|
I'm sorry. I forgot to confirm this PR. |
|
I think I addressed all the issues. |
|
I think we should add |
|
How would you detect binary files? |
|
You could do what Git does (IIRC), check if the first kilobyte includes a NUL byte. (response to "How would you detect binary files?") |
|
My vimscript version implementation is here. (I don't know how to implement it in Lua) |
|
I added just this functionality in f7d350a |
|
@tzachar Try doing |
|
@hrsh7th should I add |
|
I'm considering configuration API. local source = {}
source.on_configuration = function(self, params)
self.... = params....
end
...
return source |
|
|
Cool. Do you want to wait till u stabilize it? |
|
@hrsh7th not sure I understand. Do you want me to add anything or will you merge it as is? |
|
@hrsh7th Anything new on this? |
|
@hrsh7th |
|
I'm sorry to forget about this PR every time... |
|
10x |
MR requested at hrsh7th#66 (comment) Reviewed-on: https://codeberg.org/FelipeLema/cmp-async-path/pulls/2 Co-authored-by: davidsierradz <davidsierradz@gmail.com> Co-committed-by: davidsierradz <davidsierradz@gmail.com>
Hi.
This is an initial attempt of adding file previews.
wdyt?