Code editor
OSQL language support
The plugin includes language support for OSQL. Files with .osql
file endings will automatically get the OSQL language mode. If VSCode does not set OSQL language mode automatically when opening an .osql
file, then you can set the language mode by clicking the Language Editor in the Status Bar
and selecting "osql" in the drop down selector.
Syntax highlighting
The OSQL language mode provides syntax highlighting for both OSQL and aLisp. You can write both OSQL and aLisp code in the same .osql
files (by using the lisp;
and :osql
directives). The OSQL language mode is "language aware" of the local language snippets and provides syntax highlighting for both aLisp and OSQL in the same file.
IntelliSense
The OSQL language mode provides IntelliSense features such as code autocompletion. Simply start writing and a list of available functions and keywords will appear in a drop-down list where you can select the right function/keyword by using the Up and Down keys and pressing Return.
When you edit a .lsp
file you get syntax highlighting and code autocompletion for aLisp. Note that the language mode shown is "Lisp" but the code autocompletion is for aLisp. Note however that autocompletion for aLisp does not work inside Lisp blocks in OSQL files.
Running code
When editing OSQL files you can run the code in the file in the following ways:
To run a single OSQL expression you can put the cursor on the line with the expression and press
Shift+Return
. This will run the expression at the cursor.To run multiple OSQL expressions, select the code you want to run and press
Shift+Return
. This runs all the selected expressions.To run a whole OSQL file, right-click on the file in explorer and select
Load file in SA Engine
. If the file is open you can also use the Load button in the editor toolbar. Select an SA Engine instance in the dropdown menu that is shown.
Interactive OSQL window
Running OSQL code will open an interactive tab displaying the output.
If an interactive tab does not open, then you can open one manually by selecting "SA Engine: Create an Interactive OSQL Window" in the Command Pallette (Ctrl+Shift+P
) and run the OSQL code again.
To stop a query you can press the red stop button at the top right corner of the query in the OSQL Notebook tab.
You can read more about interactive windows in the OSQL Notebook section.
Visualization
Query results can be visualized in different formats. The default format is Text
but you can use other formats by providing a //plot: <vis-format>
directive above the query.
You can read more about the available visualization formats in the Visualization chapter in the SA Studio manual.