This VS Code extension enables syntax highlighting for Dynare files. MATLAB code within Dynare files is also highlighted. Note: This extension alone does not enable running your Dynare code in VS Code.
You can install this extension via the Visual Studio Marketplace.
The syntaxes/dynare.tmLanguage.json file was generated using Perplexity with Claude 3.5. Ongoing improvements are being made with the assistance of Claude 3.5 Sonnet.
NOTE: This extension is still under development. If you encounter any bugs, please create an issue.
-
Ensure MATLAB is installed on your system.
-
Verify MATLAB can run in headless mode:
- Type
matlab -nodesktopin the terminal or PowerShell - MATLAB's copyright information should appear in the terminal
- If not, please add MATLAB's installation directory to the environment variable
PATH, or replacematlabwith the absolute path to your MATLAB installation
- Type
-
Run Dynare code in the terminal using:
matlab -nodesktop -nosplash -r \"try, dynare <dynare filename>, catch error, disp(getReport(error,'extended')), exit(1), end, exit(0);\"
Note: This command exits both Dynare and MATLAB upon code completion. Make sure to store the IRFs in your Dynare code, or alternatively use:
matlab -nodesktop -nosplash -r \" dynare <dynare filename>;\"
-
For Code Runner integration, add the following to the executor map to use the run button:
"dynare": "cd $dir && matlab -nodesktop -nosplash -r \"try, dynare $fileNameWithoutExt, catch error, disp(getReport(error,'extended')), exit(1), end, exit(0);\""