Skip to content

Commit

Permalink
add error handling with regex search
Browse files Browse the repository at this point in the history
  • Loading branch information
guopenghui committed Dec 21, 2022
1 parent 939329c commit 7a0c879
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/Outline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,14 @@ let renderMethod = computed(() => {
let pattern = ref("");
function regexFilter(pattern: string, option: TreeOption): boolean {
let rule = RegExp(pattern, "i");
return rule.test(option.label);
let rule = /.*/;
try {
rule = RegExp(pattern, "i");
} catch (e) {
} finally {
return rule.test(option.label);
}
}
function simpleFilter(pattern: string, option: TreeOption): boolean {
Expand Down
4 changes: 2 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ interface QuietOutlineSettings {

const DEFAULT_SETTINGS: QuietOutlineSettings = {
patch_color: true,
primary_color_light: "18a058",
primary_color_dark: "63e2b7",
primary_color_light: "#18a058",
primary_color_dark: "#63e2b7",
rainbow_line: false,
rainbow_color_1: "#FD8B1F",
rainbow_color_2: "#FFDF00",
Expand Down

0 comments on commit 7a0c879

Please sign in to comment.