(name: string, lang: LanguageDescription)
| 63 | } |
| 64 | |
| 65 | function createLanguageLoader(name: string, lang: LanguageDescription) { |
| 66 | const normalizedName = normalizeModeKey(name); |
| 67 | |
| 68 | switch (normalizedName) { |
| 69 | case "javascript": |
| 70 | return async () => { |
| 71 | const { javascript } = await import("@codemirror/lang-javascript"); |
| 72 | return javascript({ jsx: true }); |
| 73 | }; |
| 74 | |
| 75 | case "html": |
| 76 | return async () => { |
| 77 | const { html } = await import("@codemirror/lang-html"); |
| 78 | return html({ autoCloseTags: await shouldAutoCloseTags() }); |
| 79 | }; |
| 80 | |
| 81 | case "xml": |
| 82 | return async () => { |
| 83 | const { xml } = await import("@codemirror/lang-xml"); |
| 84 | return xml({ autoCloseTags: await shouldAutoCloseTags() }); |
| 85 | }; |
| 86 | |
| 87 | case "vue": |
| 88 | return async () => { |
| 89 | const [{ vue }, { html }] = await Promise.all([ |
| 90 | import("@codemirror/lang-vue"), |
| 91 | import("@codemirror/lang-html"), |
| 92 | ]); |
| 93 | return vue({ |
| 94 | base: html({ autoCloseTags: await shouldAutoCloseTags() }), |
| 95 | }); |
| 96 | }; |
| 97 | |
| 98 | case "angular": |
| 99 | return async () => { |
| 100 | const [{ angular }, { html }] = await Promise.all([ |
| 101 | import("@codemirror/lang-angular"), |
| 102 | import("@codemirror/lang-html"), |
| 103 | ]); |
| 104 | return angular({ |
| 105 | base: html({ |
| 106 | autoCloseTags: await shouldAutoCloseTags(), |
| 107 | selfClosingTags: true, |
| 108 | }), |
| 109 | }); |
| 110 | }; |
| 111 | |
| 112 | case "php": |
| 113 | return async () => { |
| 114 | const [{ php }, { html }] = await Promise.all([ |
| 115 | import("@codemirror/lang-php"), |
| 116 | import("@codemirror/lang-html"), |
| 117 | ]); |
| 118 | const htmlSupport = html({ |
| 119 | autoCloseTags: await shouldAutoCloseTags(), |
| 120 | matchClosingTags: false, |
| 121 | }); |
| 122 | return [ |
no test coverage detected