go to post Brett Saviano · Jun 16 @Matjaz Murko I just released version 3.0.3 of the vscode-objectscript extension, which contains a fix for this issue.
go to post Brett Saviano · May 28 Try responseData.items.%Get(0).titles.%Get(0).value.%Get("en_US") or responseData.items.%Get(0).titles.%Get(0).value."en_US".
go to post Brett Saviano · May 5 @Juan Mota Sanchez Is your instance set up for minimal security? If so, you need to change the /api/interop-editors web application to allow Password authentication. It's a known issue that the new Interoperability UIs don't support unauthenticated access. This will be fixed in a future version of IRIS.
go to post Brett Saviano · May 1 The next versions of the three extensions (vscode-objectscript, Server Manager and Language Server) will attempt to close their web sessions when VS Code shuts down. This should help avoid sessions stacking up if you restart VS Code often.
go to post Brett Saviano · May 1 Hi @Colin Brough, I'm happy to expand on my previous comments. Yes, this is correct. Exporting a class retrieves whatever is in the system global for that class and builds the text file from it. The serialization happens when the class is imported. That space must be added when the text of the class is converted to the global structure. Therefore, if you manually changed the system global to remove the space it would not show up in the export. NOTE: Please don't actually do that! Yes, this is correct. Any server functions that export code that export code in a specific format (UDL for VS Code and $SYSTEM.OBJ.ExportUDL() for example) use the same code for performing the export. The serialization I mentioned in #1 and on GitHub only happens when importing a class in UDL format (the format used for editing in Studio and VS Code), NOT XML. The space must have been removed when someone modified an XML export file directly and then re-imported it. This won't work for the reason I mentioned in #3. You could use VS Code to do this. Assuming you have a local folder containing your code open in VS Code, you can right-click on the folder and select the Import and Compile option. This will load all the files in the folder onto the server, compile them, and then refresh the local copies.
go to post Brett Saviano · Apr 16 This is deliberate. Mixing client-side editing and server-side editing can lead to lost or overwritten work, so we made it a little harder to do so. You can still add an editable folder by editing the .code-workspace file directly if you are OK with the risks.
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 · Jul 15, 2024 @Jason Jones Our main VS Code extension provides a UI for debugging a REST service. It will prompt for data to create a REST request, makes the request, and attaches the debugger to the IRIS process that handles the request so you can step through the code like any other method.
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.