Brett Saviano · Jan 18, 2024 go to post

Sorry, I see that now! Have you checked your server connection information and made sure you have the correct host, port username and password?

Brett Saviano · Jan 17, 2024 go to post

I just created a code-workspace file using your example above and I couldn't reproduce this is it possible that there's a .vscode/settings.json inside the "." folder that contains different objectscript.export settings? If so, those will take precedence. Folder-specific settings take precedence over workspace-specific settings, and workspace-specific take precdence over user-specific.

Brett Saviano · Jan 17, 2024 go to post

The "Export Project Contents" command that you clicked is for exporting as individual UDL files in your workspace for editing with local source control. To export server documents in a single XML file, you an use the "Export Documents to XML File..." command that's documented here.

Brett Saviano · Jan 17, 2024 go to post

@Pietro Di Leo 
When you say "export a project", what do you mean by that? Do you mean "export the documents in the project to edit them", or "export the contents as a single legacy XML file for deployment/sharing"?

Brett Saviano · Jan 17, 2024 go to post

@Mathew Rimmington 
I think I've made the fix. You can download a version of the Language Server extension with the fix here. To install it, simply drag the .vsix file into the extensions view in VS Code. It will prompt you to reload so the new version of the extension can be activated. Be sure you download the correct version for your platform and please let me know if your issue is resolved. I plan on releasing a new Language Server version very soon and I'd like this fix to be in it!

Brett Saviano · Jan 17, 2024 go to post

@Mathew Rimmington 
Sorry, I misread the prompt in the screenshot. Can you open the settings.json file that contains the server definition that you're having trouble with and send me that? I'd like to confirm that it has "UnknownUser" as the username and not no username. If so, I can modify the Language Server to handle that case better.

I know what's happening now. You're creating the server definition with no username, and when the server manager extension tries to use it, it assumes that you wanted to store your credentials securely, so it gives you this prompt. When you leave it blank, it inserts "UnknownUser" with no password as your credentials. The Language Server extension needs to handle that case. I will make the fix.

Brett Saviano · Dec 27, 2023 go to post

Hi @Pietro Di Leo, my post on features unique to the VS Code WebSocket Terminal is now live and can be viewed here. I think it's a nice addendum to your very informative article!
 

Brett Saviano · Dec 18, 2023 go to post

@Rodrigo Werneck 
I recommend you use an intermediary stream to avoid <MAXSTRING> errors with large JSON objects:

ClassMethod DuplicateDAO(dao As %DynamicAbstractObject) As %DynamicAbstractObject
{
    Set strm = ##class(%Stream.TmpCharacter).%New()
    Do dao.%ToJSON(strm)
    Return ##class(%DynamicAbstractObject).%FromJSON(strm)
}
Brett Saviano · Dec 15, 2023 go to post

@Stephane Devin 
Here's a pretty-printed version of the attributes list for JavaScript:

Attribute 0: Error
Attribute 1: White Space
Attribute 2: _Tab
Attribute 3: Label
Attribute 4: Delimiter
Attribute 5: String
Attribute 6: Comment
Attribute 7: Decimal integer
Attribute 8: Hexadecimal integer
Attribute 9: Floating point number
Attribute 10: Regexp delimiter
Attribute 11: Regexp body
Attribute 12: Regexp escape sequence
Attribute 13: Regexp flags
Attribute 14: Identifier
Attribute 15: Operator
Attribute 16: Definition keyword
Attribute 17: Statement keyword
Attribute 18: Literal keyword
Attribute 19: Expression keyword
Attribute 20: Future keyword
Attribute 21: CSP extension
Attribute 22: JSON property name

Brett Saviano · Dec 14, 2023 go to post

@Stephane Devin 
You can use %SyntaxColor to parse JavaScript. Here's a very simple example that reads in a JS file, parses it, and returns a JSON representation of the semantic tokens:

ClassMethod JSTokens() As %Boolean
{
    #; Reading from a file, writing to a temporary stream
    Set syn = ##class(%SyntaxColor).%New(), in = ##class(%Stream.FileCharacter).%New(), out = ##class(%Stream.TmpCharacter).%New()
    #; Need the "K" flag to get JSON output
    Do in.LinkToFile("/Users/bsaviano/Desktop/test.js"), syn.Color(in,out,"JS","K")
    #; Get a %DynamicArray from the stream
    Set tokens = ##class(%DynamicArray).%FromJSON(out)
    #; Process JSON ...
    #; JSON is of the format:
    #; { 
    #;     // The position of the token within the line
    #;     p: number;
    #;     // The length of the token
    #;     c: number; 
    #;     // Language number, see %SyntaxColor::Languages()
    #;     l: number; 
    #;     // Attribute number, see %SyntaxColor::Attributes()
    #;     s: number; 
    #; }[][]
    #; Where there is one array per line of the source document
}

I suggest you study the class reference for %Library.SyntaxColor since it's not that easy to use.

Brett Saviano · Nov 16, 2023 go to post

Great post @Pietro Di Leo! For those interested in the features unique to the WebSocket Terminal, I will publish an article on this topic soon. Stay tuned!

Brett Saviano · Nov 2, 2023 go to post

@Nicki Vallentgoed 
There isn't a way to check if a file is out of date without saving it. I think the best change you could make to your workflow would be using a private server instead of a shared server. Since you're working with local files, you shouldn't care about the server version since it's not the source of truth. If you used your own private development server you could turn off the version checking logic and let your source control system handle differences.

Brett Saviano · Sep 12, 2023 go to post

@Pravin Barton 
If you want to only search a single folder, you can right-click on it in the explorer and select "Find in Folder...". VS Code will show the search view and auto-populate the "files to include" text box.

Brett Saviano · Sep 5, 2023 go to post

@Marcel den Ouden 
The VS Code extension uses your objectscript.export settings to determine what the name of the file should be from its URI. It assumes that if you're working in a client-side folder you will have those settings properly configured for how your classes are stored in the local folder (since they are needed to export classes). I don't know how the full path could be used for the file name so that is probably a bug.

Brett Saviano · Jul 26, 2023 go to post

@Kevin Kindschuh 
The VS Code Integrated Terminal is an OS shell, so if you want to open an IRIS terminal you need to use a command like "iris terminal <instance>". If that instance is on another machine, you'll have to use SSH. Starting with IRIS 2023.2, VS Code supports a WebSocket-based terminal so that you can launch a terminal on a remote server without needing SSH. The WebSocket terminal is not a full terminal though.

Brett Saviano · Jul 13, 2023 go to post

@Sam Duncan Here's a simple method to export subclasses. It exports all of the classes in a single XML file and prints that to the console. You can easily modify that behavior by changing the $SYSTEM.OBJ.Export() line to whatever export strategy you want.

ClassMethod ExportSubclasses(pSuper As %String) As %Status
{
  #Dim tSC As %Status = $$$OK
  #Dim tEx As %Exception.AbstractException
  #Dim tPc As %ProcedureContext
  #Dim tRs As %SQL.ClassQueryResultSet
  Try {
    #; Build a subscripted array of subclasses
    Set tStmt = ##class(%SQL.Statement).%New()
    Set tSC = tStmt.%PrepareClassQuery("%Dictionary.ClassDefinitionQuery","SubclassOf")
    If $$$ISERR(tSC) Quit
    Set tPc = tStmt.%Execute(pSuper)
    If tPc.%SQLCODE < 0 {
      Throw ##class(%Exception.SQL).CreateFromSQLCODE(tPc.%SQLCODE,tPc.%Message)
    }
    Set tRs = tPc.%NextResult()
    While tRs.%Next(.tSC) {
      Set tSubclasses(tRs.%GetData(1)_".CLS") = ""
    }
    If $$$ISOK(tSC), $DATA(tSubclasses) = 10 {
      #; Export the subclasses
      Set tSC = $SYSTEM.OBJ.Export(.tSubclasses,,"/nodisplay")
    }
  } Catch tEx {
    Set tSC = tEx.AsStatus()
  }
  Quit tSC
}
Brett Saviano · Jun 16, 2023 go to post

Hi @Scott Roth, when 2023.2 is released VS Code will support an integrated WebSocket-based terminal that's implemented as a new Atelier API endpoint. It will be available in kits by default and the vscode-objectscript. It's documented here and the newest beta version of the vscode-objectscript extension and 2023.2 previews have the needed code.

Brett Saviano · Jun 15, 2023 go to post

InterSystems is working on adding support for XML import/export in the Atelier API with integration in the VS Code UI via commands. I will post the PR here when it's opened and a suitable kit is publicly available.

Brett Saviano · May 17, 2023 go to post

Hi @Josef Zvonicek, I'm glad that VS Code is making you more productive, and thanks for the feedback. I have some comments about your fine-tuning list:

  1. The "override class members" functionality is implemented by the Language Server extension. If you file an issue on its GitHub repository I would be happy to consider this enhancement request.
  2. The VS Code integrated terminal is part of the core product, and not our extensions, so I'm not sure we can do anything about this. Can you provide more details about how you started the terminal and the expected vs actual behavior?
  3. Newer versions of the vscode-objectscript extension should avoid opening that extra copy of the file when debugging. If you're using  recent version like 2.8.0 or 2.8.1 and this isn't working, please file a GitHub issue in that extension's repository and I will take a look at it.
  4. The debug console can only evaluate expressions. It's not a full terminal and cannot execute commands, so this isn't possible unfortunately.
  5. I'm not sure what a GIT disk is. Are you editing files on your local file system?
  6. Can you describe what doesn't work well, and what we could do to make things better?
  7. There is a command called "Open Error Location..." that you can execute from the command palette. It prompts you to enter a "label+offset^routine" string and then opens that location. It only works for INT routines though.
     
Brett Saviano · May 16, 2023 go to post

@Anna Golitsyna 
I think the debugging experience in VS Code is actually better than Studio since you can view the properties of OREF's in the variables view in VS Code but not Studio. You can have that developer file an issue report on GitHub, or contact the WRC if you have a support contract.

As for features in Studio but not VS Code, the biggest one is the Inspector. It is very unlikely that it will ever be implemented in VS Code. VS Code also does not support integration with the legacy Zen BPL and DTL editors. VS Code will support integration with the new Angular versions of those editors when they are implemented. VS Code also doesn't support syntax coloring for Cache Basic or MultiValue Basic, but you can still edit those files.

Brett Saviano · May 16, 2023 go to post

@Anna Golitsyna 
The big plus is that VS Code is in active development, while Studio hasn't seen enhancements in years and now is deprecated. Other than that, here are some benefits of VS Code:

  • Supports Mac, Linux and Alpine Linux in addition to Windows.
  • Much faster release cycles so you get new features and fixes faster.
  • Always forward compatible without needing to install a new version.
  • Much better intellisense support. (a large list of features can be found here)
  • Modern UI with fully customizable themes.
  • Can be connected to multiple server-namespaces in the same window.
  • Debugging supports expanding OREF's to see their properties.