The "changemode" demonstration can only distinguish between the programming language "Schema" and "everything else", see implementation
function looksLikeScheme(code) { return !/^\s*\(\s*function\b/.test(code) && /^\s*[;\(]/.test(code); }
Thus, this will not work for automatic detection of other programming languages, and, as demo pages show, even for Scheme detection it is very rude.
Unfortunately, it is not easy to automatically detect a wide range of programming languages ββfrom a source code fragment (for small fragments, the same syntax can even be used in different programming languages). However, a reasonable approach is suggested in Detecting a programming language from a fragment .
source share