Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
None
Description
In VS Code, you can Alt+Shift+Right to "Expand Selection". When editing C++ files with the clangd extension, this asks the clangd LSP for "textDocument.selectionRange" information at the current cursor (LSP docs), then expands or contracts the selection based on the returned ranges every time you Alt+Shift+Right or Left. (If you move the cursor then Alt+Shift+Right again, it queries "textDocument.selectionRange" again.) This is useful both for editing code, and for asking the compiler about tricky C++ precedence problems (like querying the parse tree of (size_t)x & *mask[y] == 2). (JetBrains also has Ctrl+W for similar functionality, but is not built on top of clangd or LSP.)
Given that Qt Creator uses clangd and it has selection range information built-in, is it possible to extend Qt Creator to add a keyboard shortcut to expand selection, which asks clangd for selection ranges around the cursor, then caches and applies them?