Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open a solution item in a new tab group in VSIX (visual studio extension) #111

Open
ghost opened this issue Nov 14, 2017 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Nov 14, 2017

I want to write an extension to open automatically the CSS file related to a LESS or SASS file in a new vertical tab group. It should create a new tab group if there is not any or use it if there is an existing tab group.


    void DoIt()
    {
        var dte2 = ((IServiceProvider)package).GetService(typeof(SDTE)) as EnvDTE80.DTE2;

        var currentActiveWindow = dte2.ActiveWindow;

        if (!IsItALessOrSassFile())
            return;

        var item = dte2.Solution.FindProjectItem(GetTheCssFileNameOfTheCurrentFile());
        item = item ?? throw new Exception();

        if (item.IsOpen)
            return;

        var window = item.Open();

        // I could not find any property or method to force the window to be opened in a new tab group.

        window.Activate();

        window.Document.ReadOnly = true;

        currentActiveWindow.Activate();            
    }

I mean the result should be somthing like this.

ksgcr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants