Skip to content
This repository was archived by the owner on Feb 22, 2020. 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
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
21 changes: 21 additions & 0 deletions buildkite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
env:
FORCE_COLOR: '1'

steps:
# Run tests
- command: |-
yarn
yarn run prettier-check
yarn run tslint
yarn run typecheck
yarn run build
label: ':go:'

- wait

# Build & deploy extension
- command: ./deploy.sh
branches: master
label: ':rocket:'
concurrency: 1
concurrency_group: deploy
10 changes: 10 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -ex
cd "$(dirname "${BASH_SOURCE[0]}")"

# Install dependencies
yarn

# Build & publish extension
src ext publish
12 changes: 12 additions & 0 deletions dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -ex

yarn
env FORCE_COLOR=0 \
yarn run concurrently \
--names serve,build \
--prefix name \
--kill-others \
'yarn run serve | cat' \
'yarn run watch:typecheck'
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"@sourcegraph/prettierrc": "^2.2.0",
"@sourcegraph/tsconfig": "^3.0.0",
"@sourcegraph/tslint-config": "^12.3.1",
"concurrently": "^4.1.0",
"parcel-bundler": "^1.11.0",
"sourcegraph": "^23.0.0",
"tslint": "^5.11.0",
Expand Down
27 changes: 13 additions & 14 deletions src/lang-go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function userHasAccessTokenWithNote(note: string): Promise<boolean> {
) {
return false
}
if (response.currentUser.accessTokens.pageInfo && response.currentUser.accessTokens.pageInfo.hasNextPage === true) {
if (response.currentUser.accessTokens.pageInfo && response.currentUser.accessTokens.pageInfo.hasNextPage) {
throw new Error('You have too many access tokens (over 1000).')
}
return response.currentUser.accessTokens.nodes.some(token => token.note === note)
Expand Down Expand Up @@ -247,20 +247,19 @@ function repoNameFromDoc(doc: sourcegraph.TextDocument): string {
*/
function mkSendRequest(address: string, token: string | undefined): Observable<SendRequest> {
const rootURIToConnection: { [rootURI: string]: Promise<rpc.MessageConnection> } = {}
function connectionFor(root: URL): Promise<rpc.MessageConnection> {
async function connectionFor(root: URL): Promise<rpc.MessageConnection> {
if (rootURIToConnection[root.href]) {
return rootURIToConnection[root.href]
} else {
rootURIToConnection[root.href] = connectAndInitialize(address, root, token)
rootURIToConnection[root.href].then(connection => {
connection.onDispose(() => {
delete rootURIToConnection[root.href]
})
connection.onClose(() => {
delete rootURIToConnection[root.href]
})
const connection = await rootURIToConnection[root.href]
connection.onDispose(() => {
delete rootURIToConnection[root.href]
})
return rootURIToConnection[root.href]
connection.onClose(() => {
delete rootURIToConnection[root.href]
})
return connection
}
}

Expand All @@ -275,11 +274,12 @@ function mkSendRequest(address: string, token: string | undefined): Observable<S
}
}

return Observable.create((observer: Observer<SendRequest>) => {
return new Observable((observer: Observer<SendRequest>) => {
observer.next(sendRequest)
return () => {
for (const rootURI of Object.keys(rootURIToConnection)) {
if (rootURIToConnection[rootURI]) {
// tslint:disable-next-line: no-floating-promises
rootURIToConnection[rootURI].then(connection => connection.dispose())
delete rootURIToConnection[rootURI]
}
Expand Down Expand Up @@ -487,7 +487,6 @@ function xrefs({

return (response || []).map(ref => ({ ...ref, currentDocURI: rootURI.href }))
},
undefined,
10 // 10 concurrent connections
),
concatMap(references => references)
Expand Down Expand Up @@ -633,8 +632,8 @@ export async function activateUsingWebSockets(): Promise<void> {
settingsPredicate: settings => Boolean(settings['go.showExternalReferences']),
})

sourcegraph.languages.registerImplementationProvider([{ pattern: '*.go' }], {
provideImplementation: async (doc: sourcegraph.TextDocument, pos: sourcegraph.Position) => {
sourcegraph.languages.registerLocationProvider('id', [{ pattern: '*.go' }], {
provideLocations: async (doc: sourcegraph.TextDocument, pos: sourcegraph.Position) => {
const response = await sendDocPositionRequest({
doc,
pos,
Expand Down
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"rules": {
"rxjs-no-wholesale": false,
"forin": false,
"ordered-imports": false
"ordered-imports": false,
"await-promise": [true, "Thenable"]
}
}
Loading