I have many questions about writing makefiles in visual studio (vs) code. The first question is, how to make vs code recognize certain files as makefiles. For instance, when a file's suffix is ".mk", it is recognized as a makefile and the syntax is emphasized in the style of a makefile in an editor. However, when the suffix of a file is ".Suse", e.g., "Makefile.suse", it is no longer recognized as a makefile. How to make the file "Makefile.suse" be recognized as a makefile?

Next, I am very confused with indentation in vs code. In my understanding, a space and a tab are two different symbols in their ASCII code. When I type a tab, it is a tab, and when I type a space, it is a space. Indentation introduced by either a tab or a space is visualization determined by an editor. However, in vs code, in many cases, as I type a tab, I got several spaces. There must be some internal conversion within vs code.

I also found the commands "indentation using tabs" and "indentation using spaces" confusing. In my understanding, it is the internal visualization processing of tabs and spaces that determine indentation as a visual effect. The type of saying will go in a circular definition: indentation decides tabs or spaces, tabs or spaces decide visual indentation. When writing a makefile, it is really a headache to confuse spaces with tabs. If I use "indentation using spaces", will all tabs be converted to spaces automatically in a file?

Can anyone help me figure out (1) how to configure vs code so that it recognizes ".Suse" as a makefile; (2) how to configure indentation properly so that it won't cause a trouble in writing makefiles? Basically, what I want is: a tab is a tab, and a space is a space, and we control how they are visualized in an editor. At least this setting goes with all makefiles.

  • Outside VSCode the convention is that Makefile (or makefile) is the default name of a makefile. It seems like VSCode is inventing its own naming scheme Dec 30, 2021 at 23:20


You must log in to answer this question.

Browse other questions tagged .