@@ -4,30 +4,24 @@ import org.jetbrains.jewel.foundation.code.MimeType.Known.AGSL
44import org.jetbrains.jewel.foundation.code.MimeType.Known.AIDL
55import org.jetbrains.jewel.foundation.code.MimeType.Known.C
66import org.jetbrains.jewel.foundation.code.MimeType.Known.CPP
7- import org.jetbrains.jewel.foundation.code.MimeType.Known.CSS
87import org.jetbrains.jewel.foundation.code.MimeType.Known.DART
98import org.jetbrains.jewel.foundation.code.MimeType.Known.DIFF
109import org.jetbrains.jewel.foundation.code.MimeType.Known.GO
1110import org.jetbrains.jewel.foundation.code.MimeType.Known.GRADLE
1211import org.jetbrains.jewel.foundation.code.MimeType.Known.GRADLE_KTS
1312import org.jetbrains.jewel.foundation.code.MimeType.Known.GROOVY
14- import org.jetbrains.jewel.foundation.code.MimeType.Known.HTML
1513import org.jetbrains.jewel.foundation.code.MimeType.Known.JAVA
1614import org.jetbrains.jewel.foundation.code.MimeType.Known.JAVASCRIPT
1715import org.jetbrains.jewel.foundation.code.MimeType.Known.JSON
18- import org.jetbrains.jewel.foundation.code.MimeType.Known.JSON5
19- import org.jetbrains.jewel.foundation.code.MimeType.Known.JSON_LINES
2016import org.jetbrains.jewel.foundation.code.MimeType.Known.KOTLIN
2117import org.jetbrains.jewel.foundation.code.MimeType.Known.MANIFEST
22- import org.jetbrains.jewel.foundation.code.MimeType.Known.OBJECTIVE_C
2318import org.jetbrains.jewel.foundation.code.MimeType.Known.PATCH
2419import org.jetbrains.jewel.foundation.code.MimeType.Known.PROGUARD
2520import org.jetbrains.jewel.foundation.code.MimeType.Known.PROPERTIES
2621import org.jetbrains.jewel.foundation.code.MimeType.Known.PROTO
2722import org.jetbrains.jewel.foundation.code.MimeType.Known.PYTHON
2823import org.jetbrains.jewel.foundation.code.MimeType.Known.REGEX
2924import org.jetbrains.jewel.foundation.code.MimeType.Known.RESOURCE
30- import org.jetbrains.jewel.foundation.code.MimeType.Known.RUBY
3125import org.jetbrains.jewel.foundation.code.MimeType.Known.RUST
3226import org.jetbrains.jewel.foundation.code.MimeType.Known.SHELL
3327import org.jetbrains.jewel.foundation.code.MimeType.Known.SQL
@@ -37,7 +31,6 @@ import org.jetbrains.jewel.foundation.code.MimeType.Known.TOML
3731import org.jetbrains.jewel.foundation.code.MimeType.Known.TYPESCRIPT
3832import org.jetbrains.jewel.foundation.code.MimeType.Known.UNKNOWN
3933import org.jetbrains.jewel.foundation.code.MimeType.Known.VERSION_CATALOG
40- import org.jetbrains.jewel.foundation.code.MimeType.Known.XHTML
4134import org.jetbrains.jewel.foundation.code.MimeType.Known.XML
4235import org.jetbrains.jewel.foundation.code.MimeType.Known.YAML
4336
@@ -111,14 +104,12 @@ public value class MimeType(private val mimeType: String) {
111104 val folderType = getAttribute(ATTR_FOLDER_TYPE )
112105 folderType?.capitalizeAsciiOnly() ? : " XML"
113106 }
107+
114108 else -> " XML"
115109 }
116110 }
117- HTML .mimeType -> " HTML"
118- XHTML .mimeType -> " XHTML"
111+
119112 JSON .mimeType -> " JSON"
120- JSON5 .mimeType -> " JSON5"
121- JSON_LINES .mimeType -> " JSON Lines"
122113 TEXT .mimeType -> " Text"
123114 REGEX .mimeType -> " Regular Expression"
124115 GROOVY .mimeType -> if (isGradle()) " Gradle" else " Groovy"
@@ -142,47 +133,6 @@ public value class MimeType(private val mimeType: String) {
142133 else -> mimeType
143134 }
144135
145- public fun toFileExtensionIfKnown (): String? =
146- when (mimeType) {
147- AGSL .mimeType -> " agsl"
148- AIDL .mimeType -> " aidl"
149- C .mimeType -> " c"
150- CPP .mimeType -> " cpp"
151- CSS .mimeType -> " css"
152- DART .mimeType -> " dart"
153- GO .mimeType -> " go"
154- GRADLE .mimeType -> " gradle"
155- GRADLE_KTS .mimeType -> " kts"
156- GROOVY .mimeType -> " groovy"
157- JAVA .mimeType -> " java"
158- JAVASCRIPT .mimeType -> " js"
159- JSON .mimeType -> " json"
160- JSON5 .mimeType -> " json5"
161- JSON_LINES .mimeType -> " jsonl"
162- KOTLIN .mimeType -> " kt"
163- MANIFEST .mimeType -> " xml" // Manifest files
164- PROGUARD .mimeType -> " pro"
165- PROPERTIES .mimeType -> " properties"
166- PROTO .mimeType -> " proto"
167- PYTHON .mimeType -> " py"
168- REGEX .mimeType -> " regex"
169- RESOURCE .mimeType -> " xml" // Resource files
170- RUST .mimeType -> " rs"
171- SHELL .mimeType -> " sh"
172- SQL .mimeType -> " sql"
173- SVG .mimeType -> " svg"
174- TEXT .mimeType -> " txt"
175- TOML .mimeType -> " toml"
176- TYPESCRIPT .mimeType -> " ts"
177- VERSION_CATALOG .mimeType -> " toml"
178- XML .mimeType -> " xml"
179- YAML .mimeType -> " yaml"
180- RUBY .mimeType -> " rb"
181- OBJECTIVE_C .mimeType -> " m"
182- " text/x-erlang" -> " erl"
183- else -> null
184- }
185-
186136 private fun getBaseMimeType (): String {
187137 val baseMimeType = base().toString()
188138 // Built-ins are already normalized, don't do string and sorting work
@@ -309,12 +259,7 @@ public value class MimeType(private val mimeType: String) {
309259 public val XML : MimeType = MimeType (" text/xml" )
310260 public val PROPERTIES : MimeType = MimeType (" text/properties" )
311261 public val TOML : MimeType = MimeType (" text/toml" )
312- public val HTML : MimeType = MimeType (" text/html" )
313- public val XHTML : MimeType = MimeType (" application/xhtml+xml" )
314- public val CSS : MimeType = MimeType (" text/css" )
315262 public val JSON : MimeType = MimeType (" text/json" )
316- public val JSON5 : MimeType = MimeType (" text/json5" )
317- public val JSON_LINES : MimeType = MimeType (" application/x-ndjson" )
318263 public val REGEX : MimeType = MimeType (" text/x-regex-source" )
319264 public val GROOVY : MimeType = MimeType (" text/groovy" )
320265 public val C : MimeType = MimeType (" text/c" )
@@ -333,9 +278,6 @@ public value class MimeType(private val mimeType: String) {
333278 public val SHELL : MimeType = MimeType (" application/x-sh" )
334279 public val YAML : MimeType = MimeType (" text/yaml" )
335280 public val GO : MimeType = MimeType (" text/go" )
336- public val RUBY : MimeType = MimeType (" text/x-ruby" )
337- public val CLOJURE : MimeType = MimeType (" text/x-clojure" )
338- public val OBJECTIVE_C : MimeType = MimeType (" text/x-objectivec" )
339281
340282 /* * Note that most resource files will also have a folder type, so don't use equality on this mime type */
341283 public val RESOURCE : MimeType = MimeType (" $XML ; $ATTR_ROLE =resource" )
@@ -352,21 +294,15 @@ public value class MimeType(private val mimeType: String) {
352294 " kotlin" ,
353295 " kt" ,
354296 " kts" -> KOTLIN
355- " clj" ,
356- " cljs" ,
357- " cljr" ,
358- " cljc" ,
359- " cljd" -> CLOJURE
297+
360298 " java" -> JAVA
361- " html" -> HTML
362- " xhtml" -> XHTML
363- " css" -> CSS
364- " json" -> JSON
365- " json5" -> JSON5
366- " json lines" ,
367- " jsonl" -> JSON_LINES
299+ " xml" -> XML
300+ " json" ,
301+ " json5" -> JSON
302+
368303 " regex" ,
369304 " regexp" -> REGEX
305+
370306 " groovy" -> GROOVY
371307 " toml" -> TOML
372308 " c" -> C
@@ -380,23 +316,28 @@ public value class MimeType(private val mimeType: String) {
380316 " python3" ,
381317 " py" ,
382318 " python" -> PYTHON
319+
383320 " dart" -> DART
384321 " rust" -> RUST
385322 " js" ,
386323 " javascript" -> JAVASCRIPT
387- " ts " ,
324+
388325 " typescript" -> TYPESCRIPT
389326 " sksl" -> AGSL
390327 " sh" ,
391328 " bash" ,
392329 " zsh" ,
393330 " shell" -> SHELL
331+
394332 " yaml" ,
395333 " yml" -> YAML
334+
396335 " go" ,
397336 " golang" -> GO
337+
398338 " diff" -> DIFF
399339 " patch" -> PATCH
340+
400341 else -> null
401342 }
402343 }
0 commit comments