MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / getFileLanguageId

Function getFileLanguageId

src/lib/editorManager.js:798–817  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

796 }
797
798 function getFileLanguageId(file) {
799 if (!file) return "plaintext";
800 const mode = file.currentMode || file.mode;
801 if (mode) {
802 const modeInfo = getMode(String(mode));
803 if (modeInfo?.name) return String(modeInfo.name).toLowerCase();
804 return String(mode).toLowerCase();
805 }
806 try {
807 const guess = getModeForPath(file.filename || file.name || "");
808 if (guess?.name) return String(guess.name).toLowerCase();
809 } catch (error) {
810 warnRecoverable(
811 `Failed to resolve language id for ${file.filename || file.name || "untitled file"}`,
812 error,
813 "language-id-resolution",
814 );
815 }
816 return "plaintext";
817 }
818
819 function resolveRootUriForContext(context = {}) {
820 const uri = context.uri || context.file?.uri;

Callers 1

buildLspMetadataFunction · 0.85

Calls 4

getModeFunction · 0.90
getModeForPathFunction · 0.90
StringInterface · 0.85
warnRecoverableFunction · 0.85

Tested by

no test coverage detected