On Windows VSCode ctrl+q shows a menu with the items on the activity bar.
What is that command?
I switch to Linux and want to add a key binding to that command (not map by default as on Linux ctrl+q quits the program) but cannot find it and don't have a Windows machine at hand to look on the key bindings and doesn't seem to be listed here.
When we do not have access to VSC on given platform
It should be possible to sift through the sources.
In this case we are looking for Ctrl that should be CtrlCmd and Q KeyQ in KEYBINDING of some module class, so something like:
static readonly ID = 'workbench.action.quickOpenView';
static readonly KEYBINDING = {
primary: KeyMod.CtrlCmd | KeyCode.KeyQ,
mac: { primary: KeyMod.WinCtrl | KeyCode.KeyQ },
linux: { primary: 0 }
};
(Yes, that's exactly it and I've started from here backwards.)
Slightly convoluted GitHub search query *
KEYBINDING KeyMod CtrlCmd KeyCode KeyQ repo:microsoft/vscode extension:ts
should bring us there so we now have the command ID: workbench.action.quickOpenView.
When we have VSC on platform at hand
It is easy as using the 'Record keys' feature in the Keyboard Shortcuts settings pane to find this information (either clicking the "Keyboard" icon or using Alt+K) where we should find that Ctrl+Q is by default bound to View: Quick Open View:
GitHub code search sadly ignores all non-alphanumerics
. , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ] #
Related
it shows "You must run VS code with admin privileges in order to enable Neon Dreams.".It doesn't work even after running vs-code as administrator.
The error is caused by the new version of VSCode, the extension normally change the workbench files of electron-browser but electron-browser was removed in the commit https://github.com/microsoft/vscode/tree/f4f1b04d872a2b94d9a5105a1eefb81a213c07f2 and it has been replaced by electron-sandbox.
So you have 2 choices :
You can go back to previous version of VSCode (1.69 June version) by downloading it here https://code.visualstudio.com/updates/v1_69 and then run VSCode as Administrator and enable neon dreams again
Or
You can stay in 1.70 and modify manually the extension :
Go to "C:/Users/YourUsername/.vscode/extensions/robbowen.synthwave... or wherever your vscode extensions are stored
Go to src/ and open extension.js
You will have to replace all the "electron-browser" with "electron-sandbox" so
const htmlFile =
base +
(isWin
? "\\electron-browser\\workbench\\workbench.html"
: "/electron-browser/workbench/workbench.html");
const templateFile =
base +
(isWin
? "\\electron-browser\\workbench\\neondreams.js"
: "/electron-browser/workbench/neondreams.js");
on line 34 become
const htmlFile =
base +
(isWin
? "\\electron-sandbox\\workbench\\workbench.html"
: "/electron-sandbox/workbench/workbench.html");
const templateFile =
base +
(isWin
? "\\electron-sandbox\\workbench\\neondreams.js"
: "/electron-sandbox/workbench/neondreams.js");
and same operation at line 149 on
var htmlFile =
base +
(isWin
? "\\electron-browser\\workbench\\workbench.html"
: "/electron-browser/workbench/workbench.html");
Save extension.js, close VSCode, open VSCode as Administrator and Enable Neon Dreams again.
Hope it helps !
Following the advise of S.Mollet to find and replace electron-browser with electron-sandbox worked; only difference I was on mac, but principal was same.
Find vs code extension files, mine were in ~/.vscode/exentions/robb...
and then to run vs code with admin I ran sudo code --user-data-dir="~/.vscode-root"
and then in vs code press ⌘-p and select enable dreams.
I was losing so much productivity while my font wasnt glowing, smh.
vscode > Preferences: Open Settings (JSON)
{
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["t", "s"],
"commands": ["python.sortImports"],
}
]
}
I set it up as above, but it doesn't work. What could be wrong?
I'm typing 't' and 's' in vim-normal mode.
ctrl+alt+s is woring. but i wanna have custom vim shortcuts
Try reinstalling the vim extension. If this fails, you could try the following:
Are your configurations correct?
Adjust the extension's logging level to 'debug', restart VS Code. As each > remapped configuration is loaded, it is outputted to console. In the Developer > Tools console, do you see any errors?
debug: Remapper: normalModeKeyBindingsNonRecursive. before=0. after=^.
debug: Remapper: insertModeKeyBindings. before=j,j. after=<Esc>.
error: Remapper: insertModeKeyBindings. Invalid configuration. Missing 'after' key or 'command'. before=j,k.
Misconfigured configurations are ignored.
Does the extension handle the keys you are trying to remap?
VSCodeVim explicitly instructs VS Code which key events we care about through > the package.json. If the key you are trying to remap is a key in which vim/vscodevim generally does not handle, then it's most likely that this extension does not receive those key events from VS Code. With logging level adjusted to 'debug', as you press keys, you should see output similar to:
debug: ModeHandler: handling key=A.
debug: ModeHandler: handling key=l.
debug: ModeHandler: handling key=<BS>.
debug: ModeHandler: handling key=<C-a>.
As you press the key that you are trying to remap, do you see it outputted here? If not, it means we don't subscribe to those key events. It is still possible to remap those keys by using VSCode's keybindings.json.
Source: https://marketplace.visualstudio.com/items?itemName=vscodevim.vim#debugging-remappings
Problem
I want to use Caps_Lock as the key to exit insert mode in Visual Studio code's vim extension. I have already remapped the keys in Xorg with Xmodmap, but Visual studio doesn't seem to really matter.
My VScode settings
As you can see, I already tried with "vim.insertModeKeyBindings", but it only disables the Escape key, leaving me thinking that Caps_lock has another key name/keysym, but I can't seem to find it.
{
"editor.fontFamily": "'Inconsolata-g for Powerline'",
"editor.fontSize": 16,
"liveshare.authenticationProvider": "GitHub",
"vim.enableNeovim": true,
"code-runner.enableAppInsights": false,
"code-runner.runInTerminal": true,
"workbench.startupEditor": "newUntitledFile",
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"workbench.colorTheme": "BeardedTheme Anthracite",
"extensions.autoUpdate": "onlyEnabledExtensions",
"vim.vimrc.enable": true,
"vim.vimrc.path": "$HOME/.config/nvim/init.vim",
"editor.fontWeight":"bold",
"vim.insertModeKeyBindings": [
{
"before": ["<Esc>"],
"after": ["<Caps_Lock>"]
}
]
}
Another thing i'd like to address is that i already have j,k and their combinations to exit insert mode. Is that a default?
Huge thanks in advance to anybody offering to help!!
Solution
As this problem arose in Linux and, I already changed my settings in Xmodmap, it seems that VScode not respecting remappings with xkbmap is a known issue and should be fixed by adding "keyboard.dispatch": "keyCode" in VScode's settings.json and reopening VS.
Press CTRL + SHIFT + P to open the command pallete.
Then, click on the settings button on any of the commands.
This opens the keybindings.
Search extension.vim_escape
Change this to CAPS_LOCK.
The only issue with this is that it still capitalises things when you re-enter insert mode, so you have to press it twice.
I see you already found a possible workaround, but I wonder if the 'xcape' tool
(apt install xcape) can help with the following in your bashrc?
# set capslock to escape key
setxkbmap -option ctrl:nocaps
xcape -e '#66=Escape'
I've recently tried to install the QDK via the VSCode extension in my Windows 10 Desktop and VSCode wasn't able to find the Microsoft libraries even after I was able to execute the code by the dotnet run command on the terminal. The code was the sample project code described in the create new project part of the tutorial. I also didn't have .NET SDK so I installed it but it seems to be working fine. In computers I got problems all the code, all related to not finding the namespaces.
namespace QuantumRNG {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.Math;
open Microsoft.Quantum.Convert;
operation GenerateRandomBit() : Result {
using (q = Qubit()) {
H(q);
return MResetZ(q);
}
}
operation SampleRandomNumberInRange(max : Int) : Int {
mutable output = 0;
repeat {
mutable bits = new Result[0];
for (idxBit in 1..BitSizeI(max)) {
set bits += [GenerateRandomBit()];
}
set output = ResultArrayAsInt(bits);
} until (output <= max);
return output;
}
#EntryPoint()
operation SampleRandomNumber() : Int {
let max = 50;
Message($"Sampling a random number between 0 and {max}: ");
return SampleRandomNumberInRange(max);
}
}
Do you see any error messages in the output console?
To see the output console select "View: Toggle Output" (Ctrl + Shift + U) and select "Q# Language Extension" from the drop down list.
If the drop down list doesn't show "Q# Language Extension" then it probably means that the language-server that gets downloaded on first run is still downloading, so give it a minute or so (depending on your internet connection).
I think I also had the same problem. The .Net SDk which you have downloaded automatically creates a path in the environment variable by the name "%USERPROFILE%.dotnet\tools" so delete this and add "C:\Program Files\dotnet\sdk" or copy the path of dotnet SDK from the drive where you have installed dotnet and create a new environment variable under user variable. This might solve your namespace problem.
I'm trying VS Code for a few days and I've installed csscomb extension. It works fine when I put .csscomb.json on my work directory.
But I wish it worked even on file I open outside of my work directory.
Could you tell me how to configure VS Code and/or csscomb to work like this?
I use Windows 10 Pro.
According to the csscomb page on VS Code's Marketplace...
They have "Supported settings"
csscomb.preset
Type: Object or String
Defaut: {}
Config's name. Should be one of the
following: csscomb, zen, yandex or an object containing custom
configuration or path to config.
And the following warning:
Warning!
If you want to specify a file in the current directory, the path must
begin with a ./ or ../ if relative to the current directory. Also you
can use HOME directory as ~ symbol.
In other words, since there is no default, you have to set either a preset config or path to a custom config.
To configure csscomb in VS Code:
Go to File > Preferences > Settings
Select the "User Settings" tab in the right window (to apply the config globally)
Expand the options for "CSScomb configuration"
Click the pencil to the left of "csscomb.preset"
Click "Copy to Settings"
Enter the path to your custom config or choose a preset
{
"csscomb.preset": "~/.vscode/.csscomb.json"
}
OR one of ("csscomb", "zen", "yandex")
{
"csscomb.preset": "csscomb"
}
Next, you need to create the .csscomb.json file in that location. I chose the C:\Users\username\.vscode directory because that's where VS Code also downloads extensions on Windows.
Here's the config I created using csscomb's config generator:
{
"always-semicolon": true,
"color-case": "upper",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": false,
"leading-zero": false,
"quotes": "double",
"sort-order-fallback": "abc",
"space-before-colon": "",
"space-after-colon": " ",
"space-before-combinator": " ",
"space-after-combinator": " ",
"space-between-declarations": "\n",
"space-before-opening-brace": " ",
"space-after-opening-brace": "\n",
"space-after-selector-delimiter": " ",
"space-before-selector-delimiter": "",
"space-before-closing-brace": "\n",
"strip-spaces": true,
"tab-size": true,
"vendor-prefix-align": true
}
You can also include an option for sorting tags (or copy it from one of their presets on git):
{
"sort-order": [
[
"font",
"font-family",
"font-size",
"font-weight",
"font-style"
],
[
"position",
"z-index"
]
]
}
Now you should be able to format CSS within VS Code by typing ctrl+shift+p then typing "CSScomb" then enter.
"Formatter" extensions are supposed to be recognized by the default formatting keyboard shortcut shift+alt+f, however I haven't gotten that to work. I think it's something the developer has to configure.
Instead, you can create your own keyboard shortcut in VS Code:
Go to File > Preferences > Keyboard Shortcuts
Click the link at the top to edit keybindings.json
Add your custom keybinding
{
"key": "ctrl+shift+c",
"command": "csscomb.execute"
}
Now you should be all set!