Running ObjectScript classmethod in VSCode Terminal in One Click
Hi Devs!
For me, one of the most painful things about ObjectScript is ##class(Class).Method() typing to call a class method in code or in a terminal. I even submitted an idea to simplify it in ObjectScript.
But! There is a new feature in VSCode ObjectScript that was just introduced to the plugin - Copy Invocation!
Just hover Copy Invocation link above every classmethod in a code, click on it and the invocation is copied to the buffer:
Paste it anywhere you want it to execute!
USER>w ##class(dc.sample.ObjectScript).Test()
Bazinga!
Here is the video that shows how it works.
Many thanks to the VSCode contributors!
Happy coding!
Nicely done. while I haven't contributed to the project I do have a User Snippet
"Create Status Method": { "prefix": "Method Create ClassMethod Returning %Status", "body": [ "///${1:Description}", "///<example>", "/// Set tSC=##class($TM_FILENAME_BASE).${2:MethodName}()", "///</example>", "ClassMethod ${2:MethodName}(${3:parameters}) As %Status", " {", " #dim tSC \t\t\t As %Status=\\$\\$\\$OK", " #dim eException \t As %Exception.AbstractException", " try {", " $0", " }", " catch eException {", " Set tSC=eException.AsStatus()", " }", " Quit tSC", " }" ], "description": "Method Create ClassMethod Returning %Status" }
that utilizes the <example> Documatic special tag as I too was tired typing the ##class when testing methods. My approach is different and it's not perfect but it works for me. It also produces a class method with a consistent pattern/structure.
Thanks for sharing the snippet, @Stephen Canzano !
@John Murray , @Dmitry Maslennikov , @Brett Saviano - do we have an idea how we could collect such snippets to be chosen and described? An additional repo? A tag?
I know that there was the idea-a-thon with the idea amongst the winning contributions, but what will we do?
Nice! And when there are parameters, how does it works?
No magic here) BYOP - which means bring your own parameters)
This is why I like Studio, right click and you're good to go :)
What do you mean, what do you have by right click?
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue