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<>(); List<DoricContext> list = new ArrayList<>();
source = source.replace(".js", "").replace(".ts", ""); source = source.replace(".js", "").replace(".ts", "");
for (DoricContext context : DoricContextManager.aliveContexts()) { 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__")) { if (source.equals(doricSource) || doricSource.equals("__dev__")) {
list.add(context); list.add(context);
} }

View File

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