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

No warning of truncated lines when saving to source member #1172

Closed
chrjorgensen opened this issue Mar 25, 2023 · 7 comments
Closed

No warning of truncated lines when saving to source member #1172

chrjorgensen opened this issue Mar 25, 2023 · 7 comments
Labels
bug A confirmed issue when something isn't working as intended enhancement New feature or request

Comments

@chrjorgensen
Copy link
Collaborator

Describe the bug

When a source member is opened in the editor and source lines longer than the maximum length are created, when the member is saved no warning is issued that lines will be truncated!

There is an indicator for lines exceeding the line length (the exceeding characters are underlined in read), but these lines may not be in the editor window. Or the exceeding characters may be too far to the right and thus outside the editor window.

I almost lost some source because of this - luckily I hadn't closed the editor when the compiler complained about garbage lines (phew)!

Expected behavior

There should be a pop-up warning the user that lines will be truncated if the user continues to save.

@chrjorgensen chrjorgensen added the bug A confirmed issue when something isn't working as intended label Mar 25, 2023
@worksofliam
Copy link
Contributor

worksofliam commented Mar 25, 2023

@chrjorgensen So we only know the source record length when SQL mode is enabled, which is how we provide the in-editor warning.

Do we also provide a new user setting (enabled by default) which will disable saving of files when a line of code is over the record length? This would only be available when source dates are enabled.

@worksofliam worksofliam added the enhancement New feature or request label Mar 25, 2023
@chrjorgensen
Copy link
Collaborator Author

@worksofliam Source record length should always be considered, SQL mode enabled or not.
We can get the record length when SQL is disabled by DSPFD <lib>/<sourcefile> *RCDFMT and extract the value from RFLEN.
It would be logical to do this when opening the source file to retrieve the member list.

No user setting should be necessary... a warning should always be shown when trimmed source exceeds record length, but if you want to give the user the ultimate responsibility, you could provide an option Force to force the save operation despite the data loss.

@worksofliam
Copy link
Contributor

So we only know the source record length when SQL mode is enabled, which is how we provide the in-editor warning.

This is a false statement from myself. I believe we always know the record length, no matter if SQL is enabled or not.

@worksofliam
Copy link
Contributor

Possible dupe of #1347

@alanseiden
Copy link
Contributor

An alert user suggests adding rulers, which show vertical lines at the desired length.
In settings JSON:

// Adds rulers to the screen at cols 80 & 100
    "editor.rulers": [
        80,
        100
    ],
    "workbench.colorCustomizations": {
        "editorRuler.foreground": "#fa03032a"
    },

Example of how it looks:
image

@chrjorgensen
Copy link
Collaborator Author

@alanseiden A good tip, which I also started using a long time ago... 😃
This could even be turned into an option in this extension so the ruler will be set when a member is opened...

@angelorpa
Copy link
Contributor

hope this #1764 help in the meaning time. This only shows a warning message after the member is saved.

Informing the user that some lines will be truncated before the saving process takes place would be ideal. Any efficient and effective way to do it? I was thinking of using the TextDocument and TextLine objects of the VS Code API.

on the other hand, I like the idea #1172 (comment) to set a vertical ruler when a member is opened but this should consider the user can open members from different source files that have different record lengths, so each member should have they own vertical rule. VS Code let set a vertical rule for all documents and per language but not for a specific open document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A confirmed issue when something isn't working as intended enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants