If someone was to pick this up I'd strongly recommend an implementation using Microsoft's Language Server Protocol. Would be a fair bit of work, but it would make that editor mode available to a range of other editors (vim obviously being the most important).
VSCode uses a MS javascript editor component called Monaco, as after all, VSCode is just a webapp that's been deployed in Electron. We have a mode for Ace (another javascript editor component) that is extremely similar, which we've used within an internal product called AppFactory for 2 or 3 years now.
Keep in mind that writing a mode for SAS is really hard, as SAS is not just one language - it's more like 4 or 5. Just ask @sspkmnd - he's been working on his SASLint project for SAS for a long time now (implemented in ANTLR v4, so he also has it compiling to a mode for Ace). I'll let Igor elaborate on the difficulties of an all-encompassing mode for SAS, but it's much harder than you'd assume, compared to almost all other languages. I'm sure the developers behind the SAS Studio editor will agree.
Nik
SAS is more like 100 languages, at least. Every PROC has its own mechanisms because they are standalone. After spending a lot of time trying to parse the SAS language, that is my conclusion. As you state, it is very hard to parse.
I need to research more of your response (thanks, BTW) but the web is about to move toward WebAssembly. That paradigm shift is critical for new projects.
If the choice in VS Code is TypeScript vs JavaScript, choose TypeScript. Why? Anders Hejlsberg.He is the chief architect of C# and TypeScript (and possibly the best programmer in the world). TypeScript was built to put some rules around JS and make JS easier to debug and maintain.
Lots of changes are coming to the web development world (WebAssembly): TypeScript makes it more adaptable to those changes.
Great discussion everyone. I'm also really interested in something like this -- I use VS Code for some projects.
The current extension you found in the marketplace for VS (with the SAS logo) is not an official offering from anyone at SAS. I think it was created by @77qingliu -- and it looks like an impressive amount of work.
Those who point out that SAS syntax is complex are correct, of course. But we do have a great deal of data about the SAS language grammar -- that's what feeds the experience you see in SAS Enterprise Guide and SAS Studio. There may be an opportunity for some collaboration.
The language server step -- that's even more ambitious.
Found it by you!
I developed the extension from scratch using the TextMate grammar definition, and the source code is on my github repo, https://github.com/77QingLiu/vscode-SAS.tmLanguage. This extension covers some basic functions like highlighting and auto-complete with SAS-like colors, but lack of modern syntax highlighting features like syntax linting, go to definition, on the fly function due to the limitation of TextMate grammar definition.
It would be great if someone could develop the syntax highlighting engine based on the language server though it does require a fair bit of work.
Hi everyone,
We are getting close to a place when we can say we are ready to launch. The extension is available both on the VS Code marketplace, and also open-vsx (making it available to VSCodium, Theia, and other open source IDEs):
* https://marketplace.visualstudio.com/items?itemName=SASjs.sasjs-for-vscode
* https://open-vsx.org/extension/sasjs/sasjs-for-vscode
We have the following features:
* Syntax highlighting (with credit and thanks to @77qingliu - https://marketplace.visualstudio.com/items?itemName=77qingliu.sas-syntax)
* Ability to run SAS code in Viya and fetch the log
* Integration with the SASjs CLI so that the user can switch seamlessly between terminal and the extension (it uses the same global sasjsconfig file)
Next up:
* Some basic linting support
* Capturing the session output
* Deploying code as a SASjs Job or Service
If anyone would like to help, or contribute, do get in touch.
SAS just released the official VS Code SAS Extension: https://marketplace.visualstudio.com/items?itemName=SAS.sas-lsp
If you find any issues, please report here
Thank you for all your patience!
@sbjyil - Looks like you can only run your code from VSCode if you have SAS Viya. Are there any plans to support SAS 9?
Hi @SASKiwi,
Releasing the extension for SAS9 is certainly under consideration. Voicing your needs on the Community certainly are noticed. I'll pass this question along to the development team.
Join us for SAS Community Trivia
SAS Bowl XLIII, The New SAS Developer Portal
Wednesday, August 14, 2024, at 10 a.m. ET | #SASBowl
For reference - the unofficial SASjs VS Code extension already supports ALL versions of SAS (Viya, SAS9 EBI, Base/foundation), as well as the ability to configure compute contexts on Viya (both 3.5 and 4)
It's fully (MIT) open source and includes a linter for code quality checking.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.