Skip to content

Commit 7f42803

Browse files
committed
Fix extra arguments white space bug.
1 parent e82d440 commit 7f42803

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

XPCService/Settings+Service.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ extension SettingsFormat: SettingsCSS {
7575
if let v = plistData[SettingsBase.Key.syntax] {
7676
self.specialSyntax = v
7777
}
78-
if let v = plistData[SettingsBase.Key.preprocessor] {
78+
if let v = plistData[SettingsBase.Key.preprocessor], !v.trimmingCharacters(in: .whitespaces).isEmpty {
7979
self.specialPreprocessor = v
8080
}
81-
if let v = plistData[SettingsBase.Key.extraArguments] {
81+
if let v = plistData[SettingsBase.Key.extraArguments], !v.trimmingCharacters(in: .whitespaces).isEmpty {
8282
self.specialAppendArguments = v
8383
}
8484
}

XPCService/Settings.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ class SettingsBase: NSObject {
539539
}
540540

541541
// Extra arguments for _highlight_.
542-
if let args = settings[SettingsBase.Key.extraArguments] as? String {
542+
if let args = settings[SettingsBase.Key.extraArguments] as? String, !args.trimmingCharacters(in: .whitespaces).isEmpty {
543543
self.arguments = args
544544
self.isArgumentsDefined = true
545545
}
@@ -895,7 +895,7 @@ class SettingsFormat: SettingsBase, SettingsFormatProtocol, SettingsLSP {
895895

896896
super.override(fromDictionary: dict)
897897

898-
if let args = settings[SettingsBase.Key.appendedExtraArguments] as? String {
898+
if let args = settings[SettingsBase.Key.appendedExtraArguments] as? String, !args.trimmingCharacters(in: .whitespaces).isEmpty {
899899
self.appendArguments = args
900900
self.isAppendArgumentsDefined = true
901901
}
@@ -919,7 +919,7 @@ class SettingsFormat: SettingsBase, SettingsFormatProtocol, SettingsLSP {
919919
if let v = specials[SettingsBase.Key.syntax] {
920920
self.specialSyntax = v
921921
}
922-
if let v = specials[SettingsBase.Key.appendedExtraArguments] {
922+
if let v = specials[SettingsBase.Key.appendedExtraArguments], !v.trimmingCharacters(in: .whitespaces).isEmpty {
923923
self.specialAppendArguments = v
924924
}
925925
}
@@ -948,7 +948,7 @@ class SettingsFormat: SettingsBase, SettingsFormatProtocol, SettingsLSP {
948948
if let syntax = self.specialSyntax {
949949
special[SettingsBase.Key.syntax] = syntax
950950
}
951-
if let appendArguments = self.specialAppendArguments {
951+
if let appendArguments = self.specialAppendArguments, !appendArguments.trimmingCharacters(in: .whitespaces).isEmpty {
952952
special[SettingsBase.Key.appendedExtraArguments] = appendArguments
953953
}
954954
if !special.isEmpty {
@@ -1403,10 +1403,10 @@ class Settings: SettingsBase {
14031403
}
14041404
}
14051405

1406-
func searchPlainSettings(for url: URL) -> PlainSettings? {
1406+
func searchPlainSettings(for url: URL, mimeType: String?) -> PlainSettings? {
14071407
let name = url.lastPathComponent
14081408
for s in self.plainSettings {
1409-
if s.test(filename: name) {
1409+
if s.test(filename: name, mimeType: mimeType) {
14101410
return s
14111411
}
14121412
}
@@ -1728,7 +1728,7 @@ class SettingsRendering: Settings, SettingsFormatProtocol, SettingsLSP {
17281728
self.isError = v
17291729
}
17301730

1731-
if let args = settings[SettingsBase.Key.appendedExtraArguments] as? String {
1731+
if let args = settings[SettingsBase.Key.appendedExtraArguments] as? String, !args.trimmingCharacters(in: .whitespaces).isEmpty {
17321732
self.appendArguments = args
17331733
self.isAppendArgumentsDefined = true
17341734
}

0 commit comments

Comments
 (0)