A very simple extension to show current character position/offset, and ability to set the cursor position interactively with preview. Note that this extension is now compatible with the web context of vscode, and commits around Dec 2021 can be looked at for the changes needed. It is straight forward for a simple extension without complex external requirements (including Node APIs themselves).
I had been using the Positions extension for seeing the offset but had a need to set the position by offset easily. So I wrote this, partially because the mentioned extension to learn a bit about typescript. As I finished I came across show-offset which I wish I'd run across initially. Nevertheless, I had added a couple unique features when I wrote this, so I figured I'd toss it into the gallery.
- Shows cursor character offset as 'Pos <position>' (name configurable through 'Position Name' settings in Settings > Extensions > vscode-position) in the status bar.
- Click the status bar or use the
Go To Position
palette command to move the cursor by offset. - New position is previewed while typing it in (similar to goto line)
- Cursor and selection restored if setting position is abandoned with esc
- Cursor position can also be +number or -number for moving the cursor relative to the current position.
- Works as a web extension in online hosts vscode.
Initial keybinding for
Go To Position
: ⌃+Alt+G (Mac: ⌃+⌘+G)
None
None
Supports web extension context for online vscode. Still exports traditional extension model for back compat to 1.40.0 Internal project restructuring to webpack to support web worker context.
(Cumulative)
- Fix 'Enter' leaving position at new location
- Fix extensionKind to properly support ui/workspaces for web Codespaces
Initial release.