MCPcopy Create free account
hub / github.com/massCodeIO/massCode / inferLanguage

Function inferLanguage

src/main/import/snippets/vscode.ts:75–91  ·  view source on GitHub ↗
(fileName: string, snippet: VSCodeSnippetValue)

Source from the content-addressed store, hash-verified

73}
74
75function inferLanguage(fileName: string, snippet: VSCodeSnippetValue): string {
76 if (typeof snippet.scope === 'string' && snippet.scope.trim()) {
77 return snippet.scope.split(',')[0].trim()
78 }
79
80 const baseName = path.basename(fileName)
81 if (baseName.endsWith('.code-snippets')) {
82 return 'plain_text'
83 }
84
85 if (baseName.endsWith('.json')) {
86 const language = path.basename(baseName, '.json')
87 return LANGUAGE_FILE_NAMES.has(language) ? language : 'plain_text'
88 }
89
90 return 'plain_text'
91}
92
93function getPrefixTags(prefix: unknown): string[] {
94 if (typeof prefix === 'string') {

Callers 1

parseVSCodeSnippetFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected