Brett Saviano · Aug 15, 2024 go to post

@Igor Barboza 
You can use %Library.SyntaxColor to parse ObjectScript. Here's some code to get you started:

ClassMethod WriteAllCommands()
{
    Set syn = ##class(%SyntaxColor).%New(), in = ##class(%Stream.TmpCharacter).%New(), out = ##class(%Stream.TmpCharacter).%New()
    #; TODO Put your document's contents into "in"
    Do syn.Color(in,out,"COS" /* or "INT" or "CLS" */,"KE" /* K means JSON output, E means keep empty lines */)
    #; Format of the JSON output:
    #; [
    #;     #; One array for each source line
    #;     [
    #;         {
    #;             #; Language of the token. See Languages() in %Library.SyntaxColor.
    #;             "l": %Integer,
    #;             #; Attribute of the token. See Attributes() in %Library.SyntaxColor.
    #;             "s": %Integer,
    #;             #; Zero-indexed start position of the token on the line
    #;             "p": %Integer,
    #;             #; Length of the token in characters
    #;             "c": %Integer
    #;         }
    #;     ]
    #; ]
    Set json = ##class(%DynamicArray).%FromJSON(out), lineIter = json.%GetIterator()
    While lineIter.%GetNext(.lineNum,.lineTokens) {
        Set tokensIter = lineTokens.%GetIterator()
        While tokensIter.%GetNext(,.token) {
            If (
                #; COS
                (token.l = 1) && (
                    #; Command
                    (token.s = 32) ||
                    #; User-defined Z command 
                    (token.s = 52)
                )
            ) {
                Write "Command starting in column ",token.p + 1," of line ",lineNum + 1,!
            }
        }
    }
}
Brett Saviano · Aug 2, 2024 go to post

@Mary George 
There are two ways you could do this:

  • Create a multi-root VS Code workspace with a folder for each namespace and use the search UI to search all folders.
  • Write a method that calls the %SYS.Namespace List query to list all namespaces, then enter each one and call ##class(%Studio.Project).FindInFiles().
Brett Saviano · Jul 31, 2024 go to post

@David Marinkovic 
VS Code uses REST to connect to IRIS. If you're using a version without the private web server, you need to configure an external web server. This is needed for the management portal as well. Since you're on Windows, your installer probably configured IIS to serve web applications for IRIS. Documentation can be found here.

Brett Saviano · Jul 18, 2024 go to post

@Stefan Cronje 
You can open the classes in VS Code and and it will notify you when you use deprecated classes or methods. There isn't a programmatic way to get that information (for example, by calling a ClassMethod) but it would be possible to write one using %SyntaxColor.

Brett Saviano · Jun 27, 2024 go to post

@Kwabena Ayim-Aboagye No, there hasn't. Even if we had formatting for your specific example, the extra newlines would be erased when the document gets saved on the server. The only code in class definitions that's preserved as-is is implementation code enclosed in curly braces. The rest is stored in a global and regenerated from the global after a save.

Brett Saviano · Jun 25, 2024 go to post

@Yone Moreno 
Did you try $ZSTRIP with the following arguments?

Set string = $ZSTRIP(string,"<>",$CHAR(13,10))

$ZSTRIP without a mask code in the second argument and with specific characters as the third argument will strip just those specific characters.

Brett Saviano · Jun 24, 2024 go to post

@David Cui 
I can confirm that IRIS versions 2023.1.5, 2024.1.1 and 2024.2 will support this feature. It has not been released in the 2024.2 preview stream yet though, which is why the GitHub Pull Request that implements the VS Code-side work hasn't been merged.

Brett Saviano · Jun 24, 2024 go to post

@Alin Soare You can't prevent that. The actual text of the class isn't stored in the database. During a save, it gets converted to a global that gets stored in the database, and then converted back into text. The class's text is always regenerated in "canonical" form, with excess spaces removed, capitalization normalized etc. This process doesn't affect method/query implementation code though, it's purely cosmetic.

Brett Saviano · Jun 20, 2024 go to post

I'm not familiar with all of the Zen specific methods in that class. For working with JSON outside the Zen framework though (for example, in REST APIs), new code should use Dynamic Objects.

Brett Saviano · Jun 20, 2024 go to post

@Alin Soare 
What "auto-formatting" are you referring to? Can you provide before and after screenshots showing what gets changed on save?

Brett Saviano · May 15, 2024 go to post

@Lukas Dolezal 
VS Code's View Other command supports jumping to the same line in the INT routine, but that support requires an InterSystems server with Atelier API version 4 or above (Cache 2018.1.6+, IRIS 2019.1.2+, 2020.1.1+, 2021.1+). If you're not using one of those versions then the location mapping won't work.

Brett Saviano · May 9, 2024 go to post

An important detail about the independent Studio is that it is installed in its own directory, so it won't be uninstalled when you upgrade/add/remove IRIS instances on your system. Also, since the 2024.1 Studio is forward-compatible, you won't need to update it every time a new IRIS version is released.

Brett Saviano · Apr 9, 2024 go to post

You can use your second example above, then copy the content into a new %Stream.GlobalBinary:

Do strm.Rewind()
Set o = {}, o.strm = strm, strm2 = o.%Get("strm",,"stream>base64")
Set strm3 = ##class(%Stream.GlobalBinary).%New()
Do strm3.CopyFrom(strm2)
Brett Saviano · Mar 22, 2024 go to post

@Richard Rayburn 
There isn't an equivalent to the Inspector's Storage editor in VS Code yet. That's on our roadmap but we don't have an ETA for it yet due to design challenges. You will have to edit the Storage block directly in the class's text. There is hover documentation and code completion support for Storage blocks in VS Code, which Studio did not have:

I hope you find this helpful.

Brett Saviano · Mar 1, 2024 go to post

@Kevin Kindschuh 
If you're using client-side editing (files on your local file system controlled by GIT directly), you can export HL7 schemas from the InterSystems Explorer view. They will be in the "Other" section:

Brett Saviano · Mar 1, 2024 go to post

Since this issue can't be reproduced by you on another server, or by me with a fresh install of your adhoc, I think it's highly unlikely that there's a product defect. I think this is an issue with that specific instance only. The WRC should be able to help you investigate this further.

Brett Saviano · Feb 29, 2024 go to post

I tried to reproduce your issue with your exact server version and I couldn't get the error to occur. Do you remember when this started happening? Does debugging work when you connect to other instances?

Brett Saviano · Feb 26, 2024 go to post

Yes, that is very helpful. The <COMMAND> error is coming from a line that calls "Do <debug_target>", which in this case is "##class(prosthetic.ProstheticResourceTest).RunTests()". Does running "Set a = "##class(prosthetic.ProstheticResourceTest).RunTests()" Do @a" work from the terminal in that namespace or do you see the same <COMMAND>?

Brett Saviano · Feb 21, 2024 go to post

@Evan Gabhart 
No, you can't import .rtn files and we have no plans to add that. Other than the SMP, you can use the VS Code integrated terminal to open an IRS terminal, or the WebSocket Terminal to import the .rtn files. I would recommend using a different format for your exports though, like XML or UDL.

Brett Saviano · Feb 9, 2024 go to post

Thanks for the screenshots. I've never seen that happen before. I just booted up my windows machine and tried to reproduce that behavior but couldn't. If you delete the src/index.csp file and then save src/goerke/index.csp, does src/index.csp re-appear? Do you see any errors or messages in the ObjectScript Output channel?

Brett Saviano · Feb 9, 2024 go to post

I'm not sure what you mean by "it recreates the file in the root directory of the namespace". Can you post a screenshot? Also, can you describe in more detail what you're trying to test? We will be able to give better advice with more context.

Brett Saviano · Feb 9, 2024 go to post

@Daniel Goerke 
What learning course/training steps are you following? Do you mean to be creating CSP files? CSP files need to be stored inside a web application so they can be served by the web server. They can't be created as standalone files without that context. Therefore, you need to have the CSP file in folders that tell VS Code what web application it goes it. For example, if you want to create mypage.csp in web application /csp/user, the path to the file inside your local workspace should be something like src/csp/user/mypage.csp. You may also find it easier to edit web application files directly on your IRIS server using server-side editing.