Skip to content
This repository was archived by the owner on Jun 7, 2022. It is now read-only.

Add button to submit feedback #175

Merged
merged 3 commits into from
Apr 23, 2019
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
13 changes: 12 additions & 1 deletion extension/src/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 { activateBasicCodeIntel } from '@sourcegraph/basic-code-intel'
import { activateBasicCodeIntel, registerFeedbackButton } from '@sourcegraph/basic-code-intel'
import { Tracer as LightstepTracer } from '@sourcegraph/lightstep-tracer-webworker'
import {
createMessageConnection,
Expand Down Expand Up @@ -106,6 +106,15 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
if (!config.value['typescript.serverUrl']) {
logger.warn('No typescript.serverUrl configured, falling back to basic code intelligence')
// Fall back to basic-code-intel behavior

ctx.subscriptions.add(
registerFeedbackButton({
languageID: 'typescript',
sourcegraph,
isPrecise: false,
})
)

return activateBasicCodeIntel({
sourcegraph,
languageID: 'typescript',
Expand Down Expand Up @@ -137,6 +146,8 @@ export async function activate(ctx: sourcegraph.ExtensionContext): Promise<void>
})(ctx)
}

ctx.subscriptions.add(registerFeedbackButton({ languageID: 'typescript', sourcegraph, isPrecise: true }))

const tracer: Tracer = config.value['lightstep.token']
? new LightstepTracer({ access_token: config.value['lightstep.token'], component_name: 'ext-lang-typescript' })
: new Tracer()
Expand Down
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,28 @@
"label": "References: Search mode",
"description": "Results come from text search and heuristics. To use a language server for precise results, click to go to the README and follow the deployment instructions."
}
},
{
"id": "feedback",
"command": "open",
"title": "Submit code intel feedback",
"commandArguments": [
"${get(context, `codeIntel.feedbackLink`)}"
],
"actionItem": {
"description": "Submit code intel feedback",
"iconURL": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTExLjk5IDJDNi40NyAyIDIgNi40OCAyIDEyczQuNDcgMTAgOS45OSAxMEMxNy41MiAyMiAyMiAxNy41MiAyMiAxMlMxNy41MiAyIDExLjk5IDJ6TTEyIDIwYy00LjQyIDAtOC0zLjU4LTgtOHMzLjU4LTggOC04IDggMy41OCA4IDgtMy41OCA4LTggOHptMy41LTljLjgzIDAgMS41LS42NyAxLjUtMS41UzE2LjMzIDggMTUuNSA4IDE0IDguNjcgMTQgOS41cy42NyAxLjUgMS41IDEuNXptLTcgMGMuODMgMCAxLjUtLjY3IDEuNS0xLjVTOS4zMyA4IDguNSA4IDcgOC42NyA3IDkuNSA3LjY3IDExIDguNSAxMXptMy41IDYuNWMyLjMzIDAgNC4zMS0xLjQ2IDUuMTEtMy41SDYuODljLjggMi4wNCAyLjc4IDMuNSA1LjExIDMuNXoiLz48L3N2Zz4="
}
}
],
"menus": {
"editor/title": [
{
"action": "typescript.toggle"
},
{
"action": "feedback",
"when": "showFeedback"
}
],
"commandPalette": [],
Expand Down Expand Up @@ -196,7 +212,7 @@
"yarn-deduplicate": "^1.1.1"
},
"dependencies": {
"@sourcegraph/basic-code-intel": "^6.0.15",
"@sourcegraph/basic-code-intel": "^6.0.17",
"@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
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,10 @@
resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==

"@sourcegraph/basic-code-intel@^6.0.15":
version "6.0.15"
resolved "https://registry.npmjs.org/@sourcegraph/basic-code-intel/-/basic-code-intel-6.0.15.tgz#b7c0baa894d89244fc5155a08839543cdbcca4ea"
integrity sha512-oMNbyAar7Sy4gnX5hLXQZhmLFy19zFtKndkJ4BlLCvRsmuJozMgWT32sUnhpDrco32NJQf6Irgl7a7PFX1Gb5w==
"@sourcegraph/basic-code-intel@^6.0.17":
version "6.0.17"
resolved "https://registry.npmjs.org/@sourcegraph/basic-code-intel/-/basic-code-intel-6.0.17.tgz#ca8a9a2d14fdf8876dc7049b41da4986881f7872"
integrity sha512-FBTXinS6Pn4eX0PpOOeJ7x4nYDn02spXI+5qtssntx91M+AZSCly/1DLF+ThDZXe+t4LR1LaO00vVnB7avLnpw==
dependencies:
lodash "^4.17.11"
rxjs "^6.3.3"
Expand Down