MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / getCodeParserByFilename

Function getCodeParserByFilename

packages/web/src/lib/codeHighlight.ts:27–36  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

25};
26
27export const getCodeParserByFilename = async (filename: string): Promise<Parser> => {
28 const found = LanguageDescription.matchFilename(builtinLanguages, filename);
29 if (!found) {
30 return plainTextLanguage.parser;
31 }
32 if (!found.support) {
33 await found.load();
34 }
35 return found.support ? found.support.language.parser : plainTextLanguage.parser;
36};
37
38export async function highlightCode<Output>(
39 languageName: string,

Callers 1

LightweightDiffViewerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected