feat:reload match context adjust

This commit is contained in:
pengfeizhou
2021-02-25 11:31:55 +08:00
committed by osborn
parent 39fbd296de
commit d834f03835
2 changed files with 14 additions and 2 deletions

View File

@@ -154,8 +154,18 @@ - (BOOL)isReloadingContext:(DoricContext *)context {
- (DoricContext *)matchContext:(NSString *)source {
source = [[source stringByReplacingOccurrencesOfString:@".js"
withString:@""]
stringByReplacingOccurrencesOfString:@".ts"
withString:@""
];
for (DoricContext *context in [DoricContextManager.instance aliveContexts]) {
if ([source containsString:context.source] || [context.source isEqualToString:@"__dev__"]) {
NSString *contextSource = [[context.source stringByReplacingOccurrencesOfString:@".js"
withString:@""]
stringByReplacingOccurrencesOfString:@".ts"
withString:@""
];
if ([source isEqualToString:contextSource] || [contextSource isEqualToString:@"__dev__"]) {
return context;
}
}