TerminalFi / LSP-copilot

GitHub Copilot support for Sublime Text LSP plugin provided through Copilot.vim.
625 stars 25 forks source link

Supports the ability to honor `.gitignore` patterns (TOP LEVEL ONLY) #106

Closed TerminalFi closed 1 year ago

TerminalFi commented 1 year ago

Attempt to have LSP-copilot honor .gitignore files that are detected at the top level of the window folders. Comparing the View path with the window path to get the correct ignore file.

jfcherng commented 1 year ago

.gitignore files that are detected at the top level of the window folders.

Arguably this is not how .gitignore works. It should be searched bottom-up until .git is seen even if it's not in the workspace. (what if there is .gitignore but there is no .git? 😂)

Maybe request a ST API like is_gitignored(file: str|Path)... since ST obviously knows this?


Ok. I see TOP LEVEL ONLY.

TerminalFi commented 1 year ago

.gitignore files that are detected at the top level of the window folders.

Arguably this is not how .gitignore works. It should be searched bottom-up until .git is seen even if it's not in the workspace. (what if there is .gitignore but there is no .git? 😂)

Ok. I see TOP LEVEL ONLY.

Yes this is a very basic implementation, I have a more complete one in the works. But I also am expecting copilot to release a spec for this so not sure how much effort to put into this.

At the moment I can push more which does searching bottom up until it reaches the workspace. Those changes will land soon.

Maybe a ST api is the right approach..but yeah I might request it

jfcherng commented 1 year ago

Yes this is a very basic implementation, I have a more complete one in the works. But I also am expecting copilot to release a spec for this so not sure how much effort to put into this.

Yes, making a feature request to copilot.vim is an option too.

rchl commented 1 year ago

Also it's not correct to treat all entries in .gitignore as paths relative to its directory. If the entry doesn't start with a slash then it applies also in subdirectories. and there are probably more rules, i haven't read the spec.

TerminalFi commented 1 year ago

Also it's not correct to treat all entries in .gitignore as paths relative to its directory. If the entry doesn't start with a slash then it applies also in subdirectories. and there are probably more rules, i haven't read the spec.

Yup, I’ve got this solved as well I believe

TerminalFi commented 1 year ago

Copilot will natively support it soon.