Skip to content

Spell-checking

A typo in a comment or in a name is easy to miss and hard to fix later, when the misspelt name is used in many files. The IDE’s Typo inspection (a check it runs as you type and shows in the editor) underlines misspelt words in SystemVerilog files and offers the correction on Alt+Enter (⌥⏎ on macOS). It is on by default.

The steps use the sample project; open it and wait for indexing first. They end with the file as it was.

  1. Open rtl/counter.sv, click on the empty line just above state_t state; and type // the recieved count. recieved gets a wavy underline: it is a typo. Other underlines elsewhere in the file are not part of this example (an abbreviation such as clk can be unknown to the dictionary; see What is checked). Leave them; they do not affect the example.

  2. With the caret (the text cursor) on recieved, press Option+Return (⌥⏎) on macOS or Alt+Enter on Windows/Linux. A popup lists corrections: choose received. The comment now reads // the received count and the underline is gone. The editor with recieved underlined by a wavy line and a popup under it offering the correction received and Save ‘recieved’ to dictionary

  3. Press End, then Enter, and type logic cuont_q;. cuont is underlined: a name is split into words at _ and at case changes, and each word is checked. Put the caret on cuont and press ⌥⏎ / Alt+Enter. The popup offers Rename to … (a list of corrected names): choosing one would rename the declaration and every use. This example skips it. Press Escape to close the popup without choosing.

  4. Press ⌘Z (macOS) / Ctrl+Z (Windows/Linux) repeatedly until the two lines you typed are gone. Check the result: the first line after import counter_pkg::*; is blank, then comes state_t state;. If you lose track, close the file without saving the change and open it again.

If nothing is underlined, see If it doesn’t work.

In SystemVerilog files:

  • comments and string literals;
  • every name a declaration introduces (modules, classes, signals, functions, `define macro names, …), split into words at _ and at case changes (rx_fifo_lenght → lenght). A name is checked where it is declared, not at each use, so a misspelt name is reported once; an abbreviation the dictionary does not know (rx, fifo) may be reported too (see below for what to do).

Not checked:

  • escape sequences (\n, \t) and format specifiers (%0d) in strings;
  • keywords, system tasks, attributes ((* mark_debug = "true" *)) and compiler directives (`timescale, `ifdef …);
  • the code of an inactive `ifdef branch (Conditional compilation).

If a word is correct but unknown to the dictionary (an abbreviation such as fifo), press Alt+Enter on it and choose Save ‘word’ to dictionary. It is not reported again. To remove it later, open Settings | Editor | Natural Languages | Spelling.

You see Likely cause What to do
recieved is not underlined You typed in a different file than rtl/counter.sv, or the project is still indexing Check the file name in the editor tab; wait for the progress bar at the bottom right to finish
Nothing is underlined anywhere The Typo inspection is turned off Turn it on under Settings (⌘, on macOS, Ctrl+Alt+S on Windows/Linux) | Editor | Inspections | Proofreading | Typo
A word you expect is not underlined It is a keyword or a directive, or is in an inactive `ifdef branch See What is checked
The popup shows no correction The word has no close match in the dictionary Save it to the dictionary if it is correct
The popup has no Rename to … The caret is not on the misspelt word in the declaration (names are checked only where they are declared) Put the caret on cuont in logic cuont_q;
A correct abbreviation is underlined It is not in the dictionary Save it to a dictionary from the Alt+Enter popup