From cf9e38657db9878a23a911bf811536b73b164715 Mon Sep 17 00:00:00 2001 From: Artem Dzhemesiuk Date: Sat, 30 Mar 2024 02:40:48 +0100 Subject: Allow plugins to resolve require paths --- script/workspace/require-path.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'script/workspace') diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua index 1507183c..6553212d 100644 --- a/script/workspace/require-path.lua +++ b/script/workspace/require-path.lua @@ -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 = {} @@ -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) -- cgit v1.2.3