Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function m.showError(scp, err)
client.showMessage('Error', lang.script('PLUGIN_RUNTIME_ERROR', scp:get('pluginPath'), err))
end

---@alias plugin.event 'OnSetText' | 'OnTransformAst'
---@alias plugin.event 'OnSetText' | 'OnTransformAst' | 'ResolveRequire'

---@param event plugin.event
function m.dispatch(event, uri, ...)
Expand Down
6 changes: 6 additions & 0 deletions script/workspace/require-path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local workspace = require "workspace"
local config = require 'config'
local scope = require 'workspace.scope'
local util = require 'utility'
local plugin = require 'plugin'

---@class require-path
local m = {}
Expand Down Expand Up @@ -181,6 +182,11 @@ function mt:searchUrisByRequireName(name)
local searcherMap = {}
local excludes = {}

local pluginSuccess, pluginResults = plugin.dispatch('ResolveRequire', self.scp.uri, name)
if pluginSuccess and pluginResults ~= nil then
return pluginResults
end

for uri in files.eachFile(self.scp.uri) do
if vm.isMetaFileRequireable(uri) then
local metaName = vm.getMetaName(uri)
Expand Down