vscode-ibmi icon indicating copy to clipboard operation
vscode-ibmi copied to clipboard

Page on CL extension in docs

Open worksofliam opened this issue 10 months ago • 14 comments

  • Installation
  • Content assist
  • Command runner

worksofliam avatar Apr 03 '24 21:04 worksofliam

@worksofliam I'll have a look at this and see if I can come up with something. Give me a hint on what "command runner" refers to.

SJLennon avatar Jun 20 '24 14:06 SJLennon

@SJLennon You can open a CL source and press Control/Command+R like you can with SQL.

worksofliam avatar Jun 20 '24 16:06 worksofliam

Been experimenting with CTRL+R. Seems like it won't work if there is any output, e.g. DSPLIBL or SNDUSRMSG aren't acceptable, whereas CRTDTAARA is. Trying to workout the user case for this feature. I've trolled through open and closed issues and it looks like it is primarily for pseudo source, which fits in with CRTDTAARA working.

But...

Ctrl+R works for this:

PGM
    CRTDTAARA DTAARA(LENNONSB/DELETE_ME) TYPE(*CHAR) LEN(20) VALUE('PLEASE DELETE ME') +
     TEXT('DELETE THIS')
ENDPGM

but Ctrl+R doesn't work for this, which is a likely pseudo source use case

PGM
 CRTMSGF    MSGF(LENNONS1/CUSTMSGF) TEXT('Customer +
                          Related Messages')
 ADDMSGD    MSGID(DEM0000) MSGF(LENNONS1/CUSTMSGF) MSG('Press Enter to +
                          update. F12 to Cancel.')
 ENDPGM

image Output: image

Both pieces of code compile with Ctrl+E and execute successfully.

SJLennon avatar Jun 20 '24 20:06 SJLennon

@worksofliam 😕 Working on the documentation, but I'm having trouble figuring out how CL Code assist consistently works.

For example, if I enter just "d" it provides assistance without any action on my part: image

Or if I enter just "s" I also get assistance with no action on my part: image

Though in both these cases the pick list it incomplete. Commands starting with "d" include DCL , DCLF , DCLPRCOPT, DCPOBJ, DEL, DEP, DLCOBJ and more. There are a boatload of commands that start with "s".

If I enter just "dofor" nothing happens.

But if I enter a space after "dofor" and then hit Ctrl+Space I get assistance: image

If I enter "s" and a space and Ctrl+Space I get quite a list, though I don't understand why some of then are provided. For example, why is "WHEN" provided"? And why is "SAV" missing?

image

And if I enter "sa " and Ctrl+Space why doesn't "SAV" show up?

image

Questions:

  1. When are single characters a special case, not needing a space plus Ctrl+Space?
  2. Why does single character assistance provide incomplete results?
  3. Why do some pick lists exclude some commands and/or return seemingly irrelevant results.
  4. Why does CTRL+R fail for the CRTMSGF/ADDMSGD code shown in the previous message?

FWIW: I'm working on PUB400.COM, in case that makes any difference

SJLennon avatar Jun 22 '24 17:06 SJLennon

@SJLennon

I will summarize your questions instead of answering one by one, since I think it will answer swiftly.

In the content assist for CL, you are seeing two types of icons in the list.

  1. A square - these are snippets, not directly provided by the content assist, but are hardcoded snippets defined by the extension. We don't control how these appear - though it seems they are always show, but then filtered and ordered by some kind of fuzzy search.
  2. The abc icon/label - which is an actual suggestion from our extension. We are only showing suggestions for specific commands, which is likely why you are forced to trigger the control assist with your shortcut (Ctrl+Space). I believe we only search after 3 characters have been provided.

For the pseudo source issue: I am going to look at that now.

worksofliam avatar Jun 24 '24 13:06 worksofliam

@worksofliam OK, this is my understanding:

a) The snippets defined in the extension allow partial entry of some commands chosen by the extension developer b) Ctrl+Space provides prompting for the parameters of a command that has been keyed completely, i.e. entering a partial command isn't useful--you need to enter the exact command. (This goes back to the server for the command parameters and defaults. Which is what RDi does.)

It will be interesting to document the nuances of these two situations. Is the intention that more snippeted commands may be added/contributed? (The currently snippet list is interesting: SNDSMTPEMM is something I have never used and I'm not even authorized to on PUB400. Had to Google it 🤕 )

Seems like when I was trying to create screen shots, for the snippets I saw a description turn up of each item in the pick list, e.g. DLTF showed "Delete File". But I'm not seeing that this morning. Is this a VS Code setting that I've somehow flipped?

SJLennon avatar Jun 24 '24 14:06 SJLennon

@worksofliam

For the pseudo source issue: I am going to look at that now

Seems like one line at a time may be executed: image

If you highlight multiple lines you get an error--doesn't know where the first command ends and runs them together: image image

Question: Was the intention that multiple lines could be executed so that it could be used as pseudo source? Seems like I saw such a request from the "bob" project.

Making progress with the rest of the CL documentation.

SJLennon avatar Jun 25 '24 22:06 SJLennon

You need to install the CLLE language tools extension. I have a pull request in to update the documentation but don't know when it will be accepted.

[cid:4086538b-284b-48ba-aac7-126d914e7709]


From: PIO-HimanshuGehlot @.> Sent: Friday, June 28, 2024 7:57 AM To: codefori/vscode-ibmi @.> Cc: SJLennon @.>; Mention @.> Subject: Re: [codefori/vscode-ibmi] Page on CL extension in docs (Issue #1973)

How i can enable the CL content assist? In Setting there is no option to enable it.

— Reply to this email directly, view it on GitHubhttps://github.com/codefori/vscode-ibmi/issues/1973#issuecomment-2196744761, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQC3TEZF4KJSW5IDJQI53QTZJVFRRAVCNFSM6AAAAABFWCMXQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJWG42DINZWGE. You are receiving this because you were mentioned.Message ID: @.***>

SJLennon avatar Jun 28 '24 13:06 SJLennon

Is there any option to enter commands like we used to do on green screen command line? suppose i have created a command that will add 5 libraries into my *libl so how i can issue the same command on VS code?

PIO-HimanshuGehlot avatar Jul 01 '24 11:07 PIO-HimanshuGehlot

@PIO-HimanshuGehlot As far as I know, there is no equivalent of entering a command on the command line or in QCMD.

However, you can execute a CL command by highlighting it and pressing Ctlr+r; image

Output after Ctrl+r: image

SJLennon avatar Jul 01 '24 14:07 SJLennon

@SJLennon thanks for the help. and i want to ask while entering the CL command which key will prompt the parameters that we needed as you can see in below screenshot, i have pressed Ctrl + Space but it is not giving me the parameters that should have for that perticular command?

image

image

PIO-HimanshuGehlot avatar Jul 01 '24 14:07 PIO-HimanshuGehlot

@PIO-HimanshuGehlot It works for me.
image

Not sure why you are having problems.

  • Do other system commands work?
  • You do have a library list set in your connection?

(Bear in mind that I didn't do any of the coding on the extension, I've just contributed some documentation, which has just been updated: https://codefori.github.io/docs/extensions/clle/)

SJLennon avatar Jul 01 '24 15:07 SJLennon

It's weird, i don't know what is the issue exactly. I have two systems, in one of those its working fine. Also I don't have any library set in my connection.

PIO-HimanshuGehlot avatar Jul 01 '24 17:07 PIO-HimanshuGehlot

@PIO-HimanshuGehlot Make an issue in the CL extension repo (IBM/vscode-clle) and we can look into it for you.

worksofliam avatar Jul 01 '24 17:07 worksofliam

Is there any option to enter commands like we used to do on green screen command line? suppose i have created a command that will add 5 libraries into my *libl so how i can issue the same command on VS code?

@PIO-HimanshuGehlot Sorry for the late reply... you can use the Command Profiles in Code for IBM i to run your command and setting the library list via CL commands. HTH.

chrjorgensen avatar Jul 17 '24 09:07 chrjorgensen

Fixed in Docs PR #32

chrjorgensen avatar Jul 17 '24 09:07 chrjorgensen