As stated here the Spark View Engine’s Visual Studio Integration does not support the ReSharper intellisense code complete mode. This is a HUGE issue for me as I use a lot of ReSharper templates. Turning off the ReSharper code completion slows me to a crawl because the ReSharper templates no longer work. Major bummer. However, having intellisense in spark files is to die for so I was stuck in one mode or another.
To speed up the process of switching between the two modes I wrote a small AHK (Auto Hot Key) script to handle the mode switching for me.
By default I stay in the ReSharper mode of Code Completion. However, when I go into a .spark file I want the mode switched from Visual Studio to ReSharper. To do this, I merely hit the key combo “CTRL + SHIFT + 7”. Why “7”? Who knows. I didnt conflict with anything else I used so thats the one I’m going with. If you don’t like “7” you can switch it in the AHK Script.
When the app is triggered an icon with a Moon will show up in your tray. Mouse over it and you’ll see “Spark mode is off".” Trigger the mode while in Visual Studio and the icon will change to the Spark icon and the tool tip will say “Spark mode is on”.
Important Update 20090610 – There is a small issue with the script – when script runs, it runs the key combo ATL, R, O and then (down and enter). Basically it changes the "IntelliSense -> General" from ReSharper to Visual Studio (or vice versa). BUT, when The ReSharper window is opened for the first time (after initial install or after settings are reset) the Options window defaults to a blank screen that says "There are no items to show in this view". If you run the script at this point, the script terminates gracefully. To fix this, click the "IntelliSense –> General" option on the left hand side of the ReSharper options and close the window. Now run the script. It should work. 🙂
Here’s the script:
;======================================================================================= ;Enable/Reable ReSharper Intellisense AHK Script ; ;Description: ; Enables or disables the resharper option of intellisense. ; Toggle between resharper and Visual Studio intellisense with Ctrl + Shift + 7. ;======================================================================================= ;========================== ;Initialise ;========================== #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. EnabledIcon := "spark.ico" DisabledIcon := "sparksleep.ico" IsInSparkMode := false ; Start off in the off mode (to update the icon) SetIcon(false) ;========================== ;Toggle Switch ;========================== ^+7:: ToggleOptions(!IsInSparkMode) return ;========================== ;Functions ;========================== ToggleOptions(toActive) { Send, {ALTDOWN}r{ALTUP}o WinWait, ReSharper – Options, ,2 if ErrorLevel { return } IfWinNotActive, ReSharper – Options, , WinActivate, ReSharper – Options, ,2 if ErrorLevel { return } WinWaitActive, ReSharper – Options, ,2 if ErrorLevel { return } SetIcon(toActive) Send, {TAB}{DOWN}{ENTER} } SetIcon(toActive) { local iconFile := toActive ? EnabledIcon : DisabledIcon local state := toActive ? "ON" : "OFF" IsInSparkMode := toActive Menu, Tray, Tip, Spark mode is %state% Menu, Tray, Icon, %iconFile%, }
Download
Includes a .exe (precompiled) as well as the source and icons.
Leave a Reply
You must be logged in to post a comment.