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

Add "Run Method in Terminal" feature

Open evshvarov opened this issue 2 years ago • 25 comments

There is a handy "Debug this method" feature above every class method. Could we also add "Run Method in Terminal" or similar to copy the line suitable to execute classmethod in Terminal?

E.g. if the method is " Class Foo { classmethod Bar () As %Status { }

The function will copy the following: w ##class(Foo).Bar()

evshvarov avatar Aug 18 '22 06:08 evshvarov

@evshvarov I don't think this is worth doing. If a user sees "Run this method", they will expect the method to actually be run when they click the button, not have something copied to the clipboard. If you want to run a method and see any console output, you can just click "Debug this method" without any breakpoints and see the output in the Debug Console

isc-bsaviano avatar Aug 18 '22 13:08 isc-bsaviano

Maybe I described it not clear, this copy classmethod feature will save thousands of hours to developers helping call the method in terminal

evshvarov avatar Aug 18 '22 14:08 evshvarov

@gjsjohnmurray @daimor Do either of you have a strong opinion about this request?

isc-bsaviano avatar Aug 23 '22 14:08 isc-bsaviano

@evshvarov I don't think this is worth doing. If a user sees "Run this method", they will expect the method to actually be run when they click the button, not have something copied to the clipboard. If you want to run a method and see any console output, you can just click "Debug this method" without any breakpoints and see the output in the Debug Console

There are many reasons, why I would like to have this feature. When actively working on some projects, it's faster to run it in terminal, but unfortunately the syntax for the command is so stupid, so, I have to print do ##class copy classname from the top of the class, past it in terminal, then copy classmethod and past it again, too many actions. Debugger is too slow, and may not work as I need, and most developers prefer the way they can control is to run it in terminal.

daimor avatar Aug 29 '22 14:08 daimor

Calling this feature "run this method" is confusing. It doesn't actually run anything. A user is going to click this, see that nothing happened, and report a bug or become frustrated.

isc-bsaviano avatar Aug 29 '22 14:08 isc-bsaviano

Offer another name, which will be quite short

daimor avatar Aug 29 '22 14:08 daimor

Copy Invocation Command to Clipboard or Copy Invocation to Clipboard are much clearer IMO

isc-bsaviano avatar Aug 29 '22 14:08 isc-bsaviano

Pass Invocation to Terminal ?

daimor avatar Aug 29 '22 14:08 daimor

No clipboard, actually at this moment, just inserts to active terminal

daimor avatar Aug 29 '22 14:08 daimor

No, it doesn’t do that, it doesn’t pass anything to the terminal. I’ll support ‘copy invocation to clipboard’ because that is what it does.

From: Dmitry Maslennikov @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 10:37 AM To: intersystems-community/vscode-objectscript @.> Cc: Subscribed @.> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

Pass Invocation Command to Terminal ?

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230402139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMBJVBDVMIDEWV76VH3IGETV3TDLPANCNFSM564A23DA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

isc-jamien avatar Aug 29 '22 14:08 isc-jamien

Inserting directly into the terminal is too dangerous, what with people clicking around, anything could happen.

From: Dmitry Maslennikov @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 10:38 AM To: intersystems-community/vscode-objectscript @.> Cc: Subscribed @.> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

No clipboard, actually at this moment, just inserts to active terminal

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230403229, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMBJVBBW2RUTO7ZKNR45Q4TV3TDPDANCNFSM564A23DA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

isc-jamien avatar Aug 29 '22 14:08 isc-jamien

It’s a developer environment- what dangerous could be there?

Let’s name it “Run in a terminal” ?

On Mon, 29 Aug 2022 at 18:40, isc-jamien @.***> wrote:

Inserting directly into the terminal is too dangerous, what with people clicking around, anything could happen.

From: Dmitry Maslennikov @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 10:38 AM To: intersystems-community/vscode-objectscript @.> Cc: Subscribed @.> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

No clipboard, actually at this moment, just inserts to active terminal

— Reply to this email directly, view it on GitHub< https://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230403229>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AMBJVBBW2RUTO7ZKNR45Q4TV3TDPDANCNFSM564A23DA>.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230405600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVHEP7OWOSGM4A7BWHINUDV3TDW5ANCNFSM564A23DA . You are receiving this because you were mentioned.Message ID: @.*** com>

evshvarov avatar Aug 29 '22 14:08 evshvarov

What are you talking about, VSCode can be connected to any instance in any namespace. Respectfully I don’t think you are thinking this through. I won’t approve it as it stands.

From: Evgeny Shvarov @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 10:43 AM To: intersystems-community/vscode-objectscript @.> Cc: Jamie Newton @.>, Comment @.***> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

It’s a developer environment- what dangerous could be there?

Let’s name it “Run in a terminal” ?

On Mon, 29 Aug 2022 at 18:40, isc-jamien @.***> wrote:

Inserting directly into the terminal is too dangerous, what with people clicking around, anything could happen.

From: Dmitry Maslennikov @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 10:38 AM To: intersystems-community/vscode-objectscript @.> Cc: Subscribed @.> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

No clipboard, actually at this moment, just inserts to active terminal

— Reply to this email directly, view it on GitHub< https://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230403229>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AMBJVBBW2RUTO7ZKNR45Q4TV3TDPDANCNFSM564A23DA>.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230405600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVHEP7OWOSGM4A7BWHINUDV3TDW5ANCNFSM564A23DA . You are receiving this because you were mentioned.Message ID: @.*** com>

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230408637, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMBJVBG267KCIC7I5PWO7BDV3TEBHANCNFSM564A23DA. You are receiving this because you commented.Message ID: @.***>

isc-jamien avatar Aug 29 '22 14:08 isc-jamien

Why would it insert the text into the active terminal? There's no guarantee that it's an IRIS terminal. What if the terminal is a separate window, like on windows? Or not in vscode's integrated terminal? In those cases copying to the clipboard is preferable and the user has to actually paste it somewhere so they can't run anything by accidentally pressing enter after the copy is done.

isc-bsaviano avatar Aug 29 '22 14:08 isc-bsaviano

Anyway I’d prefer to have “Copy to clipboard” somewhere too or instead if possible

On Mon, 29 Aug 2022 at 18:43, Евгений Шваров @.***> wrote:

It’s a developer environment- what dangerous could be there?

Let’s name it “Run in a terminal” ?

On Mon, 29 Aug 2022 at 18:40, isc-jamien @.***> wrote:

Inserting directly into the terminal is too dangerous, what with people clicking around, anything could happen.

From: Dmitry Maslennikov @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 10:38 AM To: intersystems-community/vscode-objectscript @.> Cc: Subscribed @.> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

No clipboard, actually at this moment, just inserts to active terminal

— Reply to this email directly, view it on GitHub< https://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230403229>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AMBJVBBW2RUTO7ZKNR45Q4TV3TDPDANCNFSM564A23DA>.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230405600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVHEP7OWOSGM4A7BWHINUDV3TDW5ANCNFSM564A23DA . You are receiving this because you were mentioned.Message ID: @.*** com>

evshvarov avatar Aug 29 '22 14:08 evshvarov

Changed to clipboard

daimor avatar Aug 29 '22 15:08 daimor

So it’s this now?

Copy Invocation Command to Clipboard

On Aug 29, 2022, at 11:08 AM, Dmitry Maslennikov @.@.>> wrote:

Changed to clipboard

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230447610, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DNNN3TX4XW4FWROOB3CTV3TG77ANCNFSM564A23DA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

isc-solon avatar Aug 29 '22 15:08 isc-solon

https://github.com/intersystems-community/vscode-objectscript/blob/3c76b3c86824bd99a2ff9f9dfc109cbbb9a9c47b/src/providers/ObjectScriptCodeLensProvider.ts#L110

daimor avatar Aug 29 '22 15:08 daimor

Does anyone prefer this: "Copy ObjectScript invocation to clipboard"

And if [language = python]: "Copy Python invocation to clipboard"

…and the proper invocation is copied in each case?

On Aug 29, 2022, at 11:14 AM, Dmitry Maslennikov @.@.>> wrote:

https://github.com/intersystems-community/vscode-objectscript/blob/3c76b3c86824bd99a2ff9f9dfc109cbbb9a9c47b/src/providers/ObjectScriptCodeLensProvider.ts#L110

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230458150, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DNNNHNJ5I4MN2UE2JR53V3THVRANCNFSM564A23DA. You are receiving this because you commented.Message ID: @.***>

isc-solon avatar Aug 29 '22 15:08 isc-solon

Different behavior for python makes no sense, since the call exactly the same

daimor avatar Aug 29 '22 15:08 daimor

It also should take into account if the method returns a value

From: Joel Solon @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 11:26 AM To: intersystems-community/vscode-objectscript @.> Cc: Jamie Newton @.>, Comment @.***> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

Does anyone prefer this: "Copy ObjectScript invocation to clipboard"

And if [language = python]: "Copy Python invocation to clipboard"

…and the proper invocation is copied in each case?

On Aug 29, 2022, at 11:14 AM, Dmitry Maslennikov @.@.>> wrote:

https://github.com/intersystems-community/vscode-objectscript/blob/3c76b3c86824bd99a2ff9f9dfc109cbbb9a9c47b/src/providers/ObjectScriptCodeLensProvider.ts#L110

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230458150, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DNNNHNJ5I4MN2UE2JR53V3THVRANCNFSM564A23DA. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230472705, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMBJVBA4DLX256SFSR4TT7TV3TJA3ANCNFSM564A23DA. You are receiving this because you commented.Message ID: @.***>

isc-jamien avatar Aug 29 '22 15:08 isc-jamien

It also should take into account if the method returns a value

No difference at all

daimor avatar Aug 29 '22 15:08 daimor

Python invocation would work in Python shell (iris.cls) ObjectScript invocation would work in ObjectScript shell (##class)

On Aug 29, 2022, at 11:27 AM, Dmitry Maslennikov @.@.>> wrote:

Different behavior for python makes no sense, since the call exactly the same

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230474768, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DNNK2ANXFZ42QRK7L4JTV3TJHFANCNFSM564A23DA. You are receiving this because you commented.Message ID: @.***>

isc-solon avatar Aug 29 '22 15:08 isc-solon

Python invocation would work in Python shell (iris.cls) ObjectScript invocation would work in ObjectScript shell (##class)

Nope, language = python does not change it In python shell, supposed to work any method in any language

daimor avatar Aug 29 '22 15:08 daimor

Copy ObjectScript invocation to clipboard

How about simply Copy invocation? I think the "to clipboard" part is what people expect a copy command to do, unless some other behavior is specified.

isc-rsingh avatar Aug 29 '22 19:08 isc-rsingh

Good day! What about a feature? Already want to use it!

evshvarov avatar Sep 07 '22 10:09 evshvarov

Copy ObjectScript invocation to clipboard

How about simply Copy invocation? I think the "to clipboard" part is what people expect a copy command to do, unless some other behavior is specified.

Like it. Or Copy this method - pair to Debug this method

evshvarov avatar Sep 07 '22 10:09 evshvarov

Good day! What about a feature? Already want to use it!

Download archive with VSIX file, extract and install manually in VSCode with dedicated command https://github.com/intersystems-community/vscode-objectscript/suites/8192958499/artifacts/356594965

daimor avatar Sep 08 '22 11:09 daimor

I don’t understand…

USER>write ##class(%PopulateUtils).Mission()

print(iris.cls(‘%PopulateUtils’).Mission())

On Aug 29, 2022, at 11:37 AM, Dmitry Maslennikov @.@.>> wrote:

Python invocation would work in Python shell (iris.cls) ObjectScript invocation would work in ObjectScript shell (##class) Nope, language = python does not change it In python shell, supposed to work any method in any language

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230486065, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DNNI7GPJ7Y4T5SLZCNGTV3TKKTANCNFSM564A23DA. You are receiving this because you commented.Message ID: @.***>

isc-solon avatar Oct 11 '22 07:10 isc-solon

What do you mean.? If it returns a value the invocation should retrieve the value else it get’s lost

From: Dmitry Maslennikov @.> Reply-To: intersystems-community/vscode-objectscript @.> Date: Monday, August 29, 2022 at 11:32 AM To: intersystems-community/vscode-objectscript @.> Cc: Jamie Newton @.>, Comment @.***> Subject: Re: [intersystems-community/vscode-objectscript] Add "Run Method in Terminal" feature (Issue #974)

It also should take into account if the method returns a value

No difference at all

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/974#issuecomment-1230479919, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMBJVBCORMUZQQNWUDHZTZDV3TJXBANCNFSM564A23DA. You are receiving this because you commented.Message ID: @.***>

isc-jamien avatar Oct 11 '22 08:10 isc-jamien