4coder»Forums
Evan Butterfield
6 posts
.inl support

I added .inl to the "treat as code" section in my config.4coder file. I am quite new and couldn't find anything about inl files. All I need is 4coder to treat these files like it would .c files. Thank you in advance!

Simon Anciaux
1184 posts
.inl support

Unfortunately this has been a bit broken for a while. But you can achieve what you want with a simple modification in the custom layer.

In the file 4coder_default_hooks.cpp search for BUFFER_HOOK_SIG(default_begin_buffer). In that function there is some code that looks like this

for (i32 i = 0; i < extensions.count; ++i){
    if (string_match(ext, extensions.strings[i])){
                
        if (string_match(ext, string_u8_litexpr("cpp")) ||
            string_match(ext, string_u8_litexpr("h")) ||
            string_match(ext, string_u8_litexpr("c")) ||
            string_match(ext, string_u8_litexpr("hpp")) ||
            string_match(ext, string_u8_litexpr("cc"))){
            treat_as_code = true;
        }
        ...
    }
    ...
}

As you can see, after testing for the extension from the config file there are tests with fixed extensions. I believe this is because some feature activated by "treat as code" might break with things that are not C/C++.

There are two things you can do:

  • Add a new line in the second if to test for inl files string_match(ext, string_u8_litexpr("inl"))
  • Or remove the second if (or move treat_as_code = true; outside of the second if) so that extensions from the config file will be treated as code.

If you don't know how to compile the custom layer there is a getting started guide in the articles section of the forum.

Evan Butterfield
6 posts
.inl support
Replying to mrmixer (#25780)

Thank you so much for the fast reply! I'm a bit new and these forums are super helpful.