@@ -906,6 +906,8 @@ function m.countStates()
906906 return n
907907end
908908
909+ local addonsPath
910+
909911--- Resolve path variables/placeholders like ${3rd} and ${addons}
910912--- @param path string
911913--- @return string resolvedPath
@@ -914,22 +916,32 @@ function m.resolvePathPlaceholders(path)
914916 if key == " 3rd" then
915917 return (ROOT / " meta" / " 3rd" ):string ()
916918 elseif key == " addons" then
917- -- Common path across OSes
918- local dataPath = " User/globalStorage/sumneko.lua/addonManager/addons"
919-
920- if platform .os == " windows" then
921- return " $APPDATA/Code/" .. dataPath
922- elseif platform .os == " linux" then
923- local serverPath = util .expandPath (fs .path (" ~/.vscode-server/data" ):string ())
924- if fs .exists (serverPath ) then
925- -- addons are installed via SSH remote
926- return serverPath .. " /" .. dataPath
927- else
928- return " ~/.config/Code/" .. dataPath
919+ if addonsPath then
920+ return addonsPath
921+ end
922+ local client = require ' client'
923+ local storagePath = client .getOption (' storagePath' )
924+ if storagePath then
925+ addonsPath = storagePath .. " /addonManager/addons"
926+ else
927+ -- Common path across OSes
928+ local dataPath = " User/globalStorage/sumneko.lua/addonManager/addons"
929+
930+ if platform .os == " windows" then
931+ addonsPath = " $APPDATA/Code/" .. dataPath
932+ elseif platform .os == " linux" then
933+ local serverPath = util .expandPath (fs .path (" ~/.vscode-server/data" ):string ())
934+ if fs .exists (serverPath ) then
935+ -- addons are installed via SSH remote
936+ addonsPath = serverPath .. " /" .. dataPath
937+ else
938+ addonsPath = " ~/.config/Code/" .. dataPath
939+ end
940+ elseif platform .os == " macos" then
941+ addonsPath = " ~/Library/Application Support/Code/" .. dataPath
929942 end
930- elseif platform .os == " macos" then
931- return " ~/Library/Application Support/Code/" .. dataPath
932943 end
944+ return addonsPath
933945 elseif key :sub (1 , 4 ) == " env:" then
934946 local env = os.getenv (key :sub (5 ))
935947 return env
0 commit comments