Having trouble porting PowerToys.FindText sample to R#9.0

29 views
Skip to first unread message

Dave Castelnuovo

unread,
Apr 10, 2015, 3:24:32 PM4/10/15
to resharpe...@googlegroups.com

Posted this on the resharper forums but hoping to get a faster response so I can move onto my actual plugin.



having trouble installing the findText sample code in R#9. the version from github. https://github.com/JetBrains/ReSharperPowerToys

 

I fixed all the namespace issues and have is compiling with a few warnings. Mainly architecture mismatch, referenced component cant be found for cxLex etc. but it dosnt look like any of the warnings should affect the plugin.

 

I created a nupkg, and every time it changes I uninstall the old one, quit, install the new one, quit. then run it in the debugger. each time I run it with /rootSuffix Plugins /ReSharper.Internal

 

The extention manager sees it as being installed but I dont see the action in the ToolsMenu. I also dont see any references to FindText in the console. This makes me think that it might be an install problem.

 

*** is there anyway to get a log of the installed extensions or to see if there was a problem installing something?

 

Here is my Zone Marker.  for now just making it wide open to minimize errors.

namespace JetBrains.ReSharper.PowerToys.FindText

{

    //[ZoneDefinition]

    //public interface IZenSharpZoneDefinition : IZone

    //{

    //}


    [ZoneMarker]

    //public class ZoneMarker : IRequire<IZenSharpZoneDefinition>

    public class ZoneMarker

    {

    }

 

}

 *** here is my action

namespace JetBrains.ReSharper.PowerToys.FindText

{

    [Action"Find Text Special", Id = 66602)]

    public class FindTextAction : IExecutableActionIInsertFirst<ToolsMenu>

    {

        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)

        {

            // Check that we have a solution

            return context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION);

        }


        public void Execute(IDataContext context, DelegateExecute nextExecute)

        {

            // Get solution from context in which action is executed

            ISolution solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);

            if (solution == null)

                return;


            var documentManager = solution.GetComponent<DocumentManager>();

            var shellLocks = solution.GetComponent<IShellLocks>();

            var settingStore = solution.GetComponent<ISettingsStore>();

            var mainWindow = solution.GetComponent<IMainWindow>();

     

            // Ask user about search string

            FindTextSearchRequest searchRequest;

            using (var dialog = new EnterSearchStringDialog(settingStore.BindToContextTransient(ContextRange.Smart((lt, contexts) => context))))

            {

                if (dialog.ShowDialog(mainWindow) != DialogResult.OK)

                    return;


                // Create request, descriptor, perform search and show results

                searchRequest = new FindTextSearchRequest(solution, dialog.SearchString, dialog.CaseSensitive, dialog.SearchFlags);

            }


            using (shellLocks.UsingReadLock())

            {

                var descriptor = new FindTextDescriptor(searchRequest);

                descriptor.Search();

                FindResultsBrowser.ShowResults(descriptor);

            }

        }

    }

 

}

 

here is my nuspec

<?xml version="1.0"?>

<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">

  <metadata>

    <id>JetBrains.FindText</id>

    <title>FindText for ReSharper 9)</title>

    <version>1.2.0</version>

    <authors>JetBrains</authors>

    <owners>JetBrains</owners>

    <requireLicenseAcceptance>false</requireLicenseAcceptance>

    <projectUrl>https://github.com/JetBrains/resharper-angularjs</projectUrl>

    <licenseUrl>https://raw.github.com/JetBrains/resharper-angularjs/master/license.txt</licenseUrl>

    <iconUrl>https://raw.github.com/JetBrains/resharper-angularjs/master/icon.png</iconUrl>

    <description>Not sure what it does</description>

    <releaseNotes>&#8226; Support for ReSharper 9.0</releaseNotes>

    <dependencies>

      <dependency id="Waveversion="[1.0]" />

    </dependencies>

    <tags>resharper angular angularjs javascript js typescript</tags>

  </metadata>

  <files>

    <file src="bin\Debug\FindText.dll"

          target="dotFiles\" />

  </files>

 

</package>

Matt Ellis

unread,
Apr 13, 2015, 4:44:06 AM4/13/15
to resharpe...@googlegroups.com
Hi Dave. The code you're posting looks fine. I don't see anything obvious that would stop this from working.

You can see the logs from the installer in %LOCALAPPDATA%\JetBrains\Shared\v01\, and you can search the file to see if your package or assembly is mentioned and what's going on, but if the extension manager says that it's installed, I'd be surprised if you'll see anything there.

And you can turn on verbose logging, and look to see what's going on when your extension is loaded (search for the assembly file name). If there's something wrong with your zones (although it doesn't look like it), then it'll be reported in the logs. As you're running in internal mode, you can enable logging a bit easier, by using the logging options page.

You also don't need to install/uninstall all the time - once you've installed once, you can generally just update the assembly files in the install location. The only time when you do need to reinstall a locally built extension is when you've changed something to do with Visual Studio integration. ReSharper 9 registers with VS statically - this means things likes colours and highlights but more specifically, Actions. If you add/remove or change any of the significant attributes of an Action (essentially, if you change anything in the ActionAttribute, you'll need to reinstall or update the extension.

Hope this helps
Matt

Dave Castelnuovo

unread,
Apr 13, 2015, 7:54:37 PM4/13/15
to resharpe...@googlegroups.com
I checked out the installer logs and found references to the plugin but didnt find any smoking guns. 

I enabled verbose logging and can't find any reference to the "FindText" plugin despite it showing up in the extension manager.

Is there any issue that would install the plugin but somehow not run it? like maybe something is not getting copied into the assembly?

The main reason why I am uninstalling and reinstalling is because the main functionality is an action and I dont see it registering with the menu. so I assume that I have to keep reinstalling until I see the menu item in place and then I can start just updating the assembly files.


Reply all
Reply to author
Forward
0 new messages