Sublime Forum

Replace build for language

#1

I’ve made a custom build system for C that fits my environment, and I’d like this build system to be used by default by every new .c and .h file I ever open.
But, because in the C++ package it’s specified that both C and C++ should use it’s build system, which is completely unusable for me.

So, how can I override a build system entirely for a language?

0 Likes

#2

Try

"selector": "source.c, source.c++"
0 Likes

#3

That works for C, but now C++ uses this one as well (although the extension is .cpp and not .c++).
I am assuming that in “source.X”, X is the extension for the file.

0 Likes

#4

Oh right, I didn’t read carefully. Just change it to "selector": "source.c" then.

The “scope name” does not come from the extension but from the base scope that the syntax definition assigns. For cpp files this happens to be “source.c++” and for Python it’s “source.python” for example.
You can see the scope (including base scope) when pressing ctrl+shift+alt+p in the status bar.

0 Likes

#5

Then I’m back to my original issue, it uses the build system specified in the C++ language package, not the one I added.

0 Likes

#6

Ah, now I understand.

Well, you can basically do two things. One would be to select the C build manually and thus override the automatic detection and the other would be to override the default build system with something that does not use the “source.c” scope in its selector.

See packagecontrol.io/packages/Pack … urceViewer

0 Likes

#7

If only that was specific to the current language, but it sets it globally.

0 Likes