Skip to content

lucianodlf/gplnr

Repository files navigation

gplnr (Get path line number reference)

Copies a clean @relative/path#Lstart-end reference of the active file and selection to the clipboard, and sends it to the active integrated terminal / Claude Code CLI.

Installation

Download from the official OpenVSX registry: https://open-vsx.org/extension/lucianodlf/gplnr

curl -L -o gplnr.vsix "https://open-vsx.org/api/lucianodlf/gplnr/0.0.1/file/lucianodlf.gplnr-0.0.1.vsix"

code --install-extension ./gplnr.vsix

# with a specific profile
code --profile "<your-profile>" --install-extension gplnr.vsix --force

After installation, run the command palette and select "Developer: Reload Window" to activate the extension.

Usage

Keybinding: ctrl+alt+k (editor must have focus).

Output examples:

  • No selection: @src/app.js
  • Single-line selection: @src/app.js#L12
  • Multi-line selection: @src/app.js#L12-40

Terminal

If an integrated terminal is active, the text is pasted into it. Otherwise, only the clipboard is updated — no new terminal is created.

Settings

  • gplnr.useAbsolutePath (boolean, default false): use the absolute path instead of the workspace-relative one.

Keybinding conflict with the Claude Code extension

If you have the official anthropic.claude-code extension (Claude Code CLI for VS Code) installed, it registers its own command on ctrl+alt+k:

command: claude-code.insertAtMentioned
key (linux/win): ctrl+alt+K
when: editorTextFocus

Same shortcut, same when clause as gplnr.copyReference. claude-code.insertAtMentioned wins: pressing ctrl+alt+k opens the Claude Code terminal and inserts an @mention there instead of running gplnr, and nothing is copied to the clipboard.

To free up ctrl+alt+k for gplnr only, add this to your user keybindings.json (Preferences: Open Keyboard Shortcuts (JSON)):

{
  "key": "ctrl+alt+k",
  "command": "-claude-code.insertAtMentioned",
  "when": "editorTextFocus"
}

The - prefix on command disables that specific binding without uninstalling or reconfiguring the extension. Alternative: change the key for gplnr.copyReference in package.json to a free combination.

Tests

buildReference (the only branching logic: #L suffix, useAbsolutePath, separator normalization) has unit tests via node --test — no new dependencies, no VS Code startup. test/vscode-stub.js intercepts require('vscode') with a minimal stub (workspace.getConfiguration, workspace.asRelativePath) before loading extension.js.

npm test

Local install (no debugging)

npm run package && code --profile "<your-profile>" --install-extension gplnr-0.0.1.vsix --force

If you use VS Code profiles (Profiles: Create Profile / profile picker bottom-left), --profile is required: without it, code --install-extension installs the files but registers them under the default profile, not the one you have open — the extension ends up on disk but invisible in the editor. Find the active profile name via Profiles: Show Profile Contents in the command palette, or by checking userDataProfiles in ~/.config/Code/User/globalStorage/storage.json.

About

simple vscode ext "Get Path Line Number Reference"

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors