microsoft / microsoft/vscode-cpptools

Support adding source/header extensions for Switch Header/Source functionality

Open
#4,608 4 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request Feature: Switch Header/Source Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

  • OS and Version: Windows 10
  • VS Code Version: 1.40.1
  • C/C++ Extension Version: 0.26.2-insiders

I have a codebase I'm writing right now where template implementation code is split up into .inl files (also typically used for inline/constexpr functions). While they're mainly just to keep header files "clean", I was thinking it would be nice to be able to swap to them from the header files themselves via the Switch Header/Source command.

I can see it either being implemented as swapping between 3 files with the same name if they exist (h/hpp,cpp,inl), or favoring just the header/source file swap if the source file exists, and header/inline file if an inl exists,

typical pattern:
(with all 3 files, a lot of cases could be just .hpp/.inl)

InlTest.hpp

#ifndef INL_TEST_H
#define INL_TEST_H

struct InlTest
{
	void foo(const int& inFoo);

	template <typename T>
	void bar(const T& inBar);
};

#include "InlTest.inl"

#endif // INL_TEST_H

InlTest.cpp

#include "inlTest.hpp"

void InlTest::foo(const int& inFoo);
{
	std::cout << inFoo << std::endl;
}

InlTest.inl

#include "inlTest.hpp" // Actually not needed, but helps with intellisense sometimes

#include <iostream>

template <typename T>
void InlTest::bar(const T& inBar);
{
	std::cout << inBar << std::endl;
}

Out of the file types supported by the builtin C/C++ extension, the following could also be candidates for this toggle too:

.i .ii .ino .inl .ipp .hpp.in .h.in

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Switch Header/Source command in the vscode-cpptools extension and inspect how its supported file extensions are selected. Confirm the desired behavior for .inl and the other listed extensions, including projects with header, source, and inline files, and verify that switching reaches the expected counterpart.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.