feat: context's source ignore what behinds semicolon

This commit is contained in:
pengfei.zhou
2022-01-10 10:28:20 +08:00
committed by osborn
parent e822797166
commit 6bc9c7629a
2 changed files with 14 additions and 4 deletions

View File

@@ -187,8 +187,13 @@ - (BOOL)isReloadingContext:(DoricContext *)context {
withString:@""
];
for (DoricContext *context in [DoricContextManager.instance aliveContexts]) {
NSString *contextSource = [[context.source stringByReplacingOccurrencesOfString:@".js"
withString:@""]
NSString *contextSource = context.source;
NSArray<NSString *> *split = [contextSource componentsSeparatedByString:@";"];
if (split.count > 1) {
contextSource = split[0];
}
contextSource = [[contextSource stringByReplacingOccurrencesOfString:@".js"
withString:@""]
stringByReplacingOccurrencesOfString:@".ts"
withString:@""
];
@@ -288,7 +293,7 @@ - (NSString *)ip {
// Return presented view controller
return findBestViewController(vc.presentedViewController);
} else if ([vc isKindOfClass:[UISplitViewController class]]) {
// Return right hand side
// Return right-hand side
UISplitViewController *svc = (UISplitViewController *) vc;
if (svc.viewControllers.count > 0)
return findBestViewController(svc.viewControllers.lastObject);