Skip to content
This repository was archived by the owner on Jun 7, 2022. 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"yarn-deduplicate": "^1.1.1"
},
"dependencies": {
"@sourcegraph/basic-code-intel": "^9.0.0",
"@sourcegraph/basic-code-intel": "^10.0.0",
"@sourcegraph/lightstep-tracer-webworker": "^0.20.14-fork.3",
"@sourcegraph/typescript-language-server": "^0.3.7-fork",
"@sourcegraph/vscode-ws-jsonrpc": "0.0.3-fork",
Expand Down
24 changes: 20 additions & 4 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { URL as _URL, URLSearchParams as _URLSearchParams } from 'whatwg-url'
Object.assign(_URL, self.URL)
Object.assign(self, { URL: _URL, URLSearchParams: _URLSearchParams })

import { initLSIF, mkIsLSIFAvailable } from '@sourcegraph/basic-code-intel'
import { initLSIF, mkIsLSIFAvailable, impreciseBadge } from '@sourcegraph/basic-code-intel'
import { Tracer as LightstepTracer } from '@sourcegraph/lightstep-tracer-webworker'
import {
createMessageConnection,
Expand Down Expand Up @@ -519,7 +519,12 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
if (lsifResult) {
yield lsifResult.value
} else if (!config.value['typescript.serverUrl']) {
yield await basicCodeIntel.hover(textDocument, position)
const result = await basicCodeIntel.hover(textDocument, position)
if (result) {
yield { ...result, badge: impreciseBadge }
} else {
yield undefined
}
} else {
const textDocumentUri = new URL(textDocument.uri)
const serverRootUri = resolveServerRootUri(textDocumentUri, serverSgEndpoint)
Expand Down Expand Up @@ -568,7 +573,16 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
if (lsifResult) {
yield lsifResult.value
} else if (!config.value['typescript.serverUrl']) {
yield await basicCodeIntel.definition(textDocument, position)
const result = await basicCodeIntel.definition(textDocument, position)
if (result) {
if (Array.isArray(result)) {
yield result.map(v => ({ ...v, badge: impreciseBadge }))
} else {
yield { ...result, badge: impreciseBadge }
}
} else {
yield undefined
}
} else {
const textDocumentUri = new URL(textDocument.uri)
const serverRootUri = resolveServerRootUri(textDocumentUri, serverSgEndpoint)
Expand Down Expand Up @@ -625,7 +639,9 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>

yield [
...(lsifReferences === undefined ? [] : lsifReferences.value),
...fuzzyReferences.filter(fuzzyRef => !lsifFiles.has(file(fuzzyRef))),
...fuzzyReferences
.filter(fuzzyRef => !lsifFiles.has(file(fuzzyRef)))
.map(v => ({ ...v, badge: impreciseBadge })),
]
} else {
const textDocumentUri = new URL(textDocument.uri)
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -801,10 +801,10 @@
resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==

"@sourcegraph/basic-code-intel@^9.0.0":
version "9.0.0"
resolved "https://registry.npmjs.org/@sourcegraph/basic-code-intel/-/basic-code-intel-9.0.0.tgz#fb750d8b02a4dcb6eb1dab123ea547c3c8897203"
integrity sha512-HChZ2dOlG2teKWwnTG72zZcK7eXpndCzp/z0nM+UmDgtUG7xAoO68xt1NMmko2mkD/aTqlya4ni9D9jMEN5oAA==
"@sourcegraph/basic-code-intel@^10.0.0":
version "10.0.0"
resolved "https://registry.npmjs.org/@sourcegraph/basic-code-intel/-/basic-code-intel-10.0.0.tgz#b505f9c8dd2cd63b0bd98b3fd8ad4c7813464c65"
integrity sha512-ZYFv3zMEOQK3LlSr5McevXWMbBZsuOLT3JWrr1T4bCZ4prQ3A5yvyIinsDWAK5y31obTrb+v0KZJ0i8ly7HbAg==
dependencies:
lodash "^4.17.11"
rxjs "^6.3.3"
Expand Down