Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions package/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ export class API {
/**
* search returns the list of results fetched from the Sourcegraph search API.
*/
async search({
query,
fileLocal = false,
}: {
query: string
fileLocal?: boolean
}): Promise<Result[]> {
async search(query: string): Promise<Result[]> {
const fileLocal =
this.sourcegraph.configuration.get<Settings>().get('fileLocal') ||
false

if (this.traceSearch) {
console.log('%c' + 'Search', 'font-weight:bold;', {
query,
Expand Down
20 changes: 7 additions & 13 deletions package/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ export function findDocstring({
*/
export interface Settings {
['basicCodeIntel.debug.traceSearch']?: boolean
['fileLocal']?: boolean
}

interface BlockCommentStyle {
Expand Down Expand Up @@ -628,14 +629,7 @@ export class Handler {
this.sourcegraph.internal.sourcegraphURL.href ===
'https://sourcegraph.com/',
})) {
const symbolResults = (await this.api.search({
query,
fileLocal: Boolean(
this.sourcegraph.configuration
.get()
.get('feature.fileLocal')
),
}))
const symbolResults = (await this.api.search(query))
.filter(
result =>
!result.fileLocal ||
Expand Down Expand Up @@ -681,7 +675,7 @@ export class Handler {
searchToken,
doc,
fileExts: this.fileExts,
}).map(query => this.api.search({ query }))
}).map(query => this.api.search(query))
)
).map(result =>
resultToLocation({ result, sourcegraph: this.sourcegraph })
Expand All @@ -706,10 +700,10 @@ export class Handler {
} else {
const { repo, rev, path } = parseUri(doc.uri)

const r = await this.api.search({
query: `repo:${repo}@${rev} count:1000 file:${path} type:symbol ^`, // ^ matches everything (can't leave out a query)
fileLocal: true,
})
// ^ matches everything (can't leave out a query)
const r = await this.api.search(
`repo:${repo}@${rev} count:1000 file:${path} type:symbol ^`
)
editor.setDecorations(
this.sourcegraph.app.createDecorationType(),
r.map(v => ({
Expand Down