New post

Pesquisar

Article
· Oct 1, 2024 2m read

Improved code completion for object reference variables in VS Code ObjectScript

On 2024-08-29, the team released Language Server v2.6.0, which includes more improvements for code completion (aka intellisense). That means that #dim, while still useful, is hardly necessary anymore. That's a good thing in my opinion.

This post from last year (Intellisense and code completion in VS code objectscript) talked about using #dim for code completion for OREFs. #dim has always been useful for both Studio and VS Code. But last year, VS Code ObjectScript was slightly behind Studio in this area, and #dim helped bridge that gap. But now, VS Code has surpassed Studio. There is automatic code completion for the following variables shown in bold:

  • Variables created using %New() or %OpenId(). set per = ##class(Sample.Person).%New()
  • Variables as arguments of a method. Method M1(per as Sample.Person)
  • Variables returned by a method. set rs = ##class(SQL.Statement).ExecDirect(args)
  • Variables created using a reference property. set owner = account.Owner
  • Variables for %DynamicObject and %DynamicArray. set obj = {}, arr = []
  • UPDATE 10/2/2024: %Variables that are OREFs that are provided as part of the context for a method. Examples: %sqlcontext in a class method that uses [SqlProc], %code in a generator method, %session in certain methods called from web applications. 

So #dim is no longer necessary for those cases. I can think of a couple of one remaining case where #dim is helpful.

The case below is now handled by an enhancement (fixed on 10/2/2024, available soon afterwards).
When an OREF variable is provided as part of the context for a method. One example of this is when a class method is declared as a stored procedure. The %sqlcontext variable is automatically provided. Using #dim will enable code completion for that variable.

ClassMethod ByPhone(begin As %String = "", dob As %String = "") [ ReturnResultsets, SqlProc ]
{
    #dim %sqlcontext as %Library.ProcedureContext
    <some code>
    do %sqlcontext.AddResultSet(rs)
}

1. For the exception variable in a catch block. There are several exception classes, and it's possible to make custom exception classes. Using #dim will enable proper code completion.

    catch ex {
        #dim ex as <some system or custom exception class>
        if ex.DisplayString()
    }

Extra #dim tidbit: I know that some development teams like to use #dim for most/all variables (not just OREFs), using it to declare (make it clear) what the purpose of each variable is. For those teams, it's also nice that VS Code provides the ability to right-click a variable and click "Go To Declaration" to jump to the #dim statement for that variable, if one exists.

Hey! If you read this far, try the #dim poll below.

May all your developer days be bright and not...

😁

2 Comments
Discussion (2)3
Log in or sign up to continue
Announcement
· Oct 1, 2024

Online Meetup with the Winners of the Developer Tools Contest 2024

Hi Community,

Let's meet at the online meetup with the winners of the Developer Tools Contest. It's a great opportunity to chat with the InterSystems Experts team and our contestants.

Winners' demo included!

Date & Time: Monday, October 7, 10:00 am EDT | 4:00 pm CEST

Join us to learn more about winners' applications and to have a talk with our experts.

➡️ REGISTER TODAY

See you all at our virtual meetup! 

2 Comments
Discussion (2)3
Log in or sign up to continue
Announcement
· Oct 1, 2024

Developer Community Recap, September 2024

Hello and welcome to the September 2024 Developer Community Recap.
General Stats
139 new posts published in September:
 30 new articles
 39 new announcements
 70 new questions
454 new members joined in September
13,880 posts published all time
13,855 members joined all time
Top posts
Top authors of the month
Articles
#InterSystems IRIS
Helm Uninstall InterSystems - What does it do?
By Ariel Glikman
IRIS Native Python Part-2
By Ashok Kumar
Handling NULL in SQL
By Tomoko Furuzono
eBPF: Tracing Kernel Events for IRIS Workloads
By Ron Sweeney
eBPF: Parca - Continuous Profiling for IRIS Workloads
By Ron Sweeney
Code Scanner
By Robert Cemper
Dates with InterSystems
By David Hockenbroch
Embedded python in InterSystems IRIS
By Ashok Kumar
Code Scanner - enhanced
By Robert Cemper
Embedded python in InterSystems IRIS Part-2
By Ashok Kumar
How to get the current line of code that's being executed
By Tomoko Furuzono
Development Tools for Visibility into IRIS CCDA to SDA Transformation
By Chi Nguyen-Rettig
Database Management Tool
By Andrii Mishchenko
Deploying InterSystems WSGI Apps on AWS with Pulumi and Docker Compose
By Zacchaeus Chok
IRIS-API-Template introduce
By Samuel Thomas
iris-DataViz: Tableau-style drag-and-drop Data Analysis and Visualization Application
By Muhammad Waseem
Access IRIS database with ODBC or JDBC using Python
By Murray Oldfield
Same old terminal but in web
By Dmitry Maslennikov
CodeInspector: Automating Custom Code Validation
By Rodolfo Moreira
How to change the instance (configuration) name
By Megumi Kakechi
Inside Database Management Tool
By Andrii Mishchenko
IRIS Test Data Generator
By Dylan Cole
Unleashing the Power of Vector Search with SQL-Embedding
By Henry Pereira
 
#InterSystems IRIS for Health
 
#InterSystems Ideas Portal
 
#Developer Community Official
 
Announcements
#InterSystems IRIS
[Video] Unleash the Power of Your Data with InterSystems
By Anastasia Dyubaylo
September brings another Webinar in Spanish: ‘Facial recognition applied to application login using JavaScript+IRIS’
By Sergio Farago
[Video] InterSystems IRIS Vector Search and the Python Ecosystem
By Anastasia Dyubaylo
InterSystems IRIS SQL Specialist Exam is now LIVE!
By Emily Geary
[Video] Chatbots are all the RAGe: Generative AI with InterSystems IRIS
By Anastasia Dyubaylo
[Video] Deployment Considerations for Your AI Solution
By Anastasia Dyubaylo
Operate IPM / ZPM on your IRIS instances easily from within VS Code
By John Murray
[Video] Setting Up SQL Foreign Key Constraints
By Brenna Quirk
DX Jetpack 2024 edition brings three new extensions to VS Code users
By John Murray
IPM in VS Code now works for devs who target a Docker container to compile and run their local sources
By John Murray
 
#Developer Community Official
 
#IRIS contest
 
#Open Exchange
 
#HealthShare
 
#InterSystems Ideas Portal
 
#Learning Portal
 
#Global Masters
 
#InterSystems Reports (Logi)
 
#Other
 
#Job Wanted
 
#InterSystems IRIS for Health
 
Questions
#InterSystems IRIS
Embedded python still using old version of python after system upgrade
By David Satorres
How to convert date in "YYYY-MM-DDTHH:MM:SSZ" format to "yyyymmddhhmmss" format?
By Samyuktha Chaudhary
Allocation of Disk Space - Splitting of IRIS.dat into 2 different files
By Scott Roth
Wrong data conversion when returning ZTIMEH and ZTIME
By Davi Massaru Teixeira Muta
Autocommit pandas dataframe rows into IRIS
By José Pereira
Forcefully remove database from mirror
By Marcel den Ouden
When doing a docker build
By Victor Castanon
Determine Job/Process State
By Pietro Di Leo
Running IRIS in a Swarm Cluster
By Charles TETU
Iterate over array of namespaces
By Vivian Lee
Have you tried the THROUGH command in IRIS 2024.2? How does it work?
By Andreas Schneider
Extending IRIS Health Monitor with custom health monitor sensors
By Steve Pisani
What is the best way to do a silent install of an IRIS application?
By Alan Watts
Get a specific value from an ASTM segment in Routing Rule
By Thomas Vessiere
Cache-2018.1.9
By Rajendra Chandracant
Input Redirection
By Oliver Wilms
30 days full working test license
By G. Mar
LDAP Authentication Question
By Scott Roth
VSCode debugging doesn't work with version 2024.2
By Jonathan Perry
Navigate XML Bundle resource
By Marco Arcolin
Create a "class variable" and a "singleton".
By Alin Soare
inserting a row into a sql server table
By Phil Burkhalter
Local Ensemble instance clashing with another application's local client
By Colin Brough
This site can’t be reached - trying out iris-DataViz
By Oliver Wilms
Run a routine that was created and compiled with %Routine library
By omer
How to run a routine when a Namespace component setting is updated/changed?
By Bransen Smith
Combine all rows in select into one comma delimited string
By Robert Stephens
 
#Caché
 
#InterSystems IRIS for Health
*Function not allowed in IRIS Native python
By Ashok Kumar
docker login is not working for the repo
By Jignesh Patel
Write files to different subdirectories from a single EnsLib.File.OutboundAdapter
By Troy Marshall
License manager on cloud
By Jignesh Patel
image is not downloading
By Jignesh Patel
mirroring - cost effective solution
By Jignesh Patel
Record Map to Transform an HL7 message to | separated string / stream
By Nirali Dayam
Change Date Format from YYYYMMDDHHMMSS to YYYYMMDD in a DTL
By Patty Aguirre-Romero
how to implement CDC
By Jignesh Patel
Can I use a DTL for any HL7 message without specifying a DocType?
By Anthony Master
FHIR to SDA Example
By Scott Roth
Using HS.FHIRServer.Interop.Service as Facade with bearer token
By Theo Stolker
Property of list of lists
By Roman Faustov
Tilde(~) is not working while replacing
By Abhishek Raj
cloud based license server
By Jignesh Patel
 
#Ensemble
$ZDATETIME($h,3,1,3)
By Krishnaveni Kapu
SQL query to get multiple records
By Krishnaveni Kapu
..AppendTimestamp in FTP
By Krishnaveni Kapu
Method doesn't Exist in Ensemble 2018
By john smith
padding zeros to the desired length
By Krishnaveni Kapu
Changing JSON component
By john smith
Latency with VS Code 1.93 for "Import and Compile"
By Maxime LACH
EOF forced to LF in VS Code since version 2.12.6 of "Intersystems ObjectScript" extension
By Maxime LACH
Schedule Setting on Business File Service
By Warren Oyco
xml attribute in double quotes
By Krishnaveni Kapu
fileName in an FTP out
By Krishnaveni Kapu
Large Stream to base64Encoded
By Krishnaveni Kapu
HTTP request with Cookies
By john smith
CHARSET options for the FTP outbound adapter
By Krishnaveni Kapu
Send JSON with HTTP post
By john smith
Response of JSON type
By john smith
 
#Health Connect
 
#HealthShare
 
#Open Exchange
 
#Other
Access Windows file server
By Peter Vangelov
 
September, 2024Month at a GlanceInterSystems Developer Community
1 Comment
Discussion (1)2
Log in or sign up to continue
Digest
· Oct 1, 2024

Resumo do InterSystems Developer Community, Setembro 2024

Olá e bem-vindo ao boletim informativo da comunidade de desenvolvedores Setembro 2024.
Estatísticas gerais
23 novas postages publicadas em Setembro:
 16 novos artigos
 5 novos anúncios
 2 novas perguntas
2 novos membros ingressaram em Setembro
1,173 postagens publicadas ao todo
591 membros ingressaram ao todo
Principais publicações
Principais autores do mês
Artigos
#InterSystems IRIS
#InterSystems IRIS for Health
#Caché
#Outro
Anúncios
Perguntas
#InterSystems IRIS
#Caché
Setembro, 2024Month at a GlanceInterSystems Developer Community
Announcement
· Oct 1, 2024

Récapitulation de la communauté des développeurs, Septembre 2024

Bonjour et bienvenue à la récapitulation de la communauté des développeurs de septembre 2024.
Statistiques générales
✓ Nouvelles publications 15 publiées le septembre :
 10 nouveaux articles
 4 nouvelles annonces
 1 nouvelle question
✓ Nouveaux membres 4 ayant rejoint le septembre
✓ Publications 1,023 publiées depuis le début
✓ Membres 150 ayant rejoint depuis le début
Meilleures publications
Les meilleurs auteurs du mois
Articles
Annonces
#InterSystems IRIS
 
#Communauté des développeurs officielle
 
#IRIS contest
 
#TrakCare
 
Questions
#InterSystems IRIS
error: %SaveData
Par ilyes Bahlagui
 
Septembre, 2024Month at a GlanceInterSystems Developer Community
Discussion (0)1
Log in or sign up to continue