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

Text replacement should limit text shifting #54

Open
1 of 4 tasks
FALLAI-Denis opened this issue Jun 2, 2020 · 6 comments
Open
1 of 4 tasks

Text replacement should limit text shifting #54

FALLAI-Denis opened this issue Jun 2, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@FALLAI-Denis
Copy link

Development environment used

  • Editor Platform
    • Visual Studio Code
    • CodeReady Workspaces
    • Eclipse Che
    • Standlone Theia
  • Platform Version: 1.45.1
  • Operating System : Windows 10 "1607"
  • Java Version: java version "1.8.0_102" 64-Bit
  • Logs attached: yes

Text replacement should limit column offsets.pdf

Problem Description

Detailed steps for reproducing the problem:

See attachement

Observed behavior:

See attachement

Designed behavior:

When searching and replacing text in program source code (Cobol, Assembler), or on a JCL that may contain sysins, if the replacement text is not the same length as the searched text, then this introduces shifts in the source code, which can then trigger compilation errors, or incorrect interpretations of data.

The search and replacement functions on mainframe source code must apply the same rules as the TSO and ISPF editors: the text placed to the right of the searched text must not be moved as much as possible, or partially moved.

  • if the replacement text is shorter than the replaced text: the text on the right must be moved to the left until at least 2 space characters are encountered
  • if the replacement text is longer than the replaced text: the text placed on the right must be moved to the right, keeping at most only one space (deletion of spaces from 2)

See: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.f54em00/ispem60.htm

@FALLAI-Denis FALLAI-Denis changed the title Text replacement should limit column offsets Text replacement should limit column shifting Jun 2, 2020
@FALLAI-Denis FALLAI-Denis changed the title Text replacement should limit column shifting Text replacement should limit text shifting Jun 2, 2020
@phaumer
Copy link
Member

phaumer commented Jun 2, 2020

Thanks. As this would be an update to the existing VS Code behavior I will file it as an enhancement.

@phaumer phaumer added the enhancement New feature or request label Jun 2, 2020
@FALLAI-Denis
Copy link
Author

Thanks. I'm not sure if this feature will ever be implemented in VS Code ...I think it is specific to "formatted" languages, inheritance of "80 columns cards".

@phaumer
Copy link
Member

phaumer commented Jun 2, 2020

I meant more that the VS Code APIs to access anything in the underlying Monaco editor framework is very restrictive. Implementing such capabilities is not straight-forward as the required APIs are not available. Here we were happier when we were working in Eclipse Theia in the past, which allowed us to control much more in the editor directly such as preventing to type beyond a border or adding something like a ruler at the top etc.

To tackle this we want to experiment with Code Formatters in the client as well as have the LSP do more formatting.

@FALLAI-Denis
Copy link
Author

FALLAI-Denis commented Jun 9, 2020

Hi,

I open an issue on VS Code GitHub :
microsoft/vscode#99651

PS: the issue open on VS Code GitHub is waiting for 20 upvote to be move to backlog, otherwise it will be close.
If you agree with it, please vote for.
Thanks.

@phaumer
Copy link
Member

phaumer commented Jun 26, 2020

Thanks for that. I think we will not get those votes as the request is too generic. We want try this by implementing a formatter or via LSP functions directly. If we need any very specific APIs for VS Code for that we will file a specific request for that if needed. However, waiting for such an API and then its implementation in Eclipse Theia/Che is something we probably do not want to wait for.

@FALLAI-Denis
Copy link
Author

Hi
I took a look at the documentation on formatters... They can be triggered when typing on the occurrence of certain characters.
The idea that comes to me would be to call the formatter:

  • when entering a space character to crop the right part of the line text, according to the rules for deleting or maintaining spaces between words as indicated above,
  • when entering a new line character to replace (for Cobol) the "ident" zone (if present) on the previous line in column 73, (continuation character on column 72 for assembler).

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

No branches or pull requests

2 participants