Saucer

A VS Code extension that provides IntelliJ WebStorm-like copy reference functionality1. Easily copy Markdown style code references with source links for sharing.
1: Tested with TypeScript but should work with other languages where VS Code symbol detection works
Features
- Copy symbol references in various formats
- Automatically include source code links to GitHub, GitLab, Bitbucket, or Azure DevOps
- Reference format options (symbol, line, defaults to ask)
- Context menu integration
- Keyboard shortcuts
Usage
- Place your cursor on a TypeScript symbol or select a few lines of code
- Right-click and select "Copy Reference" or use the keyboard shortcut (
Alt+Shift+C
on Windows/Linux, Opt+Shift+C
on macOS)
- Choose a reference format when prompted:
- Symbol: Copies the symbol path; i.e.
Class.method
- Filename (with line): Copies the file name with line reference; i.e.
foo.ts:10
- Filename (no line): Copies the file name without line reference; i.e.
foo.ts
The copied reference includes a link to the source code repository when configured and available.
Examples
Symbol References
When you place your cursor on a symbol and copy a reference:
`getSymbol` ([GitHub](https://....))
With relative path enabled:
`src/utils/symbol.ts:getSymbol` ([GitHub](https://....))
Line References
When you place your cursor on a specific line:
`git.ts:42` ([GitLab](https://....))
Selection References
When you select multiple lines:
`referenceRange.ts:10-20` ([Bitbucket](https://....))
Different Git Providers
When source link is enabled (default) appropriate links are generated on your working repository:
- GitHub:
([GitHub](https://github.com/user/repo/blob/[branch]/src/utils/[file]#L[number]))
- GitLab:
([GitLab](https://gitlab.com/user/repo/-/blob/[branch]/src/utils/[file]#L[number]))
- Bitbucket:
([Bitbucket](https://bitbucket.org/user/repo/src/[branch]/src/utils/[file]#lines-[numbers]))
- Azure DevOps:
([Azure DevOps](https://dev.azure.com/organization/project/_git/project?path=src%2futils%2fvscode.ts&version=GB[branch]&line=[number]&lineEnd=[number]))
Extension Settings
This extension contributes the following settings:
saucer.includeRelativePath
: Include relative file path in references (default: true
)
- When
true
, references include the path, i.e. src/foo.ts:10
- When
false
, references include the only the filename, i.e. foo.ts:10
saucer.linkSource
: Include source code links when available (default: true
)
- When
true
, appends source link as described in 'Different Git Providers' section and formats the reference in Markdown.
- When
false
, just returns the reference in plaintext.
saucer.cursorReferenceType
: Default reference type for cursor position (default: Ask
)
- Options:
Ask
, Symbol
, Filename (with line)
, Filename (no line)
saucer.selectionReferenceType
: Default reference type for selections (default: Ask
)
- Options:
Ask
, Symbol
, Filename (with line)
, Filename (no line)
Requirements
Installation
- Open VS Code
- Go to Extensions view (Ctrl+Shift+X)
- Search for "Saucer"
- Click Install
Keyboard Shortcuts
- Windows/Linux:
Alt+Shift+C
- macOS:
Alt+Shift+C
Supported Git Providers
License
MIT