IBM / vscode-ibmi-projectexplorer

IBM i Project Explorer for VS Code
https://ibm.github.io/vscode-ibmi-projectexplorer/
Apache License 2.0
22 stars 7 forks source link

Code for IBMi - direct link to source edit #591

Open cosentino-smeup opened 2 months ago

cosentino-smeup commented 2 months ago

Hello, I have a very peculiar question. I am using OpenVSCode Server.

I would like to invoke the editor of "Code for IBM i" by clicking a button on my application.

My application would redirect to the OpenVSCode web page, in order to edit a member of a source file (eg.TXT, RPGLE..).

I was wondering if it's possible pass some parameter in the url so that I can:

  1. automatically start the connection with my IBMi and create it if does not exists (maybe it's possible when the extension starts on the server via configuration file?)
  2. specify the source file I want to open

Thank you

sebjulliand commented 2 months ago

Hi, I guess the answer would be "yes, it should be possible in the near future". Look at to this Pull Request on the Code for i repository: https://github.com/codefori/vscode-ibmi/pull/2038

cosentino-smeup commented 2 months ago

Hi, I guess the answer would be "yes, it should be possible in the near future". Look at to this Pull Request on the Code for i repository: codefori/vscode-ibmi#2038

That's great @sebjulliand !!! thank you. I will wait for the PR to be accepted.

sebjulliand commented 2 months ago

Funny coincidence: the PR just got validated 🤣

cosentino-smeup commented 2 months ago

@sebjulliand, can I already update the extension "Code for IBM i" in OpenVSCode? Do you know from what version this feature will be available?

cosentino-smeup commented 2 months ago

My OpenVSCode link is:

https://kokoslab.smeup.com:3500/

so, if I got it right, I should should create the following address to use in my button:

https://kokoslab.smeup.com:3500/?host=srvlab01&path=/W_COSANT/SCP_SCH/B£_160_04.UPP

where: srvlab01 = ibmi connection name path = library/src-pf/member

Is it right?

sebjulliand commented 2 months ago

@sebjulliand, can I already update the extension "Code for IBM i" in OpenVSCode? Do you know from what version this feature will be available?

No, the PR has been approved but not merged yet. The next release will presumably contain this enhancement.

Is it right?

Hard to say if it's going to work with OpenVSCode...the correct URL in your case would be vscode://halcyontechltd.code-for-ibmi/open?host=srvlab01&path=/W_COSANT/SCP_SCH/B£_160_04.UPP, as it is a VSCode URL we're looking at. This will send a request to the halcyontechltd.code-for-ibmi extension, to run the open action on host srvlab01 to open file /W_COSANT/SCP_SCH/B£_160_04.UPP. VSCode can catch that URL when clicked in a browser. Whether or not OpenVSCode can handle this kind of URI is beyond me for the moment.

cosentino-smeup commented 2 months ago

Hard_ to say if it's going to work with OpenVSCode...

I'll try as soon as the update will be available

Hard to say if it's going to work with OpenVSCode...the correct URL in your case would be vscode://halcyontechltd.code-for-ibmi/open?host=srvlab01&path=/W_COSANT/SCP_SCH/B£_160_04.UPP,

In case of OpenVSCode, the halcyontechltd.code-for-ibmi extension is on the server "https://kokoslab.smeup.com:3500/ " as shown in the screenshot

open-vs-code

If I use the following link in the browser it's not going to find it:

vscode://halcyontechltd.code-for-ibmi/open?host=srvlab01&path=/W_COSANT/SCP_SCH/B£_160_04.UPP

Is it possible that it should be like this instead?

https://kokoslab.smeup.com:3500/halcyontechltd.code-for-ibmi?host=srvlab01&path=/W_COSANT/SCP_SCH/B%C2%A3_160_04.UPP

Obviously at the moment it's not working in my environment. Maybe you can test it?

sebjulliand commented 2 months ago

You'd better ask on the OpenVSCode repository if it supports vscode:// URL then you'll know for sure 😉