From 4f1ea91ed1590076d08f1c0c1b3f7dd84e8ef0f9 Mon Sep 17 00:00:00 2001 From: nezuo Date: Tue, 7 May 2024 20:23:13 -0700 Subject: [PATCH] Allow openScriptsExternally option to be changed during sync --- plugin/src/App/StatusPages/Settings/init.lua | 1 - plugin/src/App/init.lua | 8 +------- plugin/src/ServeSession.lua | 5 ++--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/plugin/src/App/StatusPages/Settings/init.lua b/plugin/src/App/StatusPages/Settings/init.lua index 441c9cd84..e5fb1af44 100644 --- a/plugin/src/App/StatusPages/Settings/init.lua +++ b/plugin/src/App/StatusPages/Settings/init.lua @@ -175,7 +175,6 @@ function SettingsPage:render() id = "openScriptsExternally", name = "Open Scripts Externally", description = "Attempt to open scripts in an external editor", - locked = self.props.syncActive, experimental = true, transparency = self.props.transparency, layoutOrder = layoutIncrement(), diff --git a/plugin/src/App/init.lua b/plugin/src/App/init.lua index d80bf0169..bd21765d0 100644 --- a/plugin/src/App/init.lua +++ b/plugin/src/App/init.lua @@ -425,11 +425,6 @@ function App:startSession() local host, port = self:getHostAndPort() - local sessionOptions = { - openScriptsExternally = Settings:get("openScriptsExternally"), - twoWaySync = Settings:get("twoWaySync"), - } - local baseUrl = if string.find(host, "^https?://") then string.format("%s:%s", host, port) else string.format("http://%s:%s", host, port) @@ -437,8 +432,7 @@ function App:startSession() local serveSession = ServeSession.new({ apiContext = apiContext, - openScriptsExternally = sessionOptions.openScriptsExternally, - twoWaySync = sessionOptions.twoWaySync, + twoWaySync = Settings:get("twoWaySync"), }) self.cleanupPrecommit = serveSession.__reconciler:hookPrecommit(function(patch, instanceMap) diff --git a/plugin/src/ServeSession.lua b/plugin/src/ServeSession.lua index 82d8fd42f..bb844d062 100644 --- a/plugin/src/ServeSession.lua +++ b/plugin/src/ServeSession.lua @@ -13,6 +13,7 @@ local InstanceMap = require(script.Parent.InstanceMap) local PatchSet = require(script.Parent.PatchSet) local Reconciler = require(script.Parent.Reconciler) local strict = require(script.Parent.strict) +local Settings = require(script.Parent.Settings) local Status = strict("Session.Status", { NotStarted = "NotStarted", @@ -50,7 +51,6 @@ ServeSession.Status = Status local validateServeOptions = t.strictInterface({ apiContext = t.table, - openScriptsExternally = t.boolean, twoWaySync = t.boolean, }) @@ -89,7 +89,6 @@ function ServeSession.new(options) self = { __status = Status.NotStarted, __apiContext = options.apiContext, - __openScriptsExternally = options.openScriptsExternally, __twoWaySync = options.twoWaySync, __reconciler = reconciler, __instanceMap = instanceMap, @@ -170,7 +169,7 @@ function ServeSession:__applyGameAndPlaceId(serverInfo) end function ServeSession:__onActiveScriptChanged(activeScript) - if not self.__openScriptsExternally then + if not Settings:get("openScriptsExternally") then Log.trace("Not opening script {} because feature not enabled.", activeScript) return