Clean, forgiving syntax highlighting for pseudocode.
Write it the way you think it: IF, if, end if, <-, :=, →. It all just works.
Pseudocode has no standard. Every course, book and person writes it a little differently: IF ... THEN ... END IF, if ... then ... fi, x <- 5, x := 5, x = 5. Most highlighters either don't know the language or get confused when the code isn't perfectly formed.
This extension is built around one idea: never be wrong about what you meant, and never break because of a typo. It highlights what it recognizes and quietly ignores the rest.
- Case-insensitive keywords.
IF,Ifandifare all highlighted the same way. - Wide keyword coverage. Control flow (
if,else,for each,while,repeat,until,switch,try/catch,end if,endfor, ...), declarations (function,class,let,const, ...), modules (import,from,use, ...), async keywords and more. - Error-tolerant strings. An unclosed quote only affects its own line, never the rest of the file.
- Three comment styles.
// line,# lineand/* block */. - Many operator styles. Assignment with
<-,:=,=; comparison with==,!=,<>; plus unicode←,→,≠,≤,≥; word operators likeand,or,not,mod,div. - Smart names. Function and class names are highlighted at their definition and at call sites.
UPPER_CASEnames are treated as constants. - Editor comfort. Bracket matching, auto-closing quotes and brackets, comment toggling (
Ctrl+/) and automatic indentation after blocks likethen,do,else.
// Find the maximum value in an array
FUNCTION findMax(arr: int[]) RETURNS int
max <- arr[0]
FOR EACH x IN arr DO
IF x > max THEN
max <- x
END IF
END FOR
RETURN max
END FUNCTION
PRINT("Max is: " + findMax([3, 9, 4]))
The extension is installed straight from this repository. No build tools and no accounts are needed.
Pick one:
- Download ZIP: open the Releases page, choose the latest release and download Source code (zip). Then unzip it.
- Or clone with Git:
git clone https://github.com/Alexukk/PseudoCodeLinter.git
You should end up with a folder that contains package.json, language-configuration.json and a syntaxes folder directly inside it.
Copy that folder into the extensions directory and rename it to alexukk.vscode-psdc-0.1.0.
| System | Extensions directory |
|---|---|
| Windows | %USERPROFILE%\.vscode\extensions |
| macOS / Linux | ~/.vscode/extensions |
Windows tip: press
Win+R, paste%USERPROFILE%\.vscode\extensionsand press Enter to open the folder.
The result should look like this:
.vscode/extensions/
└── alexukk.vscode-psdc-0.1.0/
├── package.json
├── language-configuration.json
└── syntaxes/
└── pseudocode.tmLanguage.json
Close all VS Code windows and open it again. Create or open any file with the .psdc extension and highlighting turns on automatically. The language indicator in the bottom right corner should say Pseudocode.
Delete the old alexukk.vscode-psdc-* folder from the extensions directory, copy the new version in the same way, and restart VS Code.
Close VS Code, delete the alexukk.vscode-psdc-0.1.0 folder from the extensions directory, and start VS Code again.
If you only want to test it or work on the grammar, run VS Code with the extension loaded directly from the folder:
code --extensionDevelopmentPath="/full/path/to/PseudoCodeLinter"A new VS Code window opens with the extension active. After editing the grammar, press Ctrl+R in that window to reload it.
| Problem | What to do |
|---|---|
| Nothing is highlighted | Check that the file ends with .psdc. Click the language indicator in the bottom right corner of VS Code and choose Pseudocode manually. Make sure package.json sits directly inside alexukk.vscode-psdc-0.1.0, not in a nested folder. |
| The extension doesn't show up after copying | Close every VS Code window (check the system tray too) and start it again. |
| Colors look wrong or some words stay white | Highlight colors come from your color theme. Put the cursor on a word and run Developer: Inspect Editor Tokens and Scopes to see which scope it got. Some themes simply don't color certain scopes. |
| Old behavior after an update | Make sure only one alexukk.vscode-psdc-* folder exists in the extensions directory. |
- Snippets for common blocks (
if,for,while,function) - A forgiving linter: unmatched blocks (
ifwithoutend if), unclosed brackets, and other gentle warnings - More comment styles and keyword sets
Ideas and bug reports are welcome. Open an issue with a small .psdc example that doesn't look right.
- Fork the repository.
- Edit
syntaxes/pseudocode.tmLanguage.json(highlighting rules) orlanguage-configuration.json(brackets, comments, indentation). - Test with
code --extensionDevelopmentPath=...as shown above. - Open a pull request with a short description and an example of the code your change affects.