Skip to content

fix: move plenary import into function#1162

Merged
deathbeam merged 1 commit intoCopilotC-Nvim:mainfrom
fredrikaverpil:fix/plenary-filetype
Jun 16, 2025
Merged

fix: move plenary import into function#1162
deathbeam merged 1 commit intoCopilotC-Nvim:mainfrom
fredrikaverpil:fix/plenary-filetype

Conversation

@fredrikaverpil
Copy link
Copy Markdown
Contributor

Commit cf02033 broke test detection in Neotest. When another plugin calls require("plenary.filetype") before Neotest does, it seems that Neotest cannot successfully complete the call to
require("neotest.lib").treesitter.parse_positions and does not find any tests.

This seem like a bug in either plenary or Neotest and this commit is merely a workaround.

Related issues:

Commit cf02033 broke test detection in Neotest. When another plugin
calls `require("plenary.filetype")` before Neotest does, it seems that
Neotest cannot successfully complete the call to
`require("neotest.lib").treesitter.parse_positions` and does not find
any tests.

This seem like a bug in either plenary or Neotest and this commit is
merely a workaround.

Related issues:
- nvim-neotest/neotest#502
- CopilotC-Nvim#1099
@jellydn jellydn requested review from Copilot and deathbeam and removed request for deathbeam June 16, 2025 06:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR provides a workaround for a test detection issue in Neotest by moving the plenary filetype import into the function call.

  • Removed the global import of plenary.filetype.
  • Added a local require in the M.filetype function to work around the bug.
Comments suppressed due to low confidence (1)

lua/CopilotChat/utils.lua:238

  • Consider adding an inline comment to explain why the require call was moved inside the function, referencing the Neotest issue. This helps future maintainers understand the context and rationale.
  local filetype = require('plenary.filetype')

@deathbeam deathbeam merged commit 5229bc4 into CopilotC-Nvim:main Jun 16, 2025
3 of 4 checks passed
@deathbeam
Copy link
Copy Markdown
Collaborator

@all-contributors add @fredrikaverpil for code

@allcontributors
Copy link
Copy Markdown
Contributor

@deathbeam

I've put up a pull request to add @fredrikaverpil! 🎉

deathbeam added a commit to deathbeam/CopilotChat.nvim that referenced this pull request Jul 10, 2025
* main:
  chore(doc): auto generate docs
  Properly null check opts.glob when rigpgrep is not available (CopilotC-Nvim#1183)
  docs: add adborden as a contributor for code (CopilotC-Nvim#1171)
  fix: CopilotC-Nvim#1153 use filepath on accept (CopilotC-Nvim#1170)
  chore(doc): auto generate docs
  chore(main): release 3.12.1 (CopilotC-Nvim#1164)
  docs: add fredrikaverpil as a contributor for code (CopilotC-Nvim#1165)
  chore(doc): auto generate docs
  fix: move plenary import into function (CopilotC-Nvim#1162)
  chore(doc): auto generate docs
  chore(main): release 3.12.0 (CopilotC-Nvim#1131)
  docs: add azdanov as a contributor for doc, and code (CopilotC-Nvim#1130)
  chore(doc): auto generate docs
  docs: update mentions of default model to gpt-4.1
  feat: switch to new default model gpt-4.1
  chore(doc): auto generate docs
  chore(main): release 3.11.1 (CopilotC-Nvim#1116)
  chore(doc): auto generate docs
  [pre-commit.ci] pre-commit autoupdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants