VS Code / Cursor extension: convert px ↔ vw/vh with a configurable viewport.
| Action | Command | Default keybinding |
|---|---|---|
| px → vw/vh on current line | PX Converter: Convert px to vw/vh on current line |
Alt+S |
| px → vw/vh in entire file | PX Converter: Convert px to vw/vh in entire file |
Alt+D |
| vw/vh → px on current line | PX Converter: Convert vw/vh to px on current line |
Ctrl+Alt+S |
| vw/vh → px in entire file | PX Converter: Convert vw/vh to px in entire file |
Ctrl+Alt+D |
- pxConverter.targetUnit — Convert px to:
vworvh(default:vw). - pxConverter.viewportWidth — Viewport width in px (default:
1920). - pxConverter.viewportHeight — Viewport height in px (default:
1080). - pxConverter.decimalPlaces — Number of decimal places when rounding converted values (default:
2, range: 0–10).
Keybindings can be changed in VS Code/Cursor keyboard settings.
- Open the extension folder in Cursor/VS Code: File → Open Folder → select the
vs-code-px-converterfolder. - In terminal:
npm installthennpm run compile. - Press F5 (or Run → Start Debugging). A new window opens — that window has the extension loaded. Use it there.
- Build and pack:
npm install,npm run compile, thennpx @vscode/vsce package(createspx-converter-0.1.0.vsix). - Open Extensions: press Ctrl+Shift+X (or View → Extensions).
- In the Extensions panel, at the top right, click the ⋯ (three dots) button.
- Choose Install from VSIX... and select the
.vsixfile.
npm install
npm run compileOpen the project folder in Cursor/VS Code, then press F5 to run the extension in a new window.
Расширение для VS Code / Cursor: конвертация px ↔ vw/vh с настраиваемым viewport.
| Действие | Команда | Клавиши по умолчанию |
|---|---|---|
| px → vw/vh на текущей строке | PX Converter: Convert px to vw/vh on current line |
Alt+S |
| px → vw/vh во всём файле | PX Converter: Convert px to vw/vh in entire file |
Alt+D |
| vw/vh → px на текущей строке | PX Converter: Convert vw/vh to px on current line |
Ctrl+Alt+S |
| vw/vh → px во всём файле | PX Converter: Convert vw/vh to px in entire file |
Ctrl+Alt+D |
- pxConverter.targetUnit — во что переводить px:
vwилиvh(по умолчаниюvw). - pxConverter.viewportWidth — ширина viewport в px (по умолчанию
1920). - pxConverter.viewportHeight — высота viewport в px (по умолчанию
1080). - pxConverter.decimalPlaces — сколько знаков после запятой оставлять при округлении (по умолчанию
2, диапазон 0–10).
Горячие клавиши можно изменить в настройках клавиатуры VS Code/Cursor.
- Откройте папку расширения в Cursor/VS Code: Файл → Открыть папку → выберите папку
vs-code-px-converter. - В терминале:
npm install, затемnpm run compile. - Нажмите F5 (или Запуск → Начать отладку). Откроется новое окно — в нём расширение уже подключено, пользуйтесь им там.
- Сборка и упаковка:
npm install,npm run compile, затемnpx @vscode/vsce package(создастся файлpx-converter-0.1.0.vsix). - Откройте Расширения: Ctrl+Shift+X (или Вид → Расширения).
- В панели Расширения вверху справа нажмите кнопку ⋯ (три точки).
- Выберите Install from VSIX... и укажите файл
.vsix.
npm install
npm run compileОткройте папку проекта в Cursor/VS Code и нажмите F5 — расширение запустится в новом окне.