Skip to content

Commit 5229bc4

Browse files
fix: move plenary import into function (#1162)
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 - #1099
1 parent 16d897f commit 5229bc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/CopilotChat/utils.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
local async = require('plenary.async')
22
local curl = require('plenary.curl')
33
local scandir = require('plenary.scandir')
4-
local filetype = require('plenary.filetype')
54

65
local M = {}
76
M.timers = {}
@@ -236,6 +235,7 @@ end
236235
---@param filename string The file name
237236
---@return string|nil
238237
function M.filetype(filename)
238+
local filetype = require('plenary.filetype')
239239
local ft = filetype.detect(filename, {
240240
fs_access = false,
241241
})

0 commit comments

Comments
 (0)