Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Commit 8e4e3f1

Browse files
committed
fix: upgrade @sourcegraph/extensions-client-common
The new version requires a `location` to be passed through.
1 parent 4e778c0 commit 8e4e3f1

File tree

8 files changed

+42
-32
lines changed

8 files changed

+42
-32
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"dependencies": {
114114
"@slimsag/react-shortcuts": "^1.2.1",
115115
"@sourcegraph/codeintellify": "^3.9.0",
116-
"@sourcegraph/extensions-client-common": "^10.3.1",
116+
"@sourcegraph/extensions-client-common": "^10.4.1",
117117
"@sourcegraph/react-loading-spinner": "0.0.6",
118118
"@sqs/jsonc-parser": "^1.0.3",
119119
"@types/uglifyjs-webpack-plugin": "1.1.0",

src/libs/code_intelligence/code_intelligence.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import { propertyIsDefined } from '@sourcegraph/codeintellify/lib/helpers'
1414
import { HoverMerged } from '@sourcegraph/codeintellify/lib/types'
1515
import { toPrettyBlobURL } from '@sourcegraph/codeintellify/lib/url'
16+
import * as H from 'history'
1617
import * as React from 'react'
1718
import { render } from 'react-dom'
1819
import { animationFrameScheduler, BehaviorSubject, Observable, of, Subject, Subscription } from 'rxjs'
@@ -472,6 +473,7 @@ function handleCodeHost(codeHost: CodeHost): Subscription {
472473
simpleProviderFns={
473474
extensionsController ? createLSPFromExtensions(extensionsController) : lspViaAPIXlang
474475
}
476+
location={H.createLocation(window.location)}
475477
/>,
476478
mount
477479
)

src/libs/code_intelligence/extensions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,21 @@ export function initializeExtensions(
115115
documents: Observable<TextDocumentItem[] | null>
116116
): Controllers {
117117
const { extensionsContextController, extensionsController } = createControllers(documents)
118+
const history = H.createBrowserHistory()
118119

119120
render(
120121
<ShortcutProvider>
121122
<CommandListPopoverButton
122123
extensionsController={extensionsController}
123124
menu={ContributableMenu.CommandPalette}
124125
extensions={extensionsContextController}
126+
location={history.location}
125127
/>
126128
<Notifications extensionsController={extensionsController} />
127129
</ShortcutProvider>,
128130
getCommandPaletteMount()
129131
)
130132

131-
const history = H.createBrowserHistory()
132133
render(
133134
<GlobalDebug extensionsController={extensionsController} location={history.location} />,
134135
getGlobalDebugMount()

src/libs/github/extensions.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,27 @@ export function getGlobalDebugMount(): HTMLElement {
4444
}
4545

4646
// TODO: remove with old inject
47-
export function injectExtensionsGlobalComponents({
48-
extensionsController,
49-
extensionsContextController,
50-
}: {
51-
extensionsController: ClientController<ConfigurationSubject, Settings>
52-
extensionsContextController: Controller<ConfigurationSubject, Settings>
53-
}): void {
47+
export function injectExtensionsGlobalComponents(
48+
{
49+
extensionsController,
50+
extensionsContextController,
51+
}: {
52+
extensionsController: ClientController<ConfigurationSubject, Settings>
53+
extensionsContextController: Controller<ConfigurationSubject, Settings>
54+
},
55+
location: H.Location
56+
): void {
5457
render(
5558
<ShortcutProvider>
5659
<CommandListPopoverButton
5760
extensionsController={extensionsController}
5861
menu={ContributableMenu.CommandPalette}
5962
extensions={extensionsContextController}
63+
location={location}
6064
/>
6165
</ShortcutProvider>,
6266
getCommandPaletteMount()
6367
)
6468

65-
const history = H.createBrowserHistory()
66-
render(
67-
<GlobalDebug extensionsController={extensionsController} location={history.location} />,
68-
getGlobalDebugMount()
69-
)
69+
render(<GlobalDebug extensionsController={extensionsController} location={location} />, getGlobalDebugMount())
7070
}

src/libs/github/inject.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
} from '@sourcegraph/extensions-client-common/lib/settings'
2323
import { ConfigurationSubject } from '@sourcegraph/extensions-client-common/lib/settings'
2424
import { ConfigurationCascade } from '@sourcegraph/extensions-client-common/lib/settings'
25+
import * as H from 'history'
2526

2627
import mermaid from 'mermaid'
2728
import * as React from 'react'
@@ -131,10 +132,13 @@ function injectCodeIntelligence(): void {
131132
const constExtensionsContextController = extensionsContextController!
132133
const constController = extensionsController!
133134

134-
injectExtensionsGlobalComponents({
135-
extensionsController: constController,
136-
extensionsContextController: constExtensionsContextController,
137-
})
135+
injectExtensionsGlobalComponents(
136+
{
137+
extensionsController: constController,
138+
extensionsContextController: constExtensionsContextController,
139+
},
140+
H.createLocation(window.location)
141+
)
138142

139143
resolveRev({ repoPath, rev: parseURL().rev })
140144
.pipe(retryWhenCloneInProgressError())
@@ -396,6 +400,8 @@ function injectCodeSnippetAnnotator(
396400
mount.className = 'sourcegraph-app-annotator'
397401
filePathContainer.appendChild(mount)
398402

403+
const location = H.createLocation(window.location)
404+
399405
const renderCodeView = (commitID: string) =>
400406
render(
401407
<CodeViewToolbar
@@ -406,6 +412,7 @@ function injectCodeSnippetAnnotator(
406412
buttonProps={buttonProps}
407413
simpleProviderFns={lspViaAPIXlang}
408414
actionsNavItemClassProps={actionsNavItemClassProps}
415+
location={location}
409416
/>,
410417
mount
411418
)
@@ -625,6 +632,7 @@ function injectBlobAnnotators(
625632
extensionsController={extensionsController}
626633
extensions={extensions}
627634
actionsNavItemClassProps={actionsNavItemClassProps}
635+
location={H.createLocation(window.location)}
628636
/>,
629637
mount
630638
)
@@ -698,6 +706,7 @@ function injectBlobAnnotators(
698706
buttonProps={buttonProps}
699707
simpleProviderFns={simpleProviderFns}
700708
actionsNavItemClassProps={actionsNavItemClassProps}
709+
location={H.createLocation(window.location)}
701710
/>,
702711
mount
703712
)

src/shared/components/CodeViewToolbar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
ConfigurationSubject,
88
Settings,
99
} from '@sourcegraph/extensions-client-common/lib/settings'
10+
import H from 'history'
1011
import * as React from 'react'
1112
import { Subscription } from 'rxjs'
1213
import { ContributableMenu } from 'sourcegraph/module/protocol'
@@ -34,6 +35,7 @@ interface CodeViewToolbarProps
3435
actionItemClass?: string
3536
}
3637
simpleProviderFns: SimpleProviderFns
38+
location: H.Location
3739
}
3840

3941
interface CodeViewToolbarState extends ConfigurationCascadeProps<ConfigurationSubject, Settings> {
@@ -81,6 +83,7 @@ export class CodeViewToolbar extends React.Component<CodeViewToolbarProps, CodeV
8183
extensions={this.props.extensions}
8284
listClass="BtnGroup"
8385
actionItemClass="btn btn-sm tooltipped tooltipped-n BtnGroup-item"
86+
location={this.props.location}
8487
/>
8588
)}
8689
</ul>

src/shared/components/LegacyCodeViewToolbar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
ConfigurationSubject,
1717
Settings,
1818
} from '@sourcegraph/extensions-client-common/lib/settings'
19+
import H from 'history'
1920
import * as React from 'react'
2021
import { Subscription } from 'rxjs'
2122
import { ContributableMenu } from 'sourcegraph/module/protocol'
@@ -49,6 +50,7 @@ interface CodeViewToolbarProps
4950
actionItemClass?: string
5051
}
5152
simpleProviderFns: SimpleProviderFns
53+
location: H.Location
5254
}
5355

5456
interface CodeViewToolbarState extends ConfigurationCascadeProps<ConfigurationSubject, Settings> {
@@ -94,6 +96,7 @@ export class CodeViewToolbar extends React.Component<CodeViewToolbarProps, CodeV
9496
extensions={this.props.extensions}
9597
listClass="BtnGroup"
9698
actionItemClass="btn btn-sm tooltipped tooltipped-n BtnGroup-item"
99+
location={this.props.location}
97100
/>
98101
</div>
99102
)}

yarn.lock

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,10 +1331,10 @@
13311331
rxjs "^6.3.2"
13321332
vscode-languageserver-types "^3.8.2"
13331333

1334-
"@sourcegraph/extensions-client-common@^10.3.1":
1335-
version "10.3.1"
1336-
resolved "https://registry.yarnpkg.com/@sourcegraph/extensions-client-common/-/extensions-client-common-10.3.1.tgz#e4f0250a5799336b25e0ecb9a99e0119e8c79292"
1337-
integrity sha512-dj+DD0n8IxWERzHauCjESjlhI0GT0yJTYvGUZl/9/6QTDvLJ9TQXiKgBbS/NBsRkX0COIGTl/AIwXsiWiCVDJQ==
1334+
"@sourcegraph/extensions-client-common@^10.4.1":
1335+
version "10.4.1"
1336+
resolved "https://registry.yarnpkg.com/@sourcegraph/extensions-client-common/-/extensions-client-common-10.4.1.tgz#2f40925509e9c6ce2d177e3a329a530290f79a69"
1337+
integrity sha512-K8T4vfmhV6y/4QVcKyLahuBBOC15/YXzO9y/ggxekw/EDnqF2tXjMxQHg62EM8sM2p+F28pvs2aDZAI0QOMEyw==
13381338
dependencies:
13391339
"@slimsag/react-shortcuts" "^1.2.0"
13401340
bootstrap "^4.1.3"
@@ -1344,7 +1344,7 @@
13441344
react-router-dom "^4.3.1"
13451345
reactstrap "^6.4.0"
13461346
rxjs "^6.3.2"
1347-
sourcegraph "^18.0.0"
1347+
sourcegraph "^18.2.0"
13481348
string-score "^1.0.1"
13491349
ts-key-enum "^2.0.0"
13501350

@@ -14141,15 +14141,7 @@ source-map@^0.7.2:
1414114141
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
1414214142
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
1414314143

14144-
sourcegraph@^18.0.0:
14145-
version "18.0.1"
14146-
resolved "https://registry.yarnpkg.com/sourcegraph/-/sourcegraph-18.0.1.tgz#7e741c1521337cb799fc0f8f1ecc6dd8158aa504"
14147-
integrity sha512-fhrbx6v0s0sAcdiO5VoxI/es0bhTy5npksT+EHENUj94L2KcRj39qlH4RYwutZgn7K/dirnX7tso/H9K9+c0Lw==
14148-
dependencies:
14149-
minimatch "^3.0.4"
14150-
rxjs "^6.3.2"
14151-
14152-
sourcegraph@^18.4.0:
14144+
sourcegraph@^18.2.0, sourcegraph@^18.4.0:
1415314145
version "18.4.0"
1415414146
resolved "https://registry.yarnpkg.com/sourcegraph/-/sourcegraph-18.4.0.tgz#53b8d181c9a45075c5f6e870a3d29d7a239ca39d"
1415514147
integrity sha512-l7sAmHE2I4UaMqZ2SC+YjJ2kqGT4ZdCr29lBbH3KaNANGl+hvI3qpe4UAhBGkjUUANWcBeeL9cDHRvAuf4Ovmg==

0 commit comments

Comments
 (0)