I cannot get this to work. If I take out the parts in scope before "source.c" then I can get it to complete. I have set the syntax explicitly to C in the View menu. So what obvious thing am I doing wrong here? It should be similar to your C++ example. I've tried "meta.preprocessor.c.include source.c" as well as "string.quoted.other.lt-gt.include.c source.c" as well, but they also failed.

Also, my question before was actually different. Since I communicated the idea across badly, let me try again. Within the scope of the source file if you would allow all completion tokens it would be incredibly bloated. So depending on which #include files are included at the top I would like to limit the tokens. E.g. if #include <stdio.h> is included I want fclose() to be available in autocompletion, but if #include <stdio.h> is not present, I don't want to offer the possibility.

I believe view.syntax_name and view.scope_name are identical. They both take a text_point as an argument and return a string containing the name of the scope at the text point.If a function exists in both ST1 and ST2, it tends to take the same arguments and have the same effect, so the API docs for ST1 are actually pretty helpful.

view.text_point() returns a a text_point, which is really just an integer index of the indicated character in the buffer. Because the character at row 0, col 0 is always the character at buffer index 0, view.text_point(0,0) will always return 0.Let me know if I'm not making any sense.