BookmarkSubscribeRSS Feed

Existing ones are just better than nothing. The formater, go to definition, auto indentation etc. need completely new implementation.

Anyone interested to join?

27 REPLIES 27
Reeza
Super User

What does VS require for the extension?

 

I've previously used NotePad++ as an extension, the definition files are from Chris here:

https://github.com/cjdinger/sas-npp

 

 

For complex projects, for example, syntax linting, go to definition, on the fly function, a language server is required. I would imagine this to be a lot of typescript programming.

Typescript is a strict syntactical superset of JavaScript.

 

 

lsp-languages-editors

 

 

Syntax highlighting and Indentation should be relatively easy, they can be directly edited from template:

https://code.visualstudio.com/api/language-extensions/language-configuration-guide

 

I see the power of VS Code editor as a modern editor. If the extension is made correctly with an API to run SAS service from command line, to view Dataset in a split tab, it can be better than SAS Base (DM).

SundareshS
Obsidian | Level 7
Hi - that's an interesting idea. I notice that there are two extensions already in the VS Code marketplace for SAS files. One is by some other organization, but the other has the SAS logo (perhaps indicating it is by someone from sas) - have those been tried ?

Yes, that is exactly what I mean "Existing ones are just better than nothing."

Those two extensions are very basic (incomplete) syntax highlighting logic. I believe a better syntax highlighting can be made in a week from spare time by importing keywords into templates. They do not include any advance features such as on the fly function help, intellisense, go to definition, auto indentation, etc.

 

The advance features off course will require a lot of coding. Once finished, it can be in par, if not better, than SAS Studio.

And I believe it is much easier to implement it in VS Code than writting a brand new SAS version of Spyder, to an extent that can be achieved by open source community.

 

The SAS Base is stable. But it sucks.

The SAS EG is awesome. But the user sometimes only needs a text editor, a data viewer, and save scripts on the disk so that it can be opened through other editors or synced through Github.

The SAS Studio is awesome. But not everyone likes to edit a file in a browser. Browser also limits rich IDE features.

 

A good IDE with a good extension suits well for this situation.

Reeza
Super User
That's probably more work than I have the capacity for at the moment, but the file I linked to will have the information you need for correct syntax highlighting so perhaps that alone can help you get started quickly. I think one feature is the option/code completion from SAS Studio that may be harder to implement in VS but I agree there's a need for a better desktop tool, I really do like VS though RStudio is great as well.
Tom
Super User Tom
Super User

So VS Code seems like a useful tool as it is.  There is an extension for SAS that does a reasonable job of syntax highlighting.  Better than the version in SAS 9.4 Enhanced Editor.

https://marketplace.visualstudio.com/itemdetails?itemName=77qingliu.sas-syntax

 

For the other enhancements it looks like VS Code could do a lot, depending on what you want to build.

 

For execution you could start simple and just build something to let you save and run SAS program files via command line call to base SAS and automatically open the LOG and LST files generated.  Like the old ESS (Emacs Speaks Statistics) lisp code plug in for Emacs. A more complex solution would be one that could actually launch a workplace server instance of SAS and send code and retrieve results. Like the way the EG and SAS/Studio work. Then you could just send the code to run. You could highlight pieces of the code and run them, like in Display Manager or SAS/Studio.  In that mode could you also build tools for discovering what objects (librefs, datasets, variables, macro variables, macros,etc.) that are defined in your current active SAS session, like in R/Studio?

 

I am a wary of lint/formatter tools because most of them do not have enough options. Can you make it place continuation keywords (commas, AND, OR, etc) at the BEGINNING of the overflow line where they are visible to humans instead of leaving them on the END of the line that is getting too long?  But being able to craft a set that work well for SAS code would be nice.

 

I am also not that pleased with the autocomplete (intellesense) implementation in SAS/Studio.  It is constantly trying to prompt me to fill in things I don't need any help with. Could we build an extension with user options to suppress it base on for example which PROC it is trying to help me with?  I don't need help typing PROC PRINT code.  PROC GLM or other procs that I use infrequently it might be nice. If it is able to interact with a live SAS session could you have a "file" that showed the variable definitions for a dataset and quickly grab and paste the variable name(s) into the command you are editing in your current window?

Tom
Super User Tom
Super User

You could also build a lot of functionality just using the snippets feature without having to "program".  You could build many things like the snippets/tasks that are in SAS/Studio.

 

One programming task might be a way to read source code from autocall macro library and generate snippets (or intellesense) to allow you to generate macro calls.  So you could tell VS Code what folder in your project will be used as the autocall library in SAS and it could see that you are starting to type a call to %MYMACRO and automatically give the options for parameters that the macro takes.  That could replace the command macro to generate macro call from source code that I have used for 20 years in Display Manager.

Patrick
Opal | Level 21

I see the power of VS Code editor as a modern editor. If the extension is made correctly with an API to run SAS service from command line, to view Dataset in a split tab, it can be better than SAS Base (DM).


The future of SAS is Viya and under Viya 4++ there isn't a SAS Base Windowing environment or even SAS EG anymore. The interface is SAS Studio. 

I certainly haven't fully thought through what you're proposing to do but just consider it to be" future proof" - and the current "standard" is Viya 4 with data not only existing as physical SAS files but also as tables in CAS.

Basically, I am imagine the VS Code extension growing to something like the current python extension in VS Code with additional capability to view Dataset in a split tab. It compares to SAS Studio like the Spyder compares to Jupyter notebook.

SASKiwi
PROC Star

Interesting. We use Visual Studio with the TFS add-in for version control of SAS programs, but Enterprise Guide for code development. We open our SAS programs in VS but link them to open with EG. The two work pretty well together.

Tom
Super User Tom
Super User

What is VS?  What is a VS Code extension?

Do you have explanations? Links? Documentation?

 

If the reader does not understand what the topic is, he/she definitely will not understand how to develop extension.

Thanks for your concern.

Reeza
Super User

@anonymous_user wrote:

If the reader does not understand what the topic is, he/she definitely will not understand how to develop extension.

Thanks for your concern.


I don't know how to develop an extension at the moment, but I'm also fully confident I could figure it out if desired and the same goes for several other programmers on here, Tom included. 

 

VS is Visual Studio, an IDE that works across multiple languages. 

A code extension would allow a SAS programmer to use VS to develop programs with similar features to SAS EG or Studio. I'm quite happy with Studio but I understand the desire for a more programmer friendly interface. 

 

Apparently it's built in either TypeScript or JavaScript - tutorial here. 

https://code.visualstudio.com/api/get-started/your-first-extension

 

 

 

 

 

 

AlanC
Barite | Level 11

Quick clarification. VS is Visual Studio and normally refers to the full IDE which is much more powerful than VS Code. VS Code is an open source editor (and a darn good one) that supports a lot of languages. I use both, VS daily, VS Code every other week or so.

 

So, VS and VS Code are very separate entities. A VS extension, which I built many moons ago, is probably not the direction. However, VS Code should be the direction. If a VS extension is desired, i have developed one a long time ago and it involved C# and interface compliance.

https://github.com/savian-net

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 27 replies
  • 11880 views
  • 48 likes
  • 14 in conversation