IBM / zopeneditor-about

IBM Z Open Editor: File issues here!
https://ibm.github.io/zopeneditor-about
Apache License 2.0
50 stars 20 forks source link

Truncation on save behaviour and disabling of pl1 language server #411

Closed kraabrsg closed 6 months ago

kraabrsg commented 6 months ago

Development environment used

Problem Description

Installing z open editor (4.1.0) and zowe explorer

Settings in worspace, no file associations in user settings:

    "zopeneditor.zapp.generateZappOnDemand": false,
    "zopeneditor.server.memoryAllocation": 640,
    "zopeneditor.datasets.cobolDatasets": [
      ".COBOL",
      ".COB",
      ".COPYBOOK"
    ],
    "zopeneditor.datasets.jclDatasets": [],
    "zopeneditor.datasets.pl1Datasets": [],
    "zopeneditor.pl1.includeFileExtensions": [],
    "zopeneditor.pl1.disableProblems": true,
    "zopeneditor.userbuild.enabled": false

and opening a *.pli file (where we don't want to use the z open editor).

Observed behavior

We had a "really bad surprise" (conform community guidelines in terms of expression).

Z open editor seems to cut automatically pli files on save, even with the above settings(repeatly). Meaning we had to restore/refactor lost code. We don't understand this bad default behaviour.

Adding this setting zopeneditor.pl1.maximumLineLength to -1

was the first step.

Then calling the command "zlang.stopPl1Lsp" on startup does not seem to work ("Outline View still there"), again frustration.. so ending with this clumsy workaround (is the command to be intended to be called on every "openend document" ???)

        setInterval(() => {
            commands.executeCommand(`zlang.stopPl1Lsp`);
        }, 500);

There are also errors in the "output" section of the Terminal:

[Error - 2:11:09 PM] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
    at Object.dispose (c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2131306)
    at Object.dispose (c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2195143)
    at c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2191739
[Error - 2:11:09 PM] Request textDocument/codeAction failed.
Error: Connection got disposed.
    at Object.dispose (c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2131306)
    at Object.dispose (c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2195143)
    at c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2191739
[Error - 2:11:09 PM] Request textDocument/documentLink failed.
Error: Connection got disposed.
    at Object.dispose (c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2131306)
    at Object.dispose (c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2195143)
    at c:\Users\myuser\.vscode\extensions\ibm.zopeneditor-4.1.0\dist\extension.js:8:2191739

While it might not be a "every day use case" to not use the pl1 language server.

Please consider either 1.) a setting for completely disabling the pl1 language server 2.) a command that can be called once at startup (why on the assumed "openend document")

benjamin-t-santos commented 6 months ago

Hi @kraabrsg I am sorry to hear that PLI line truncation caused you issues.
Before any truncation occurs, a warning message should be displayed. Was this message not displayed before your programs were truncated?



Screenshot 2024-05-21 at 12 19 02 PM

Z Open Editor by default associates certain file extensions with PL/I. This includes the .pli extension. One option is overriding these associations in the VS Code settings. For example, you can change the .pli file extension’s associated language to a different language:

 "files.associations": {
    "*.PLI*": "plaintext"
}

As a result, the PL/I language server will not launch when programs with the .pli extension are opened. This will, however, cause all .pli files to be opened in the VS Code editor as plaintext. So you will not have syntax highlighting for any other Z Open Editor PL/I features.

Z Open Editor attempts to start a language server whenever a COBOL, Rexx, PLI, or HLASM program is opened. This includes even previously stopped language servers. Would you mind sharing your use cases for stopping a language server and keeping it stopped? Is it just related to truncation? That will help us better understand the value of such a feature.

kraabrsg commented 6 months ago

Hi @benjamin-t-santos thanks for getting back to this topic

Was this message not displayed before your programs were truncated?



I saw this once, when it was too late, my colleauge also had the same problem. (maybe because the default settings of the settings are set with "CTRL+S" ???). Truncate as setting should be avoided for PLI IMHO, ideally a linter marks it red underlined at a certain column(depending on the setting).

Would you mind sharing your use cases for stopping a language server and keeping it stopped? Is it just related to truncation? That will help us better understand the value of such a feature.

The main reason is that we have our own pli parser (e.g. because of preprocessor, where is a programm used, hover for plibuiltin keywords to provide description etc.,etc.).

Z Open Editor by default associates certain file extensions with PL/I. This includes the .pli extension. One option is overriding these associations in the VS Code settings

We now changed our id from our own extension, thanks for the information.