Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Parts of Speech HighlightNew to Visual Studio Code? Get it now.
Parts of Speech Highlight

Parts of Speech Highlight

Mohammad Madine

|
12 installs
| (0) | Free
Highlights parts of speech (nouns, verbs, adjectives, etc.) in LaTeX documents using spaCy
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

POS Highlight

A VS Code extension that highlights parts of speech (nouns, verbs, adjectives, etc.) in LaTeX documents using spaCy for natural language processing.

This extension was created using OpenCode.

Features

  • Automatic server management - The Python server starts automatically when you open a LaTeX file
  • Two color modes:
    • Semantic mode - Uses your VS Code theme colors
    • Rainbow mode - Fixed, customizable colors (like Rainbow CSV)
  • Highlights 8 parts of speech:
    • Nouns (including proper nouns)
    • Verbs (including auxiliary verbs)
    • Adjectives
    • Adverbs
    • Pronouns
    • Prepositions
    • Conjunctions
    • Determiners
  • Automatically strips LaTeX commands and math environments before analysis
  • Intelligent caching - only re-analyzes paragraphs that changed
  • Configurable spaCy model (small, medium, or large)

Requirements

The extension requires Python 3 with Flask, Flask-CORS, and spaCy installed. The server is bundled with the extension and starts automatically.

Arch Linux

# Core dependencies
sudo pacman -S python-flask python-flask-cors python-spacy

# Choose a spaCy model (install one):
paru -S python-spacy-en_core_web_sm  # Small (~12MB) - fast, good accuracy
paru -S python-spacy-en_core_web_md  # Medium (~40MB) - better accuracy
paru -S python-spacy-en_core_web_lg  # Large (~560MB) - best accuracy

Ubuntu / Debian

sudo apt install python3-flask

# Flask-CORS and spaCy are not in the default repos, use pip:
pip install --user flask-cors spacy

# Download a spaCy model:
python3 -m spacy download en_core_web_sm

Fedora / RHEL

sudo dnf install python3-flask

# Flask-CORS and spaCy are not in the default repos, use pip:
pip install --user flask-cors spacy

# Download a spaCy model:
python3 -m spacy download en_core_web_sm

macOS (Homebrew)

brew install python

# Install Python packages:
pip3 install flask flask-cors spacy

# Download a spaCy model:
python3 -m spacy download en_core_web_sm

Windows

Option 1: Official Python installer (recommended)

  1. Download Python 3 from python.org
  2. During installation, check "Add Python to PATH"
  3. Open Command Prompt or PowerShell and run:
pip install flask flask-cors spacy
python -m spacy download en_core_web_sm

Option 2: Microsoft Store

  1. Install Python 3 from the Microsoft Store
  2. Open Command Prompt or PowerShell and run:
pip install flask flask-cors spacy
python -m spacy download en_core_web_sm

Option 3: Chocolatey

choco install python

pip install flask flask-cors spacy
python -m spacy download en_core_web_sm

Option 4: Scoop

scoop install python

pip install flask flask-cors spacy
python -m spacy download en_core_web_sm

Note: If you have multiple Python versions installed, you may need to set the pos-highlight.pythonPath setting to the correct Python executable path (e.g., C:\Users\YourName\AppData\Local\Programs\Python\Python312\python.exe).

NixOS

Add to your environment.systemPackages or use a shell:

# In configuration.nix or shell.nix
python3.withPackages (ps: with ps; [
  flask
  flask-cors
  spacy
  spacy-transformers
])

Then download a model:

python -m spacy download en_core_web_sm

Usage

  1. Install the extension
  2. Install the Python dependencies (see above)
  3. Open a .tex file

That's it! The extension will automatically:

  • Detect your Python installation
  • Start the spaCy server in the background
  • Apply part-of-speech highlighting

Status Bar

The status bar shows the current state:

Icon Meaning
$(sync~spin) POS Server is starting
$(symbol-keyword) POS Active (semantic mode)
$(symbol-color) POS Active (rainbow mode)
$(circle-slash) POS Highlighting disabled
$(warning) POS Server not running

Click the status bar item to toggle highlighting on/off.

Extension Settings

Setting Default Description
pos-highlight.enabled true Enable or disable POS highlighting
pos-highlight.colorMode semantic Color mode: semantic (theme colors) or rainbow (fixed colors)
pos-highlight.spacyModel en_core_web_sm spaCy model (en_core_web_sm, en_core_web_md, en_core_web_lg)
pos-highlight.pythonPath "" Path to Python interpreter (empty = auto-detect)
pos-highlight.serverPort 5000 Port for the spaCy server
pos-highlight.rainbowColors (see below) Custom colors for rainbow mode

Rainbow Colors

In rainbow mode, you can customize colors for each part of speech:

{
  "pos-highlight.rainbowColors": {
    "noun": "#E06C75",
    "verb": "#61AFEF",
    "adjective": "#E5C07B",
    "adverb": "#C678DD",
    "pronoun": "#56B6C2",
    "preposition": "#98C379",
    "conjunction": "#D19A66",
    "determiner": "#ABB2BF"
  }
}

Commands

Command Description
POS Highlight: Toggle Highlighting Enable or disable highlighting
POS Highlight: Refresh Analysis Force re-analysis of the current document
POS Highlight: Restart Server Restart the Python server

How It Works

  1. When you open a LaTeX document, the extension starts the Python server automatically
  2. When you save the document, plain text is extracted (stripping LaTeX commands and math)
  3. The text is sent to the server for POS tagging with spaCy
  4. Tokens are mapped back to their original positions in the document
  5. Colors are applied using semantic tokens (semantic mode) or decorations (rainbow mode)

Intelligent Caching

The extension uses paragraph-level caching to minimize server requests:

  • If you save without changes, no analysis is performed
  • If you edit one paragraph, only that paragraph is re-analyzed
  • Other paragraphs use cached results

LaTeX Parsing

The extension extracts text from:

  • Regular paragraphs
  • Text commands: \section{}, \caption{}, \textbf{}, \emph{}, etc.

And strips:

  • LaTeX commands
  • Inline math ($...$, \(...\))
  • Display math ($$...$$, \[...\])
  • Math environments (equation, align, etc.)
  • Comments (% ...)

Semantic Token Mapping

In semantic mode, parts of speech are mapped to VS Code semantic token types:

Part of Speech Semantic Token Type Theme Fallback
Noun noun (supertype: variable) Variable color
Verb verb (supertype: function) Function color
Adjective adjective (supertype: property) Property color
Adverb adverb (supertype: macro) Macro color
Pronoun pronoun (supertype: parameter) Parameter color
Preposition preposition (supertype: operator) Operator color
Conjunction conjunction (supertype: keyword) Keyword color
Determiner determiner (supertype: comment) Comment color

Troubleshooting

Server won't start

  1. Check that Python 3 is installed:
    • Linux/macOS: python3 --version
    • Windows: python --version
  2. Check that dependencies are installed:
    • Linux/macOS: python3 -c "import flask, flask_cors, spacy"
    • Windows: python -c "import flask, flask_cors, spacy"
  3. Check the output panel: View → Output → "POS Highlight Server"

Python not found

If auto-detection fails, set the Python path manually:

{
  "pos-highlight.pythonPath": "/usr/bin/python3"
}

On Windows:

{
  "pos-highlight.pythonPath": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Python\\Python312\\python.exe"
}

Missing spaCy model

If you see an error about a missing model, install it:

# Linux/macOS
python3 -m spacy download en_core_web_sm

# Windows
python -m spacy download en_core_web_sm

Port already in use

Change the port in settings:

{
  "pos-highlight.serverPort": 5001
}

Development

Building the Extension

npm install
npm run compile

Or with Bun:

bun install
bun run compile

Running in Development

  1. Open this folder in VS Code
  2. Press F5 to launch the Extension Development Host
  3. Open a .tex file to see highlighting

The server starts automatically - no need to run it manually.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft