blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Path source: relative paths without leading dot do not work

Open SuzumiK opened this issue 1 year ago • 3 comments

Make sure you have done the following

  • [X] I have updated to the latest version of blink.cmp
  • [X] I have read the README

Bug Description

dirA
|____dirB
       |_____file.txt

with the working directory set as dirA, entering ./dirB/ triggers completion with the suggestion file.txt. Omitting the dot (ie. entering dirB/) does not work.

The completion is rejected here: https://github.com/Saghen/blink.cmp/blob/02528e8ccbe4d0cef5e1df52eda419c5ed557ad3/lua/blink/cmp/sources/path/lib.lua#L32

I am not really sure if this is a bug or a feature, but it took me by surprise.

Relevant configuration

No response

neovim version

nightly

blink.cmp version: branch, tag, or commit

v0.7.6

SuzumiK avatar Dec 16 '24 20:12 SuzumiK

This might be tricky because it could activate when you wouldn't want it to (i.e. typing foo/bar in markdown, or str/trim in clojure). We should likely enable this per language by checking the treesitter node under the cursor (:h vim.treesitter.get_node) to ensure we're in a comment/string. To start though, it could be enough to allow the user to toggle this via the opts table on the source. PR welcome!

saghen avatar Dec 17 '24 19:12 saghen

Would this also be an issue if foo/bar or str/trim does not exist in the current working directory?

SuzumiK avatar Dec 17 '24 20:12 SuzumiK

It wouldn't be an issue in that case but it seems like a good idea to keep it disabled by default, in case a directory does exist, if we we're not checking the treesitter node

saghen avatar Dec 17 '24 20:12 saghen

Merging this with #966

saghen avatar Jan 19 '25 22:01 saghen