Fira Code Visual Studio Code

Posted on  by 



'editor.fontFamily': 'Fira Code, Comic Sans MS, Tahoma, Consolas', and I've tried (according to this ) different combinations of apostrophes, spaces and capitalization. No matter what I do, I get Comic Sans to pop (or some plain, weird junk if I only specify Fira Code with no secondary font. I've use Fira Code for a while and i just got my new computer working, When installed Fira Code again into VSCODE, The font stuck on bold and i don't know how to get it working as usual.

Stata syntax highlighting in Visual Studio Code, built from the ground up.

In your OS font manager, uninstall older versions of Fira Code if you were using it before first, and then install Fira Code v2. And restarting the OS and vscode afterwards is probably necessary. You will almost certainly need to add calt to your list of whatever new sets you wish to use just to get other sets working. After downloading the file you'll want to double click on each.ttf file to install the Fira Code iScript font on your machine. Update VS Code Preferences. Next, open up VSCode and go to Preferences Settings. Under the Text Editor tab you'll see an option that says Font, click on that and add Fira Code iScript to the Font Family textbox.

Also available for Atom.

Code snippet from Gtools, a faster implementation of Stata's collapse and egen using C plugins. Shown with the Material theme.

Features

This package highlights:

  • System commands, functions, and function arguments
  • Macros, both global and local
    • Accurately colors nested macros and escaped macros in strings when you want the inner macro to evaluate at runtime
    • Colors macro extended functions inside `: ... ' as well as after local lname:
  • Comments, more accurately than Stata's Do-file Editor.
  • Regular expressions
    • Colors both the limited syntax provided through the regexr() and regexm() functions, as well as the vastly expanded regex syntax provided in Stata 14 and 15 through the ustrregexm(), ustrregexrf(), and ustrregexra() functions.
  • Dynamic Markdown and LaTeX documents. Instructions below.

Other nice features:

  • Works with unicode identifiers. Use unicode anywhere it's legal Stata syntax.
  • Alerts you if your variable name is illegal, i.e. if your variable name is more than 32 chars, starts with a number, or is a reserved name.
  • Alerts you if you have any text other than } on a line ending a foreach/forvalues/if/else command
  • Local macro back tick autocompletion. When you write a `, Visual Studio Code automatically fills in a ' after your cursor
  • Makes it easy to spot incorrect nesting of compound quotes
  • Support for programming ligatures for all valid Stata syntax for fonts that support them, like the Fira Code font.
  • Highlights SQL queries used in the odbc command. (The language-sql base package must be active.)

Note

Some themes may not color all parts of the syntax.

Installation

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.

Running Code

This package doesn't have the capabilities to run your code in Stata. If you're using Linux, you can use my scripts with the Autokey automation utility to quickly run selections of your files in a graphical session of Stata.

You might also be interested in trying to port Atom's stata-exec package.

Dynamic Documents

Stata 15 brought new features for working with dynamic documents. The dyndoc command lets you write in Markdown and converts your file and code to HTML for viewing in a web browser.

It also added the dyntext command, which fills in Stata output for any text file, without touching the text itself. This lets you then use third-party document generators like Pandoc and LaTeX to generate documents.

This package now provides syntax highlighting for Stata code written inside Stata's dynamic tags for Markdown and LaTeX documents.

By default, this package's Markdown and LaTeX syntax highlighting will be applied for files ending in .domd and .dotex respectively. The Markdown All in One and LaTeX Workshop packages must be installed for the highlighting to work.

Fira Code Visual Studio Code

If you name your file with a different extension, you can manually set the highlighting by clicking on the 'Plain Text' button on the bottom right of the screen (or by pressing CTRL+SHIFT+L) and then selecting Stata Dyndoc (Markdown) or Stata Dyndoc (LaTeX) from the drop-down menu.

Examples

An example of the PDF output of using dyntext and Pandoc is in the examples folder: dyntext.pdf.

That file was created by running

from inside Stata 15, and then with

on the command line using Pandoc.

Vscode Fira Code

The file dyntext.dotex is a proof-of-concept and should compile with LaTeX but the output is not shown here.





Coments are closed