c# - VS2010 Extensibility: Custom document formatting -


good afternoon,

i've created visual studio package registers verilog language valid content type.

i've got syntax highlighting, outlining, smart indenting, etc working.

however, able visual studio automatically format entire document via edit->advanced->format document/selection. these options invisible, , expect have let vs2010 know (somehow) these methods can called, , provide correct methods formatting.

i can't seem find reference formatting in vs2010 sdk , documentation. hoping ismartindent solution looking for, seems code runs on empty line, or when enter key pressed.

does have tips or ideas on how can solve problem?

thanks,

giawa

edit: i'm using managed extension framework introduced vs2010 accomplish this. i'm writing in c# (and added c# tag question). thanks

mef not right way accomplish task of creating language service. instead, managed package framework (mpf) should used register language service , perform tasks such syntax highlighting, outlining, parsing, formatting, parsing, etc.

since question formatting, i'll cover little bit of in answer. must override reformatspan method in custom source object you've creating language service. there's example on msdn webpages vs2005 (applicable vs2010 well).

you can force formatting @ time calling reformatspan method directly. here's working example code:

region region = service.getregioncontainingline((line > 0 ? line - 1 : 0));  if (region != null) {     using (editarray mgr = new editarray(this, service.lastactivetextview, true, "reformat brace"))         this.reformatspan(mgr, region.tospan()); } 

thanks @james mcnellis pointing me in correct direction.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -