Skip to content
Wei Wu edited this page Nov 24, 2022 · 12 revisions

Frequently Asked Questions

Usage questions

I don't see correct syntax colors on SAS code

Select File > Preferences > Color Theme and select a SAS provided theme.

Is there a way to assign a shortcut to run SAS code?

To manage shortcuts in VS Code, Click the "Manage" button from the left bottom and select Keyboard Shortcuts. Type "run sas" or so to filter and you'll see SAS: Run SAS code command and you can define shortcuts to it.

Can I make F3 to automatically run only selected code (when there's a selection) or all code (when there's no selection)?

User can assign a same shortcut to multiple commands with proper when clauses.

Here's an example in keybindings.json

{
    "key": "f3",
    "command": "SAS.run",
    "when": "editorTextFocus && editorLangId == 'sas'"
},
{
    "key": "f3",
    "command": "SAS.runSelected",
    "when": "editorHasSelection && editorTextFocus && !editorHasMultipleSelections && editorLangId == 'sas'"
}

The autocomplete pops up too aggressively

To prevent the autocomplete from popping up on pressing spacebar, uncheck the "Suggest On Trigger Characters" option in settings. Then the autocomplete will only show when you type matched text or press Ctrl+spacebar.

Set the "Accept Suggestion On Enter" option to false in settings. Then only Tab key will commit suggestions.

Also note that all settings can be set specific to sas to not impact other languages. Refers to https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings

I can't see word-based suggestions after enabling this extension

VS Code provides a default autocomplete that suggests existing words gathered in opened documents when there's no other autocomplete provider. But when an extension provided some autocomplete items, the default autocomplete will not show up. It's not specific to SAS. Refers to https://github.com/microsoft/vscode/issues/21611

It took so long to run at first time

A new session must be created the first time you run SAS code. Connection time will vary depending on the server connection. Subsequent runs within the session should be quicker.

Connection issues

How to get client ID/Secret?

SAS administrator can refers to this documentation for how to generate client IDs.

The client ID needs authorization_code grant type. If you want it to automatically refresh access token, it also need refresh_token grant type.

I got unable to verify the first certificate error when run

You will likely need to import your Viya server certificate into your local certificate store, as below steps:

  1. Obtain the root CA
  2. Import it into your local store. The steps vary across Operating Systems. Here's an instruction for Windows. For Mac OS, use the Keychain Access application, and change the "When using this certificate" setting from "Use System Default" to "Always Trust".

If it doesn't work, here's a workaround:

  1. Set environment variable NODE_TLS_REJECT_UNAUTHORIZED to 0 (This will bypass the certificate check). Or set NODE_EXTRA_CA_CERTS to include your certificate file.
  2. Shut down all VS Code instances and restart to pick up the environment variable. If you're connecting to a remote workspace, please set the environment variable on the remote system and kill all vscode server processes (for example, run ps -aux | grep vscode-server on the remote Linux to see the processes).

I got Invalid endpoint error

Please specify the correct protocol. For example, if your Viya server is on https, make sure you included https:// in your endpoint setting.

I keep getting blank errors

Please try restart your VS Code.

Clone this wiki locally