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

@ -240,7 +240,12 @@ public class DoricDev {
List<DoricContext> list = new ArrayList<>();
source = source.replace(".js", "").replace(".ts", "");
for (DoricContext context : DoricContextManager.aliveContexts()) {
String doricSource = context.getSource().replace(".js", "").replace(".ts", "");
String doricSource = context.getSource();
String[] split = doricSource.split(";");
if (split.length > 1) {
doricSource = split[0];
}
doricSource = doricSource.replace(".js", "").replace(".ts", "");
if (source.equals(doricSource) || doricSource.equals("__dev__")) {
list.add(context);
}

View File

@ -187,7 +187,12 @@ - (BOOL)isReloadingContext:(DoricContext *)context {
withString:@""
];
for (DoricContext *context in [DoricContextManager.instance aliveContexts]) {
NSString *contextSource = [[context.source stringByReplacingOccurrencesOfString:@".js"
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);