-
Notifications
You must be signed in to change notification settings - Fork 5
Partial matching for restrict_sources
#9
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
base: main
Are you sure you want to change the base?
Conversation
Modified all usages of restrict_sources to consider partial matches. E.g., previously, `restrict_sources={"python"}` would fail to find `python~3.13`, whereas now that will be considered a match. Also added an example remap to the README that shows how this can be used to search the docs for the current file's language automatically.
Note: does not currently function with `telescope.apidocs_open`, only `telescope.apidocs_search`.
Incorporated your feedback One thing to note is that I haven't been successful in getting this to work with Telescope's |
2d32d79
to
7fc1c9d
Compare
for telescope apidocs_open, the modifications in line 40 of lua/apidocs.lua ought to do it. "candidates" is what's fed into the telescope picker? |
Oh yeah, you're right. I must have switched branches when I looked at Telescope because I remember it not working, but it is indeed working properly in |
Originally discussed in #8.
Expanded the pattern matching expression so it is more precise:
"^" .. source .. "~%d+(%.%d+)?$"
- so "python" will match directoriespython
,python~3
, orpython~3.13
.Added partial string matching for restrict_sources. Previously, the exact directory name had to be entered, e.g. python~3.13 rather than just python. With the new approach, if restrict_sources contains a value python, any directories starting with python will be considered valid. The motivation for this is demonstrated in the README example - we can now automatically restrict the sources for the language of the current file, and we won't have issues if the language docs have the version in their name: