Visual Studio 2010 extension that does code expansion -
i want build visual studio 2010 vsix extension expands text based on call method (using zen coding selector-based syntax). ideally, user type string of text, hit hotkey, , string of text expanded.
i've looked @ lot of samples, focus either on full-blown language services or on simple adornments. ideally, i'd find full working sample, i'd happy interfaces / classes , code.
some references looked at:
- http://msdn.microsoft.com/en-us/library/bb165336.aspx
- http://msdn.microsoft.com/en-us/vstudio/ff718165.aspx
- http://msdn.microsoft.com/en-us/library/ee372314.aspx
update: know resharper , coderush kind of thing. i'd stand-alone plugin if possible.
it sounds you're looking example / reference on how keyboard handling drive text insertion visual studio buffer.
unfortunately not question has straight forward answer. keyboard handling in visual studio complex @ best , hair pulling frustrating @ times. i've tried keep answer simple possible unfortunately topic doesn't lend simplicity
to start there @ least 5 different mechanisms visual studio routes keyboard input commands.
- binding known visual studio commands
- via keyprocessor (2010 , above only)
- via ivsfilterkeys.translateaccelerator (2005 , above iirc)
- via iolecommandtarget
- alt key mapping (something don't understand @ all)
which of these need hook depends on couple of factors
- what versions of visual studio want addin function in?
- what type of add-in building: actual addin, vs package or vsix
- how care winning battle keyboard input
which of these need hook depends lot on how want addin function , in versions of visual studio want work. though there 2 basic routes can take though
the first develop visual studio package , register dte.command
every hotkey in extension. you'd need add on iolecommandtarget
ivstextview
s filter chain process commands. approach allow process hot keys in majority of scenarios.
the second develop vsix, hook iolecommandtarget
chain of ivstextview
, intercept real visual studio commands map hot keys.
both of these approaches have ups , downs answer bit long is. if can give me more details can try , give more concise , helpful answer.
as examples. vsvim pretty extensive keyboard handling visual studio , has example of above methods mentioned.
let me know 1 interests , can point right place in source code.
additionally while working myself on figuring out tangle of keyboard input tried keep record of i'd learned. it's not date document describes more basic aspects of how input gets routed
edit
jon indicated in comments vsix + iolecommandtarget
route
this imho simplest approach. 1 thing aware of though how command bindings affects data gets passed down iolecommandtarget
chain. visual studio command binding happens before data passed iolecommandtarget
chain. if given key input bound command passed down iolecommandtarget
command , not keyboard input.
for example ctrl-z
commonly mapped visual studio undo
command. if user hits ctrl-z
iolecommandtarget
see undo command , not keyboard input ctrl-z
.
here few samples may interested in looking at
- vscommandtarget: sample implementation of
iolecommandtarget
- olecommandutil: used convert data passed
iolecommandtarget
actual commands , keyboard input - hostfactory: details how hookup
iolecommandtarget
ivstextview
vsix extension.
Comments
Post a Comment