Skip to content

fix: move plenary import into function #1162

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

fredrikaverpil
Copy link
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 deathbeam and Copilot and removed request for deathbeam June 16, 2025 06:13
Copy link

@Copilot 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
Collaborator

@all-contributors add @fredrikaverpil for code

Copy link
Contributor

@deathbeam

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

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.

2 participants