getting the most from xamarin studio - michael hutchinson
DESCRIPTION
TRANSCRIPT
Getting the Most from Xamarin Studio
Michael Hutchinson So!ware Engineer Xamarin [email protected]
Customizing the Workspace
Your Workspace
Document Solution Pad
Global Search Configuration/Target
Selectors Notification Area
Auto-hidden Pads
Key Bindings • Do common things more quickly
• See them in menus and global search
• Find them and rebind them in Preferences
• Preferences è General è Key Bindings
• Access many hidden commands!
Editor Behavior • Preferences è Text Editor
• Enable code folding, auto-formatter
• Enable markers and visual guides
• Change word breaking mode
• Even vi emulation!
Build Behavior • Preferences è Projects è Build
• Jump to errors, warnings, or neither
• Message bubbles or error pad
• Save files before build, ask or ignore
• Whether to build before running
Policies • Solution-specific style settings: formatting, naming
conventions, file header, etc.
• Edit in Solution Options
• User Preferences only apply to new solutions
• Manage policies in Custom Policies dialog
DEMO
Getting Around Quickly
Global Search • Activate with ⌘. on Mac, Ctrl-, on Windows
• Navigate to files, types, members, commands
• Smart camelCase search
• Type filter prefixes – file:, class:, command:
• Location suffix – :line,column
Find and Replace • Inline search– click magnifying glass for options
• Find in Files – search/replace in project/solution Cmd-Shi!-F (Mac), Ctrl-Shi!-F (Windows)
• Pin search output pads to keep results – next search will use new pad
Navigation • Go To Declaration – go directly to type, local, member
Cmd-D (Mac), F12 (Windows)
• Find References – find all places anything is used Cmd-Shi!-R (Mac), Shi!-F12 (Windows)
• Navigate back to where you were Ctrl-Cmd-Le! (Mac), Ctrl-Alt-Le! (Windows)
DEMO
Efficient Editing
Code Completion • Use camelCase to search
• Import type, add the using automatically: Ctrl-Alt-Space
• Toggle suggestion mode, explicit commit: Ctrl-Shi!-Space
Hidden Editor Commands
• Expand selection: Alt-Shi!-Up
• Move line up/down: Alt-Up/Down
• Block selection – edit many columns at once Alt (Mac), Ctrl (Windows) and mouse drag
Context Actions • Contextual code transformations
• Over 70 available, see Preferences è�
Source Code è C# è Context Actions
• Access via context menu è Refactor
• From keyboard, Alt-Enter
Source Analysis
• Analyses source code on the fly
• Warns of potential errors and style violations
• Offers automatic fixes as context actions
• Hints when context actions available
• Customizable severity of rules
• Preferences è Text Editor è Source Analysis
Experimental
DEMO
Advanced Debugging
Debugger Options • Preferences è Projects è Debugger
• Enable stepping into framework code
• Speed up debugging by disabling automatic ToString() and property evaluation
Advanced Breakpoints • Tracepoints – print expression and resume
• Conditional breakpoints – automatically resume unless expression evaluates to true
• Run è New [Function] Breakpoint…
• Context menu è Breakpoint Properties
Watches • Watch any expression, not just variables
• Turn hover inspection into pinned watch on editor surface by clicking pin icon
• Watches/locals turn blue when value changes
DEMO
Adding Features with Add-ins
Creating Add-ins
• Whole IDE built on add-in model, extremely extensible
• Commands, templates, build, syntax schemes, context actions, pads, editors, analysis rules, project types…
• Most of the IDE is open-source (MonoDevelop)
• Publish at http://addins.monodevelop.com, install from Add-in Manager
DEMO
Resources • My blog
http://mhut.ch
• Xamarin Studio Forums http://forums.xamarin.com/categories/xamarin-studio
• Stack Overflow http://stackoverflow.com/questions/tagged/xamarin-studio
• MonoDevelop Developer Resources http://monodevelop.com/Developers
Q&A
THANK YOU
Navigation Commands
Command Mac Windows
Go to Definition Cmd-D F12
Find References Cmd-Shi!-R Shi!-F12 Navigate Forward/Back Ctrl-Cmd-Le!/Right Ctrl-Alt-Le!/Right Next/Previous Result Cmd-Opt-Up/Down F4 / Shi!-F4 Find in Files Cmd-Shi!-F Ctrl-Shi!-F
Find Cmd-F Ctrl-F
Next/Previous Usage Cmd-Shi!-Up/Down Ctrl-Shi!-Up/Down
Hidden Editor Commands
Command Mac Windows
Expand selection Alt-Shi!-Up
Insert line below Shi!-Enter
Dynamic abbrev Ctrl-/ Alt-/
Delete to end of line Ctrl-K
Move line up/down Alt-Up/Down
Subword motion Ctrl-Le!/Right Alt-Le!/Right
Block selection Alt-Mouse-Drag Ctrl-Mouse-Drag
Debugger Commands
Command Mac Windows
Start/Resume Cmd-Enter F5
Pause Cmd-Opt-P Ctrl-Break
Toggle Breakpoint Cmd-\ F9
Step Over Cmd-Shi!-O F10
Step Into Cmd-Shi!-I F11
Step Out Cmd-Shi!-U Shi!-F11
THANK YOU
Code Generation Window • Contextual generation of members/statements
• Depends on context
• Edit è Show Code Generation Window
• Alt-Insert on Windows
Catchpoints • Pause at the point an exception is thrown, even
if it’s handled
• Run è Exceptions, add exception types to the list
• Breaks on all subtypes
Code Templates • Code snippets with smart linked regions
• Edit è Insert Template/Surround With...
• Or type short name, Tab twice
• Create and edit in Preferences è Text Editor è Code Templates
Inspect Threads and Stack Frames • Double-click thread in threads pad to show stack
• Double-click stack frame to show location
• External code frames show in italic
• Editor highlights current stack frame in yellow and other frames in green