Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Script Rewrite #862

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

TaylorsRus
Copy link

Bug fixes

  • Settings now save
  • Instance changes are now properly listened to and managed

Implemented features

  • Slightly more verbose warnings

Planned features (future PRs, other collaborators)

  • Only send delta DataModel information, not entire DataModel for changes
  • Instead of ignoring entire instances because of one or two problematic properties, just ignore the properties
  • 'Debug Mode' for enabling a bunch of extra prints and warns
  • Sending DM info via URL and not Port for VS Web

Copy link
Contributor

@Barocena Barocena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are some stuff that needs change and we should benchmark the performance on a large place

plugin/src/init.server.lua Show resolved Hide resolved
plugin/src/init.server.lua Outdated Show resolved Hide resolved
plugin/src/init.server.lua Outdated Show resolved Hide resolved
plugin/src/init.server.lua Show resolved Hide resolved
plugin/src/init.server.lua Outdated Show resolved Hide resolved
plugin/src/init.server.lua Outdated Show resolved Hide resolved
plugin/src/init.server.lua Outdated Show resolved Hide resolved
@JohnnyMorganz JohnnyMorganz enabled auto-merge (squash) December 12, 2024 18:23

if game:GetService("RunService"):IsRunning() then
local IsRunning = RunService:IsRunning()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the point in putting this into it's own variable, the original seemed fine

local connected = Instance.new("BoolValue")
local connections = {}
local DefaultSettingsModule = Instance.new("ModuleScript")
DefaultSettingsModule.Name = SETTINGS_MODULE_NAME
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point in inlining this script contents and then creating an instance. Was something wrong with the predefined DefaultSettings.lua? This seems like a roundabout way to end up just doing the same thing that was there before.

Settings.Port = DefaultSettings.Port
elseif type(Settings.StartAutomatically) ~= "boolean" then
warn(
`[Luau Language Server] Could not load settings: StartAutomatically is not a boolean. Defaulting to {DefaultSettings.Port}.`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be DefaultSettings.StartAutomatically?

plugin:OpenScript(SettingsModule)
wasConnected = connected.Value
end)
return SettingsModule
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We perform edits to Settings but end up just returning SettingsModule, won't this discard all the edits we made?

encoded.Name = instance.Name
encoded.ClassName = instance.ClassName
encoded.Children = {}
local function EncodeInstance(Instance: Instance, ChildFilter: ((Instance) -> boolean)?): EncodedInstance
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to switch the casing of all these variables?

In particular, Instance clashes with the global Instance library, please change this.

encoded.Children = {}
local function EncodeInstance(Instance: Instance, ChildFilter: ((Instance) -> boolean)?): EncodedInstance
local Encoded = {}
Encoded.Name = Instance.Name or "EmptyName"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we set or "EmptyName" and or "EmptyClassName" here? AIUI, these should always be set for a given instance. EmptyClassName in particular might break the server since it's an invalid class name.

local function SetupListeners(Instance: Instance)
local NameChangedConnection: RBXScriptConnection = nil
NameChangedConnection = Instance:GetPropertyChangedSignal("Name"):Connect(function()
print(Settings.DebugMode)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary print

SettingsModule.Parent = TestService

local Settings = require(SettingsModule) :: any
print(Settings)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be printing this?

Comment on lines +225 to +226
ParentChangedConnection:Disconnect()
NameChangedConnection:Disconnect()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we disconnect these, Instance might still exist right? So we'll lose any further changes to it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants