go to post Brett Saviano · Mar 31 Hi @Dmitrii Baranov, you can use VS Code's multi-root workspace feature to add multiple local folders to a single workspace. There are some great client-side editing enhancements among the features that should be released later this week.
go to post Brett Saviano · Mar 27 The regex Route is the correct way to do this: Class User.REST Extends %CSP.REST { XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ] { <Routes> <Route Url="/(.*)" Method="GET" Call="test" /> </Routes> } ClassMethod test(path As %String) As %Status { Set %response.ContentType = ..#CONTENTTYPETEXT Write path Return $$$OK } }
go to post Brett Saviano · Mar 18 The /api/monitor/alerts endpoint was created to allow for text-based alerts to be consumed by the now-discontinued System Alerting & Monitoring tool. It does not map to any concept related to Prometheus. For more information, see this documentation page.
go to post Brett Saviano · Feb 6 The issue is that I forgot to add the E/e flag to the list of flags for the Color() method, so empty lines were removed from the JSON output. I will edit the accepted answer.
go to post Brett Saviano · Feb 5 @Anna Golitsyna If you goal is to find all globals referenced in a document, you can use a modified version of the code I included in this comment. The code uses the %SyntaxColor class to get a JSON array of semantic tokens for a document, and then loops through them looking for global references. Note that this will only find literal references, not naked references or indirection. ClassMethod WriteAllGrefs() { 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) && #; Global reference (token.s = 18) ) { Write "Gref starting in column ",token.p + 1," of line ",lineNum + 1,! } } } } You can combine this with the %Library.RoutineMgr_StudioOpenDialog query to make an index of all globals referenced in a subset of documents.
go to post Brett Saviano · Jan 13 @Jeffrey Drumm This is caused by a known IRIS bug. The fix is in IRIS 2022.1.4+, 2023.1.2+, and 2023.3+.
go to post Brett Saviano · Aug 26, 2024 Hi @Gramen Tontchev, for non-classes and routines on the local file system the main extension needs to use the file name to determine the name of the document on the server. There's no guarantee that all "other" document types will have the name of the document stored in the text, and even if that were true, it would be very difficult for the extension to know how to extract that info from each one. I have a PR open that will improve the client-side editing workflow, but this behavior remains the same. TL;DR: The name of the file must match the name of the document on the server.
go to post Brett Saviano · Aug 20, 2024 @David Hockenbroch This functionality exists in VS Code. It's provided by the Language Server extension. Here's the description of the feature from that extension's README: To invoke the command, right-click in a blank line of a class definition body and select the Override Class Members row in the menu that appears. The command will insert the selected class member definition(s) at the cursor position where the command was invoked.
go to post Brett Saviano · Aug 15, 2024 VS Code does as well. The Language Server extension provides a formatter that does this, among other features.
go to post Brett Saviano · Aug 15, 2024 @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,! } } } }
go to post Brett Saviano · Aug 2, 2024 @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().
go to post Brett Saviano · Jun 24, 2024 @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.
go to post Brett Saviano · Apr 5, 2024 @Marcel den Ouden I've opened a pull request that fixes your issue. You can download and install the vsix found here to test fix if you'd like.
go to post Brett Saviano · Mar 27, 2024 @Daniel Bertozzi You can do the following: Do ..%SetStatusCode(##class(%CSP.REST).#HTTP401UNAUTHORIZED)
go to post Brett Saviano · Mar 22, 2024 @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.
go to post Brett Saviano · Mar 1, 2024 @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:
go to post Brett Saviano · Feb 9, 2024 Thanks for your feedback! In response, I've submitted Pull Request #1311 which removes the comment-continuation feature for ObjectScript comments (it's still enabled for class description /// comments). It also adds auto-closing of C-style block comments (e.g. typing /* automatically adds */ after the cursor). You can try this out by downloading and installing the latest beta version of the vscode-objectscript extension from GitHub, which can be found here.
go to post Brett Saviano · Feb 1, 2024 @Norman W. Freeman If you upgrade to version 2023.3 or newer, you can use ##class(%RoutineMgr).OutOfDateDocuments() to check all documents in a namespace. You can use the various arguments to filter the documents that are checked (for example, to only check classes).
go to post Brett Saviano · Jan 25, 2024 Hi @Mathew Rimmington, this exact question was asked in a GitHub discussion a few weeks ago. To summarize my answer there, this isn't easy to add because the text that gets added on enter (besides indentation) is static. It acn't be generated from the regular expression used to match the previous line, so I couldn't dynamically add the correct number of dots. My recommendation is to use modern brace syntax instead of legacy dot syntax.
go to post Brett Saviano · Jan 19, 2024 @Joseph Griffen ZWrite is going to output the internal format of the %Status value, which isn't that easy to parse visually. $SYSTEM.Status.DisplayError() will output the status text to the current device in a more readable format. USER>Write ##class(%Atelier.v1.Utils.General).ValidateDocName("project.prj",.sc) 0 USER>ZWrite sc sc="0 "_$lb($lb(16006,"project.prj",,,,,,,,$lb(,"USER",$lb("e^ValidateDocName+33^%apiSRC^2","e^ValidateDocName+1^%Atelier.v1.Utils.General.1^1","e^^^0"))))/* ERROR #16006: Document 'project.prj' name is invalid [ValidateDocName+33^%apiSRC:USER] */ USER>Do $SYSTEM.Status.DisplayError(sc) ERROR #16006: Document 'project.prj' name is invalid [ValidateDocName+33^%apiSRC:USER] If you need to store the status text in a variable you can use $SYSTEM.Status.GetErrorText().