Describe the Bug
A critical feature is using “Go To Definition” in C/C++. I installed Cursor, imported extensions from VS Code and this didn’t work. Tried F12, Ctrl+Click, Right Click - none of them work.
I tried:
- Uninstalling extensions
- Reinstalling extensions (and reloading)
- Uninstalled Cursor, cleared app data, reinstalled and didn’t import anything from VS Code
Doesn’t work
Steps to Reproduce
As soon as I open Cursor, I’m unable to use “Go To Definition”. I see that the shortcut is mapped, but pressing F12 (or using any other method) doesn’t do anything.
Operating System
Windows 10/11
Current Cursor Version (Menu → About Cursor → Copy)
Version: 1.101.1 (user setup)
Commit: 18e3a1ec544e6907be1e944a94c496e302073435
Date: 2025-06-18T13:35:12.605Z
Electron: 35.5.1
ElectronBuildId: 11727614
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Windows_NT x64 10.0.26100
Does this stop you from using Cursor
Yes - Cursor is unusable
Hi @jchernus-fikst, the Anysphere C/C++ extension relies on Clangd for the language server, which needs to be configured via a compile_commands.json
(the build tool, such as CMake, can generate this file). Please see Intellisense disabled in new C++ extension and the Clangd Getting Started Guide for more on configuring Clangd.
I discovered an interesting difference with clangd and that is how you select things for it to lookup. Not using windows here, but in my configuration, a single click on a word marks it as a semantic selection and clangd will look up the highlighted word. A double click gives you a text selection and that is not what clangd will use as its lookup. Or to quote ChatGPT on this:
In Cursor (and other editors based on LSP like VS Code), the highlight color and selection behavior are tied to how the editor interprets your interaction with a symbol. While the exact visual styles can vary slightly between themes and editors, here’s what those boxes generally mean in Cursor when using clangd:
Grey Box (Single Click)
- Meaning: This is a semantic highlight .
- It indicates the symbol currently under the cursor.
- Clangd (via LSP) is telling the editor: “this token is a symbol” (like a variable, macro, type, function, etc.).
- It’s temporary and context-sensitive — if you move the cursor, it will update.
This is usually driven by textDocument/documentHighlight in the LSP protocol and helps identify references to the same symbol in the visible region.
Blue Box (Double Click)
- Meaning: This is a text selection, not necessarily a semantic one.
- You’re explicitly selecting a range of text.
- Double-clicking typically selects the entire word or token under the cursor.
- At this point, your actions (e.g., “Go to Definition” or “Find All References”) apply to the selected text, but not always semantically.
For example:
- Double-clicking MY_MACRO selects the raw text MY_MACRO and sends that to clangd.
- If clangd can’t resolve it (due to macro expansion, cursor context, or AST structure), it may fall back to a syntacticresult — or nothing.
Why This Matters for Clangd
Clangd is very sensitive to cursor position and token identity .
- Single-click (grey box) helps clangd resolve the symbol more accurately.
- Double-click (blue box) can sometimes confuse clangd, especially if the selection spans more than a symbol (e.g., selecting foo.bar instead of just bar).
This difference in behavior explains why:
- Sometimes “Find References” from a grey-boxed token works correctly.
- But from a blue-boxed one (double-clicked), you might get nothing — or a broader match like the function.