roslyn:encapsulate_field
Generate a property with getter and setter from a field declaration. Use file path and zero-based cursor position to refactor the code.
Instructions
Convert a field to a property with getter/setter.
USAGE: Position cursor on a field declaration. OUTPUT: Generated property wrapping the field. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filePath": "<filePath>",
"line": "<line>",
"column": "<column>"
},
"name": "roslyn:encapsulate_field"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number on the field | |
| column | Yes | Zero-based column number | |
| preview | No | Preview mode (default: true) | |
| filePath | Yes | Absolute path to source file |