Calc Hub
A powerful VS Code calculator extension with a clean sidebar interface. Supports arithmetic, trigonometry, base conversion, SI prefix unit conversion, and prime factorization — all without leaving your editor.
Features
🧮 Basic Calculator
- Expression Input: Type any mathematical expression and press Enter to evaluate
- Superscript Powers: Enter
x², xⁿ naturally — displays as proper superscripts
- Auto Brackets: Typing
( automatically inserts ) and places the cursor inside
- Thousand Separators: Results display with commas for readability
- History: Previous calculations are saved and can be recalled with a click; copy the result with the copy button
- Constants: Save named constants (e.g.
c = 299792458) and insert them into expressions
📐 Function Panel (fn ▾)
- Trigonometry: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh
- Logarithms: log₁₀, log₂, ln
- Other: √, |x|, π, e
- Angle Unit Toggle: Switch between DEG and RAD modes instantly
🔢 Base Conversion
- Inline Input: Type directly in BIN, OCT, DEC, or HEX fields
- Live Sync: All bases update in real time as you type
- Input Validation: Each field only accepts valid characters for its base
- BIN Formatting: Binary values display with 4-bit spacing for readability
📏 SI Prefix Unit Conversion
- Inline Input: Enter a value in any prefix row (T, G, M, k, —, c, m, μ, n, p)
- Live Sync: All other prefix rows update instantly
- Input Validation: Numeric input only
🔍 Prime Factorization
- Instant Factorization: Enter any positive integer up to 10¹² and press
= or Enter
- Superscript Display: Results shown as e.g.
360 = 2² × 3² × 5
- Prime Detection: Prime numbers are labeled
(prime)
- Numpad Input: Dedicated numeric keypad (digits, ⌫, C, =)
- History: Previous factorizations are saved and can be recalled with a click, or copied with the copy button
Installation
- Open VS Code
- Press
Ctrl+P (Mac: Cmd+P)
- Type
ext install calc-hub
- Press Enter
Or search for "Calc Hub" in the Extensions view (Ctrl+Shift+X / Mac: Cmd+Shift+X).
Usage
Basic Calculation
- Open the Calc Hub sidebar panel
- Type an expression in the input field (e.g.
sin(30) × 2 + 100)
- Press
Enter or click = to evaluate — the result appears above, and the expression stays in the input (selected) so you can edit it or start typing a new one
- Click any history item to recall it
Using the Function Panel
- Click the
fn ▾ button to expand the function drawer
- Click any function button to insert it into the expression
- Toggle DEG/RAD with the angle unit button inside the drawer
Adding Constants
- Enter a name (e.g.
g) in the name field
- Enter a value or expression (e.g.
9.80665) in the value field
- Click
+Add
- Click a constant row to insert it into the current expression
- Click
edit to load it back into the fields — change the value (or name) and click +Add again to save
- Click
del to delete it
Base Conversion
- Switch to the Base tab
- Type a value in any row — BIN, OCT, DEC, or HEX
- All other rows update automatically
Unit Conversion
- Switch to the Unit tab
- Type a numeric value in any prefix row
- All other prefix rows update automatically
Prime Factorization
- Switch to the Prime tab
- Enter a positive integer using the numpad or keyboard (max 10¹²)
- Press
= or Enter to factorize
- Click any history item to recall it
Keyboard Shortcuts
| Action |
Key |
| Evaluate expression |
Enter |
| Clear input |
Escape |
| Move between Base / Unit fields |
↑ ↓ |
| Clear all Base / Unit fields |
Escape |
Configuration
Calc Hub works out of the box, with one optional setting:
| Setting |
Description |
calcHub.accentPalette |
Accent color used for fn (function) buttons and labels. auto (default, theme-aware and tuned for contrast), magenta (original terminal-magenta accent), amber (fixed warm accent), teal (fixed cool accent). |
Change it via Settings → Extensions → Calc Hub, or search calcHub.accentPalette in the Settings search box.
Tips
Expression Syntax
- Multiplication:
× button or *
- Division:
÷ button or /
- Powers:
x² for squares, xⁿ for arbitrary exponents (e.g. 2^10)
- Percentage:
% evaluates as /100 (e.g. 200 × 15% → 30)
- Constants:
π and e are available directly
- Up to 30 saved constants; the oldest slot must be freed (or reused by name) once the limit is reached
Base Conversion Tips
- HEX input accepts lowercase letters too — they're automatically converted to uppercase as you type
- BIN results are formatted with spaces every 4 bits (e.g.
0000 1010)
- Supports values up to 64-bit unsigned (0 to 2⁶⁴−1) without losing precision
- Click copy next to any row to copy that value to the clipboard
Unit Conversion Tips
- Editing any row re-calculates all other rows from that value
- Press
Escape to clear all rows at once
- Click copy next to any row to copy that value to the clipboard
Prime Factorization Tips
- After factorizing, the input is selected — type a new number to replace it immediately
- Clicking a history item recalls the number and re-runs the factorization
- Supports integers from 1 to 10¹² (1 trillion)
- Click copy next to a history item to copy that factorization
License
MIT
日本語版 (Japanese)
VS Codeのサイドバーで動作するシンプルで高機能な計算機拡張機能。四則演算、三角関数、基数変換、SIプレフィックス単位変換、素因数分解をエディタを離れずに利用できます。
機能
🧮 基本計算機
- 数式入力: 数式を入力してEnterで評価
- 上付き文字のべき乗:
x²、xⁿ として自然に表示
- 括弧の自動補完:
( を入力すると ) が自動挿入され、カーソルが中に入る
- 桁区切り表示: 結果にカンマ区切りを自動付与
- 履歴: 過去の計算を保存・再呼び出し可能、コピーボタンで結果をコピー
- 定数保存: 名前付き定数(例:
c = 299792458)を登録して数式に挿入
📐 関数パネル(fn ▾)
- 三角関数: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh
- 対数: log₁₀, log₂, ln
- その他: √, |x|, π, e
- 角度単位切り替え: DEGとRADをワンクリックで切り替え
🔢 基数変換
- インライン入力: BIN、OCT、DEC、HEXそれぞれに直接入力
- リアルタイム同期: 入力中にすべての基数がリアルタイムで更新
- 入力バリデーション: 各欄はその基数で有効な文字のみ受け付ける
- BINフォーマット: 2進数は4ビットごとにスペース区切りで表示
📏 SIプレフィックス単位変換
- インライン入力: T、G、M、k、—、c、m、μ、n、pのいずれかの行に直接入力
- リアルタイム同期: 他のすべての行が即時更新
- 入力バリデーション: 数値のみ受け付ける
🔍 素因数分解
- 即時分解: 10¹²までの正の整数を素因数分解
- 上付き文字表示: 結果を
360 = 2² × 3² × 5 の形式で表示
- 素数判定: 素数には
(prime) を表示
- 数字キーパッド: 専用の数字パッド(数字・⌫・C・=)付き
- 履歴: 過去の分解結果を保存・再呼び出し可能、コピーボタンで結果をコピー
インストール
- VS Codeを開く
Ctrl+P (Mac: Cmd+P) を押す
ext install calc-hub と入力
- Enterを押す
または拡張機能ビュー (Ctrl+Shift+X / Mac: Cmd+Shift+X) で「Calc Hub」を検索。
使い方
基本計算
- Calc Hubサイドバーパネルを開く
- 入力欄に数式を入力(例:
sin(30) × 2 + 100)
Enter または = ボタンで評価 — 上に答えが表示され、入力欄の式はそのまま残る(選択状態)ので、そのまま編集も新しい式の入力も可能
- 履歴アイテムをクリックして再呼び出し
関数パネルの使い方
fn ▾ ボタンをクリックして関数ドロワーを展開
- 関数ボタンをクリックして数式に挿入
- ドロワー内の角度単位ボタンでDEG/RADを切り替え
定数の追加
- 名前欄に名前を入力(例:
g)
- 値欄に値または数式を入力(例:
9.80665)
+Add をクリック
- 定数の行をクリックして数式に挿入
edit をクリックすると入力欄に読み込まれるので、値(や名前)を変更して +Add を押せば上書き保存
del をクリックして削除
基数変換
- Base タブに切り替え
- BIN、OCT、DEC、HEXのいずれかの行に値を入力
- 他のすべての行が自動で更新される
単位変換
- Unit タブに切り替え
- 任意のプレフィックス行に数値を入力
- 他のすべての行が自動で更新される
素因数分解
- Prime タブに切り替え
- キーパッドまたはキーボードで正の整数を入力(最大10¹²)
= または Enter で素因数分解を実行
- 履歴アイテムをクリックして再呼び出し
キーボードショートカット
| 操作 |
キー |
| 数式を評価 |
Enter |
| 入力をクリア |
Escape |
| Base / Unit欄間の移動 |
↑ ↓ |
| Base / Unitの全フィールドをクリア |
Escape |
設定
Calc Hubは基本的にそのままで動作しますが、1つだけ任意設定があります。
| 設定 |
説明 |
calcHub.accentPalette |
fn(関数)ボタンなどのアクセント色。auto(既定・テーマに追従しつつコントラストを調整)、magenta(従来のターミナル紫)、amber(固定のアンバー)、teal(固定のティール)から選べます。 |
設定 → 拡張機能 → Calc Hub から、または設定検索で calcHub.accentPalette と入力して変更できます。
ヒント
数式の書き方
- 掛け算:
× ボタンまたは *
- 割り算:
÷ ボタンまたは /
- べき乗:
x² は2乗、xⁿ は任意のべき乗(例: 2^10)
- パーセント:
% は /100 として評価(例: 200 × 15% → 30)
- 定数:
π と e は直接利用可能
- 保存できる定数は最大30個。上限に達した場合は既存の定数を削除するか、同名で上書きしてください
基数変換のヒント
- HEX入力は小文字で入力しても自動で大文字に変換される
- BINの結果は4ビットごとにスペース区切りで表示(例:
0000 1010)
- 符号なし64bit(0〜2⁶⁴−1)まで精度を落とさず対応
- 各行の copy ボタンでその値をクリップボードにコピーできる
単位変換のヒント
- 任意の行を編集するとその値を基準に全行が再計算される
Escape で全フィールドを一括クリア
- 各行の copy ボタンでその値をクリップボードにコピーできる
素因数分解のヒント
- 分解後は入力欄が全選択状態になるため、そのまま新しい数字を入力すると上書きできる
- 履歴をクリックすると数字を呼び戻して再分解される
- 1以上10¹²(1兆)以下の整数に対応
- 履歴の copy ボタンでその分解結果をコピーできる
ライセンス
MIT
by uta
| |