Is there a way to disable the ctrl-click 'peek' feature in Visual Studio Code? Ideally I'd like ctrl-click to just open the file containing the definition in a new tab.
Edit: I submitted an issue to at least make it less confusing. Apparently my terminology is slightly wrong.
To clarify, there are two actions:
Their behaviour is as follows:
PD, Multiple Definitions
GtD, Single Definition
All of those are fine except the last. Doing both things results in a really redundant and confusing UI like this:
There should be a way to have one of these behaviours:
Or:
You can peek a definition by choosing Peek Definition from the right-click menu for a type or member that you want to explore. If the option is enabled, you can also peek a definition using the mouse, by pressing Ctrl (or another modifier) and clicking the member name. Or, from the keyboard, press Alt+F12.
Disable telemetry reporting# telemetryLevel user setting to off . From File > Preferences > Settings (macOS: Code > Preferences > Settings), search for telemetry , and set the Telemetry: Telemetry Level setting to off . This will silence all telemetry events from VS Code going forward.
For C or C++, choose “Advanced“, then scroll to the “IntelliSense” section. For C# and Basic, check the “Show completion list after a character is typed” to disable it. For C/C++, you will have a few options, such as “Disable Auto Updating“, “Disable Squiggles“, and “Disable #include “Auto Complete“.
I've made a pull request to fix this https://github.com/Microsoft/vscode/pull/68023, but until then here's a temp fix that patches the VSCode installation files. You'll need to re-apply every update.
With this fix Ctrl+Click will:
Figure out what the function that needs to be patched looks like. The method is DefinitionAction.prototype._onResult(editorService, editor, model)
Go to the VSCode installation directory. %LocalAppData%\Programs\Microsoft VS Code
and right click and open the directory in VSCode so that we can use VSCode's search feature to search for text in every file.
Search for _onResult
and evaluate every result, checking to see if the signature and body matches what we are expecting from the function we saw in step 1.
_openReference
is nearby. Use that to narrow the search.workbench.main.js
line 2454
. Use bracket matching to find the end or know that it ends immediately before t.prototype._openReference
The function when formatted is the following (async func is compiled down to statemachine, that's why it looks nothing like the source typescript):
t.prototype._onResult = function (e, t, r) { return i(this, void 0, void 0, function () { var i, s, a; return n(this, function (n) { switch (n.label) { case 0: return i = r.getAriaMessage(), o.alert(i), this._configuration.openInPeek ? (this._openInPeek(e, t, r), [3, 3]) : [3, 1]; case 1: return s = r.nearestReference(t.getModel().uri, t.getPosition()), [4, this._openReference(t, e, s, this._configuration.openToSide)]; case 2: (a = n.sent()) && r.references.length > 1 ? this._openInPeek(e, a, r) : r.dispose(), n.label = 3; case 3: return [2] } }) }) }
Replace the function with the following (if using same version) or format and edit the function you found to be similar to this example. Note the o
variable is the global\window object and subject to change.
t.prototype._onResult = function (e, t, r) { return i(this, void 0, void 0, function () { return n(this, function (n) { switch (n.label) { case 0: return r.getAriaMessage(), o.alert(r.getAriaMessage()), this._configuration.openInPeek || r.references.length > 1 ? (this._openInPeek(e, t, r), [3, 3]) : [3, 1]; case 1: return [4, this._openReference(t, e, r.nearestReference(t.getModel().uri, t.getPosition()), this._configuration.openToSide)]; case 2: r.dispose(), n.label = 3; case 3: return [2] } }) }) }
Launch VSCode. You will get a Your Code installation appears to be corrupt. Please reinstall
. Just hit the gear icon and click Don't Show Again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With