Select Member
A Visual Studio Code extension that streamlines the process of selecting entire C# members—methods, constructors, structs, enums, or classes—by leveraging OmniSharp’s DocumentSymbolProvider.
Features
Select Entire C# Members
Place your cursor within a method, constructor, struct, enum, or class definition, then run the command Select Member from the context menu or manually (gdd.selectMember ). The entire definition is highlighted instantly.
Seamless OmniSharp Integration
Uses VS Code’s built-in vscode.executeDocumentSymbolProvider (powered by OmniSharp) to accurately detect and highlight C# symbols in source files.
Pre-Warmed Symbol Cache
The extension “warms up” the OmniSharp symbol provider when you open a file, minimizing delays and ensuring quick selection commands.
Selecting a C# Member in action:

Requirements
- Visual Studio Code version 1.60.0 or higher
- C# (OmniSharp) Extension for VS Code
No additional setup is needed beyond having a functioning C# environment in VS Code.
Usage
- Open a C# file in VS Code.
- Place your cursor anywhere within the member (method, constructor, struct, enum, or class) you want to select.
- Right-click and choose
Select Member , or open the Command Palette and run Select Member .
That’s it! You’ll get the entire member highlighted for easy copying or pasting.
Extension Settings
This extension has no specific settings. Its primary functionality is invoked via the Select Member command.
Known Issues
Structs/Enums Mislabeling
Occasionally, OmniSharp may categorize a struct or enum as a class symbol. This extension checks if the line includes struct or enum , usually ensuring correct selection despite the mislabel.
Symbol Cache Delays
In large codebases, OmniSharp might take a few seconds to initialize symbols when a file is first opened. If you attempt to select a member too early, you might see a “No recognized member found” message. The extension retries automatically, so just wait a moment and try again.
Single-Line Definitions
If a member is defined entirely on one line (including its braces), the selection might be off. The extension attempts to handle this by scanning for matching braces, but there may be edge cases.
Release Notes
1.0.0
- Initial release of select-c-member-cs (packaged as
"select-member-cs" ).
- Key Features:
- Select entire C# methods, constructors, classes, structs, and enums.
- Basic handling to detect struct or enum definitions.
For feedback, questions, or contributions, please open an issue or pull request on the GitHub repository.
Enjoy “Select Member”!
We hope this extension helps speed up your workflow. Let us know if you have any suggestions to make it better.
| |