Changing default new editor group location on VS Code - user-interface

Strangely enough, I haven't been able to find questions over SO or through search engines in general of people who want to change where VS Code opens a new editor group by default. In my case, I am trying to make the MSSQL extension open a query's results in a pane below the current one.
However, there doesn't seem to be a ready solution for this. In settings.json, it is possible to change the behaviour of these splits directly:
"mssql.splitPaneSelection":"current"
However, the only possible values this field can take are next, current and end. I also tried to change editor positioning on the workbench settings:
"workbench.editor.openPositioning": "left"
But this setting doesn't have a below option as well, only left, right, first and last.
Is it possible to make these panels open below the current editor? If so, how and how to carry these settings to the MSSQL extension? (most likely using next or end as the parameter for a new pane)

I found out randomly in the VS Code docs. All you need is to set the direction in settings.json:
"workbench.editor.openSideBySideDirection": "down"
I haven't tested with the MSSQL extension since I'm not using it anymore, but it should be fine if I'd guess.

Related

The Scite open filter is not working properly, how do I get the open dialog drop down menu showing filters?

In Scite text editor there is a global properties file shipped with the editor. I downloaded Scite latest version from the website but when I open the open dialog in scite, not all the filters show up in the drop down menu. For example, verilog, TeX, and many more filters do not show up, even though they are enabled in the sciteglobal.properties file under open.filter
Is this a bug in scite or am I missing something?
For example some filters that do work are perl, lua, ada - but tex, verilog, pascal, and more do not show up in the drop down. They are not commented out in the global properties file.
A temporary work around is to move them around to different spots in the global properties file. for example if I move them to non alphabetical order and put them at the very top, they seem to be enabled.
I know the ALL SOURCE files filter is limited to 256 characters or something similar, but the individual filters should not be limited in the drop down menu and they should not be missing.. right?
I compiled scite from the source code myself, and it has the same problem. Or is there something as designed that I am missing and this is not a bug?
Found a solution to my own question...
The default sciteglobal.properties file that ships with scite is incorrect. It is parsed wrong due to the commenting out of items such as modula open filter. Remove all pound signs in the open filters so nothing is commented out in the open filter list, and this fixes the problem.
Instead of commenting out the items in open.filter list, use imports.exclude to remove an item from being seen.

Extend visual studio code editor

I'm looking at creating an extension that can essentially generate code at the cursor position.
So to use the extension you would click anywhere (for example in a method), and then right click, context menu comes up, select a custom menu option (something that is part of the extension), and then after this selection it would run some business logic and generate code at the cursor position.
As far as I know T4 templates are only good for generating whole files. So I guess the route to go is create an extension.
Just to be clear I'm not looking for a full solution, just a overview of what to how to go about doing this. I've started by creating a Visual Studio package.
And now would like to just get some basic grips with what objects to use to implement the custom right click command and how to deal with the active document.
Just a push in the right direction would be great.
You need to create a command in your VSCT, handle it using MenuCommandService, get the active text view, and replace or insert text into its buffer.

How to make Solution Explorer return to its previous state after clearing search?

I currently have a VS installation with no extensions to see how that works out. For navigation that means making heavy use of Ctrl+; aka Search Solution Explorer. While the search itself is ok, it has one major drawback for me that makes it a pain to use for me (both with keyboard and mouse):
Solution with two projects, one collapsed, one opened:
Use Ctrl+; and start typing until match found from collapsed project
What I want now is to simply clear the search and return to the previous view. Seems like a pretty standard requirement, no? But there seems to be no such functionality built in. Problem with the current commands that come close (pressing Esc, clicking Back or Home buttons in Solution Explorer Toolbar) is all the same: they have the extremely annoying behaviour that they insist on suddenly uncollapsing the previously collapsed project and track the match found! (Btw the Track Active Item in Solution Explorer option is turned of in the options). This makes no sense from a UX point of view? You select some kind of 'undo' command, the search box clears which is expected, but then suddenly there's an item visible from a previous search:
So if the collapsed project has like 50 items in it, solution explorer is now useless visually since it litters the screen with stuff you don't want to see, and worse you have to manually collapse the project again to return to the previous view.
Is there a way around this? I thought maybe keyboard shortcuts for Back/Home would be different, but the commands do not seem to be registered. I looked into EnvDTE80.DTE2.ToolWindows.SolutionExplorer but it has no properties/methods that have anything to do with this issue. And somewhere in the tree there is a Microsoft.VisualStudio.PlatformUI.SolutionPivotNavigator which is probably the class responsible for this behaviour, but I have no idea how to access it?
Recently updated to VS2013 SP3 and I have the impression there was a change (or I didn't notice this properly earlier, though my question says otherwise): if I use the Back button in the Solution Explorer view it properly takes me back to the previous view without expanding anything that wasn't expanded before. Using Esc or clearing the search box still behave the same which is a pitty, but at least if I remember to use just the back button it's workable.
update Not really an answer but since I started using Edit.NavigateTo (which is basically 'Go to Anything' including symbols/files) bound to a keyboard shortcut I found no reason to use Window.SolutionExplorerSearch anymore.

How to stop Visual Studio from moving and/or resizing controls when opening a project?

I have a certain project that's been problematic in visual studio. The main form has a TabControl with four tab pages, and during initial development, the entire contents of the third tab page would shift down each time the project was opened. (It got really bad if you didn't look at that page for a few days, and the next time you ran the program, you had to scroll down past all the blank space that had built up before getting to any content.) That was relatively easy to work around by selecting everything and dragging it back up to the top.
Since the project has gone into maintenance/enhancement mode, the third tab page hasn't had any problems, but several controls on the fourth tab page are being re-sized (a small increase in width) or shifted left (a large decrease in X-position). Again, these same controls are affected each time the project is opened, so if you don't fix them each time, they'll continue to get further away from their correct settings.
The problem description is a lot like this other question; one notable difference is that the designer source file is not changed, i.e., I can open the designer source file in a separate text editor and see the correct values for location and position of all the affected controls, while at the same time I have the project open in Visual Studio and see the incorrect values in the Properties window. (Doing a "Save" or "Save All" doesn't affect the designer source file after just opening the project, but changing anything on the form and then saving it will make the source file match the incorrect values from Visual Studio.)
Any ideas about why Visual Studio is displaying the form incorrectly? I'd really like to avoid having to spend the extra time to fix it every day. And I'm not keen on adding code to the constructor to re-set those properties, as suggested elsewhere (violation of SPOT/DRY rule, you know--fraught with peril).
You can compare the Designer.vb file of the problem form from one version to the next. (Click Show All Files in Solution Explorer). That should tell you what is being changed and maybe you can find a workaround.
I've had similar problems that were resolved by uninstalling and reinstalling Visual Studio.
I finally found a way to get around this. When I set the affected form's Minimum Size property in the designer to something other than 0,0 (such as the current size of the form) some of the controls relocate themselves the next time I open the form. Setting Minimum Size back to 0,0 resolves it. The affected controls either have no Anchor setting or have Anchor set to Bottom.
So its seems the combination of Anchor Bottom and non-zero Minimum Size is what makes this unwanted movement happen.

How do I hide Visual Studio Add-in disabled commands

I created a Visual Studio Add-in that adds additional commands (four of them) to the top of Code Window context menu. I'm using permanent UI approach. Depending on the cursor position within code only one of the commands would be visible and thus selectable. Other three would be hidden.
I set supported and enabled status within QueryStatus method that does the trick for the correct command and unsupported and invisible for the rest.
The problem
The first time add-in is installed all works well. I can only see a single command in the context menu. The rest are always hidden.
The second time I load VS IDE I detect the same commands and controls (so I don't recreate something that's already there), but now all of the commands (or better
CommandBarControl/CommandBarButton controls) are visible. Instead of hiding 3 and showing only one I can see all four of them. The correct one is enabled and the rest of the pack is disabled/grayed out.
The question
How do I hide existing commands (or CommandBarButton controls) on the next IDE load? I tried setting button's Visible property to false but then even the correct control isn't displayed.
Have you tried having a single command, and changing the text of command depending on the cursor position? I'm not sure if this is possible, just a suggestion.
Solution I used at the end was:
Delete controls at IDE startup (or Add-in after startup if not enabled at IDE startup by default). Deleting commands also removes any controls
Recreate commands and controls and their visibility will work as expected.

Resources