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

Issues completion with / #20

Closed
kkharji opened this issue Nov 10, 2020 · 4 comments
Closed

Issues completion with / #20

kkharji opened this issue Nov 10, 2020 · 4 comments

Comments

@kkharji
Copy link
Contributor

kkharji commented Nov 10, 2020

Hey @hrsh7th I'm thinking there some issues with completion when typing / . You can see in the gif that typing str/ stop completion but pasting str/ bring the completion back for items under the prefix.

Do you think something builtin is conflicting with the source?

Thanks

@hrsh7th
Copy link
Owner

hrsh7th commented Nov 10, 2020

Probably, it means should handle the / as a trigger character.

(I couldn't get the str/index-of item from vim-iced...)

Could you try it?

function! s:datermine(context) abort
  let l:offset = compe#pattern#get_offset(a:context, '[[:alnum:]!$&*\-_=+:<>./?]\+$')
  if l:offset > 0
    return {
    \   'keyword_pattern_offset': l:offset,
    \   'trigger_character_offset': index(['/'], a:context.before_char) >= 0 ? a:context.col : -1
    \ }
  end
  return {}
endfunction

@hrsh7th
Copy link
Owner

hrsh7th commented Nov 10, 2020

If you want to debug more easily, I will add the debug API for custom source.

@kkharji
Copy link
Contributor Author

kkharji commented Nov 10, 2020

Could you try it?

Awesome will do that and report back.

debug API

Definitely, I plan to develop another source that would integrate some sort of english dictionary with definitions. So debug helpers willllll be extremely valued.

@kkharji
Copy link
Contributor Author

kkharji commented Nov 10, 2020

Awesome it worked very well thanks. I didn't expected to be something wrong with the determine function.

@hrsh7th I just noticed that you didn't get str/ completion, sorry I forgot to mention that you must first require it (ns project.core (:require [clojure.string :as str])) in order to get it working.

@kkharji kkharji closed this as completed Nov 10, 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

2 participants