VS Code setting to collapse activity bar on focus change - vscode-extensions

Couldn't find an answer on here or elsewhere.
It's just a convenience feature that I would use. I prefer to use the screen space on split editors, and it would save me the effort of manually closing the activity bar.

I don't believe that is a feature that VS Code has implemented. Feel free to reach out to the developers on GitHub here: https://github.com/Microsoft/vscode
In the meantime, you can create a hotkey that will hide the activity bar.
{
"key": "ctrl+shift+b",
"command": "workbench.action.toggleActivityBarVisibility"
},

Related

Turn off this quick-info -like UI feature off in VS2022?

In Visual Studio 2022 (v 17.3.6), I would like to be able
Identify this UI hint/tooltip/feature of the C# editor. It comes up merely when hovering
over anything/everything, and clutters up the screen greatly.
Partially turn it off. In particular I would like to see this only after I have
pressed a hot key/chord or clicked, etc. In other words, I only want it to appear once I have done something more "active"
than merely hovering the mouse over the code.
I searched google, and Tools > Options in VS2022. I have tried all the options that make
mention of IntelliSense, "quick info", and "inline hints", turning each off in turn.
Nothing seems to turn off. I would like an in-VS solution if there is one, rather than yet another VSIX package that does other things I don't want.

jupyterlab keyboardshortcuts: Which selector to use

I'm trying to set 3 keyboards shortcuts in jupyterlab. I go about this via settings / advanced settings editor / keyboard shortcuts, that's the only method I'm aware of.
I'm trying to set:
notebook:run-all-cells
notebook:run-all-above
notebook:run-all-below
I've experimented with the selectors that work for restart-and-clear: "selector": "[data-jp-kernel-user]:focus" and several others, not really understanding what they were to be honest, but I couldn't get it to work. Can someone tell me which selector I need to use here? How does one go about figuring this out?
Thanks
Since you are trying to run cells, presumably having one of the cells selected, I would use [data-jp-code-runner], for example:
{
"command": "notebook:run-all-cells",
"keys": ["F9"],
"selector": "[data-jp-code-runner]"
}
To discover a selector in the future you can search the list of existing shortcuts in the left panel. for example searching for Shift Enter or run keyword brings up:
{
"command": "runmenu:run",
"keys": [
"Shift Enter"
],
"selector": "[data-jp-code-runner]"
},
Alternatively you could:
use just body if you want the shortcut to be always active (even though it may error if executed when focus is not on appropriate element)
(advanced) use web developer inspector tool in your browser to determine the web query (CSS) selector for the element of interest

How to center the editor window back on the cursor in VSCode?

I'm using VSCode as my text editor. I'm curious, is there a keybinding for centering the editor window on the cursor, when the window is a lot of lines below/above it such that it's not visible on the screen? I've tried looking at the default keybindings by going to FIle > Preferences > Keyboard Shortcuts, but I see no such options for centering the window.
There is no such keybinding / command built-in.
I couldn't stand that either, so I created a VSCode extension. You can find it and install it here on the marketplace. The default shortcut is CTRL + L.
If you are using vscodevim, zz should work.
If you want to always keep the cursor on the center, you can change the setting Cursor Surrounding Lines to a really high number (100 is ok) and that should work.
As #kwood put it, there is an extension Center Editor Window in the marketplace that meets this end.
I would like to make an answer here, to complement that -- even the extension's author did not explicitly state in the marketplace page -- if you would like to change the default key binding (Ctrl+L), you may try put the following lines in the keybindings.json for the keyboard bindings.
{
"key": "cmd+k cmd+c",
"command": "center-editor-window.center",
"when": "editorTextFocus"
},
The above command sets ⌘ Command+K, ⌘ Command+C as the keyboard shortcut.
Apart from that, you may set
"center-editor-window.threeStateToggle": true,
in the settings.json for VS Code settings so that it will switch among three states (center, top, bottom) instead of one (center).

Editor context Menu - Eclipse-RCP

I have an Eclipse RCP application. I have created an Editor. There are few context menu (default), when I right click on the Editor. I have not created these menus.
Please let me know, How to remove the context menu of the Editor?
It needs different approach by which editor you extends.
Let me know What you extends, than I can answer more efficient one.
In general way:
IWorkbenchParSite#registerContextMenu(...) will be used, So find where calls that, override it. It is not recommend. Because by doing this, Menu Extensions which is contributed for your editor will not work anymore.
If you mean the system menu that appears on editor tabs and view tabs, that menu is provided by the presentation (2.1, Classic, Default, etc). There is no tweak to simply modify it.
The 2 ways to remove it would be:
write your own presentation, using
the
org.eclipse.ui.presentations.StackPresentation
API and matching extension point.
Writing a presentation is a involved
undertaking.
Change the internal classes in the
org.eclipse.ui.workbench plugin
and patch that plugin in your RCP
app.
If you use Text or StyleText you will get the system default menu (cut,copy,paste, maybe something about encoding or input). If you are not going to supply your own menu, simply create an empty SWT Menu and set it:
Menu emptyMenu = new Menu(text);
text.setMenu(emptyMenu);
Eclipse also has a text editing framework, if you need more than a basic text box you should check it out. http://wiki.eclipse.org/The_Official_Eclipse_FAQs#Text_Editors

Problem with TabControl alignment in VB.NET

I'm having a weird behaviour with a left-aligned TabControl in VB.NET. Screenshot:
What I wanted was to have the tabs literally the same way they would be if rotated 90 degrees to the left.
Does it have something to do with the fact I'm not (god forbid) using the standard XP theme? Any solution to just make it work? (Even if it's hard, but I don't want a control that has a contrasting style, I want the program looking consistent)
Thanks!
Happy ending:
Ok, I solved the issue. If someone else has the same problem, use this control. It's free under MIT license. Screenshot by the author:
Note that the author made two controls. My advice: the second one has incorrect support for cleartype (It rotates after subpixel rendering), but it's easier to use, and has better padding control. Go for it! =)
EDIT
If you use C++ and need it for that, there's an approach. Picture of the result:
alt text http://www.codeguru.com/dbfiles/get_image.php?id=6385&lbl=CXPTABCTRL_GIF&ds=20040309
The author was very descriptive on how he did it, which is good, example:
(source: codeguru.com)
This is the link to the article.
Another very good approach is SkyBound's multi-purpose VisualStyles component. Seems that the binaries are free but the source is not, very fair deal. I'll check it out later, but if you need some visualstyles bug fixing, it seems like a choice.
(source: skybound.ca)
from the authors:
first and foremost, it quashes XP
theme bugs, silently, efficiently and
automatically. But it also provides a
simple set of classes which you can
use to draw your own controls using
the Windows XP Theme API.
Check this. and more from the author.
Problem solved!! =D
Yes, it is a bug in the visual styles renderer for the tab control. Looks like you already found a replacement. Another low-impact approach is to selectively disable visual styles for the control. It will revert back to battle-ship gray, correctly drawing vertical tabs. Tab page content will still render properly.
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class FixedTabControl : TabControl {
[DllImportAttribute("uxtheme.dll")]
private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
protected override void OnHandleCreated(EventArgs e) {
SetWindowTheme(this.Handle, "", "");
base.OnHandleCreated(e);
}
}