Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/remoteSearch/common/utils.ts
13401 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ICodeOrDocsSearchBaseScopingQuery } from './codeOrDocsSearchClient';
7
8
export function formatScopingQuery(query: ICodeOrDocsSearchBaseScopingQuery) {
9
const repo: string[] = Array.isArray(query.repo) ? query.repo : [query.repo];
10
const parts: string[] = [
11
`(repo:${repo.join(' OR repo:')})`
12
];
13
if (query.lang) {
14
parts.push(`(lang:${query.lang.join(' OR lang:')})`);
15
}
16
if (query.notLang) {
17
parts.push(`NOT (lang:${query.notLang.join(' OR lang:')})`);
18
}
19
if (query.path) {
20
parts.push(`(path:${query.path.join(' OR path:')})`);
21
}
22
if (query.notPath) {
23
parts.push(`NOT (path:${query.notPath.join(' OR path:')})`);
24
}
25
return parts.join(' ');
26
}
27
28