vscode-cpptools
vscode-cpptools copied to clipboard
Group source and header in open editor tabs
Type: LanguageService
Hello, i posted the following request in the VSCode repository, but they said it is an issue for the extension, therefore i would like to request this feature here:
Issue Type: Feature Request
Hello,
when editing C++ projects most times i have the implementation and header file for the classes (i am currently editing) open at the same time. I like to have the editor tabs grouped so that the header is next to the implementation file (xx.cpp | xx.h | xy.cpp | xy.h ...).
Is it possible if a new tab is openend that it is moved automatically right beside the one with the same name (except for the file extension)? And e.g. if i Ctrl+Click on a Symbol in xy.cpp the file where the symbol is declared will be opened to the right, could this be changed so that the new editor tab would be opened at the right edge of all opened editors or to the right of the "Group" of implementation and header?
Best regards, Jan Masak
VS Code version: Code 1.25.0 (0f080e5, 2018-07-05T13:11:58.697Z) OS version: Windows_NT x64 6.1.7601 C/C++ Extension Version: 0.17.6
Hi @sean-mcmanus, can I try that one? maybe some code pointers?
I would expect this can be done in src/LanguageServer/extension.ts. Look for the onDidOpenTextDocument function. I'm not sure which of the vscode APIs manages the positioning of open TextDocuments, so you'll need to investigate that. We'll probably also want to have a setting to control the behavior (e.g. sourceGroups = { HeaderSource, SourceHeader, or Disabled }) since I imagine some would want to control the ordering of the file groups.
As for the second request about opening a tab to the right, I thought this was the default behavior in vscode already (unless the file is already open).
@noamyogev84 Sure, you can try...I'm not 100% sure if VS Code has sufficient APIs for this though. I seem to recall they added additional APIs a few months ago (I think https://code.visualstudio.com/updates/v1_25#_grid-editor-layout-viewcolumn ), which would require increasing our vscode dependency from 1.23.0 to 1.25.0 in package.json, which should be okay.
I don't see an API in VS Code to do this. I've started a thread with @isidorn , who closed the original issue. The grid editor layout appears to be for multiple files visible on screen at the same time, whereas @JMasak seems to be asking for grouping of editor tabs at the top of the window.
Isidor mentioned he was mistaken in the vscode issue, and that there is not currently a way for extensions to influence the order of the currently open editor tabs. He referred to this issue as tracking that potential feature.
Is this finally possible? This and/or any sort of tab grouping? https://github.com/microsoft/vscode/commit/aa69f3d7623c464aba726d12ea0d83428f43e8b9
I think this should be possible with the new Tab api we introduced a couple of milestones ago.
Thanks for letting us know. We weren't aware of that new API.