Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Last CharNew to Visual Studio Code? Get it now.
Last Char

Last Char

KostiT

| (0) | Free
Reveal the last non-whitespace character in the current file.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Last Char

A lightweight Visual Studio Code extension that instantly reveals the last non-whitespace character in the currently open file, together with its Unicode code point.

Built as a small developer utility and as a demonstration of working with the Visual Studio Code Extension API.

Features

  • Finds the last non-whitespace character in the active file
  • Displays the character directly inside VS Code
  • Shows its Unicode code point
  • Supports Unicode characters and emoji
  • Accessible through the VS Code Command Palette
  • Lightweight with no external runtime dependencies

Example

Given a file ending with:

Hello!

Run:

Last Char: Reveal Last Character

The extension displays:

Last character: "!" — U+0021

Unicode characters are supported as well:

Hello 🚀

Result:

Last character: "🚀" — U+1F680

Usage

  1. Open a file in Visual Studio Code.
  2. Press Ctrl+Shift+P (Cmd+Shift+P on macOS).
  3. Search for Last Char: Reveal Last Character.
  4. Run the command.
  5. The last character and its Unicode code point will appear in a VS Code notification.

Installation

Install from VSIX

Download the .vsix package and install it in Visual Studio Code:

  1. Open the Command Palette with Ctrl+Shift+P.
  2. Select Extensions: Install from VSIX...
  3. Select the downloaded .vsix file.
  4. Reload VS Code if prompted.

Run from source

Clone or download this repository and open the project directory in Visual Studio Code.

Press F5 to launch an Extension Development Host.

You can then run Last Char: Reveal Last Character from the Command Palette in the development window.

Project Structure

last-char/
├── .vscode/
│   └── launch.json
├── images/
│   └── icon.png
├── extension.js
├── package.json
└── README.md

How It Works

The extension uses the VS Code Extension API to access the active text editor and retrieve the contents of the current document.

Trailing whitespace is removed before the final character is determined.

Array.from() is used when extracting the character so that Unicode code points outside the Basic Multilingual Plane, such as many emoji, are handled correctly.

The Unicode value is then obtained using codePointAt() and displayed through VS Code's notification API.

Technologies

  • JavaScript
  • Node.js
  • Visual Studio Code Extension API
  • VSCE packaging

Development

The extension command is registered using:

vscode.commands.registerCommand('last-char.reveal', () => {
    // Character inspection logic
});

The command is exposed to Visual Studio Code through the contributes.commands section of package.json.

Building

Install Microsoft's VS Code Extension Manager:

npm install -g @vscode/vsce

Package the extension:

vsce package

This generates an installable .vsix package.

Motivation

Last Char intentionally focuses on doing one thing well.

The project demonstrates the complete lifecycle of a small Visual Studio Code extension: designing a utility, integrating with the VS Code API, handling Unicode correctly, debugging through the Extension Development Host, packaging the extension as a VSIX, and installing it as a standalone extension.

Future Improvements

Potential additions include:

  • Inspecting the character under the cursor
  • Inspecting selected characters
  • Copying Unicode code points to the clipboard
  • Displaying UTF-8 byte representations
  • Showing additional Unicode character information
  • Status bar integration

License

MIT

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