-
Notifications
You must be signed in to change notification settings - Fork 48
objectscript.autoAdjustName behavior changed on client-side editing #1559
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
Comments
Hi @hsyhhssyy, can you send reproduction steps for the issues please? 1 should have been fixed by #1515, which is in 3.0.0. 2 sounds unrelated to |
Problem 1 Problem 2 Possible approach |
Hi @hsyhhssyy , thanks for the videos. Your first problem is expected behavior. When I changed the default for the |
The issue is that when the new file is created via |
@hsyhhssyy My fix for your second issue can be tested using the vsix in the zip below. |
Perhaps we could look at adding an new option that disables automatic class-definition insertion when a new file is created. In many client-side editing scenarios, users don’t always save files in a package-style directory structure (as one might in Java), so this behavior isn’t always desirable. One idea is to introduce a setting—perhaps called autoCreateName, enabled by default. If it seems like we’re introducing too many individual settings, we could consider streamlining autoAdjustName into a single option with three possible values— “no,” “create,” and “create, copy and move”—with “create” as the default. I have create another PR to implement this approach. |
Based on my testing, the update in vscode-objectscript-3.0.3-dev.1562.vsix.zip seems to have resolved the Problem 2. But I’m a bit concerned about whether relying on a timeout is truly reliable—particularly if my computer or disk happens to be unusually slow. |
Thanks for checking the vsix @hsyhhssyy. I am not completely satisfied with the timeout as well, but I don't think there's a better way to do this because the extension can't "know" ahead of time that the file is supposed to have content. I will discuss your PR with the other maintainers. |
In version 3.0.0, the behavior of the aforementioned configuration was adjusted:
objectscript.autoAdjustName
setting tofalse
. Now that we have an index of the workspace, we no longer require that a document's name match the file path for the extensions to find it. This setting only affects files that are copied or moved. New files will still have the Class or ROUTINE header generated upon file creation.However, this change seems to have led to unexpected side effects in client-side editing:
Problem 1: When creating a blank file, the plugin may automatically generate a blank class definition.
Problem 2: When saving server code to disk using Ctrl+S in the Server Explorer, the plugin may unexpectedly modify CLASS package names or ROUTINE names.
Problem 1 may be acceptable, but Problem 2 is not, as it modifies existing code without explicit user consent. This behavior risks users unknowingly committing incorrect code if they fail to notice the altered package name.
Could you confirm if this is the intended behavior and provide some insight into the reasoning behind it?
The text was updated successfully, but these errors were encountered: