diff --git a/.vscode/launch.json b/.vscode/launch.json index 6c254f63b..a42bf33e5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -22,6 +22,20 @@ "cwd": "${workspaceFolder}", "args": ["-index", "${input:indexPath}"] }, + { + "name": "Webserver (rpc)", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "cmd/zoekt-webserver", + "cwd": "${workspaceFolder}", + "args": ["-index", "${input:indexPath}", "-rpc"], + // Set a long watchdog tick to help with debugging + "env": { + "ZOEKT_WATCHDOG_TICK": "24h", + "SRC_LOG_LEVEL": "debug" + } + }, { "name": "Attach to Process (from list)", "type": "go", diff --git a/query/parse.go b/query/parse.go index d8762f191..a9ffd23e8 100644 --- a/query/parse.go +++ b/query/parse.go @@ -19,6 +19,7 @@ import ( "fmt" "log" "regexp/syntax" + "strings" "github.com/grafana/regexp" "github.com/sourcegraph/zoekt/internal/languages" @@ -239,6 +240,18 @@ func parseExpr(in []byte) (Q, int, error) { } // Later we will lift this into a root, like we do for caseQ expr = &Type{Type: t, Child: nil} + case tokRepoSet: + // Split the text by commas to get individual repo names + repos := strings.Split(text, ",") + set := make(map[string]bool) + for _, repo := range repos { + repo = strings.TrimSpace(repo) + if repo != "" { + set[repo] = true + } + } + + expr = &RepoSet{Set: set} } return expr, len(in) - len(b), nil @@ -392,6 +405,7 @@ const ( tokArchived = 15 tokPublic = 16 tokFork = 17 + tokRepoSet = 18 ) var tokNames = map[int]string{ @@ -412,6 +426,7 @@ var tokNames = map[int]string{ tokLang: "Language", tokSym: "Symbol", tokType: "Type", + tokRepoSet: "RepoSet", } var prefixes = map[string]int{ @@ -432,6 +447,7 @@ var prefixes = map[string]int{ "sym:": tokSym, "t:": tokType, "type:": tokType, + "reposet:": tokRepoSet, } var reservedWords = map[string]int{