Skip to content

Commit dd36b7f

Browse files
authored
feat: support extension API v25.2.0 (#137)
1 parent 97b0ed9 commit dd36b7f

File tree

7 files changed

+25
-14
lines changed

7 files changed

+25
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@
6767
"@types/sinon": "9.0.4",
6868
"rxjs": "^6.5.1",
6969
"sinon": "^9.0.2",
70-
"sourcegraph": "^25.0.0"
70+
"sourcegraph": "^25.2.0"
7171
}
7272
}

src/api.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ describe('createStubSourcegraphAPI()', () => {
1515
assert.deepStrictEqual(stub.app.createDecorationType(), { key: 'decorationType1' })
1616
assert.deepStrictEqual(stub.app.createDecorationType(), { key: 'decorationType2' })
1717
})
18+
it('should support creating unique statusBarItemTypes', () => {
19+
const stub = createStubSourcegraphAPI()
20+
assert.deepStrictEqual(stub.app.createStatusBarItemType(), { key: 'statusBarItemType0' })
21+
assert.deepStrictEqual(stub.app.createStatusBarItemType(), { key: 'statusBarItemType1' })
22+
assert.deepStrictEqual(stub.app.createStatusBarItemType(), { key: 'statusBarItemType2' })
23+
})
1824
it('should support managing the active Window', () => {
1925
const stub = createStubSourcegraphAPI()
2026
const newWindow = {} as sourcegraph.Window

src/api.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import * as sourcegraph from 'sourcegraph'
1414
import { notImplemented, subtypeOf } from './util'
1515

1616
let decorationTypeCounter = 0
17+
let statusBarItemTypeCounter = 0
1718

1819
/**
1920
* Creates an object that (mostly) implements the Sourcegraph API,
@@ -54,6 +55,10 @@ export const createStubSourcegraphAPI = () => {
5455
get versionContext() {
5556
return this.versionContextChanges.value
5657
},
58+
searchContextChanges: new BehaviorSubject(undefined),
59+
get searchContext() {
60+
return this.searchContextChanges.value
61+
},
5762
},
5863
languages: {
5964
registerHoverProvider: sinon.spy(
@@ -92,6 +97,7 @@ export const createStubSourcegraphAPI = () => {
9297
registerFileDecorationProvider: sinon.spy(
9398
(provider: sourcegraph.FileDecorationProvider) => new Subscription()
9499
),
100+
createStatusBarItemType: () => ({ key: `statusBarItemType${statusBarItemTypeCounter++}` }),
95101
},
96102
configuration: Object.assign(configSubject.pipe(mapTo(undefined)), {
97103
get: <C extends object = { [key: string]: any }>(): sourcegraph.Configuration<C> => ({

src/codeEditor.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ describe('createStubCodeEditor()', () => {
2020

2121
stub.setDecorations({ key: 'foo' }, [{ range: new Range(0, 1, 2, 3), border: 'red' }])
2222
sinon.assert.calledOnce(stub.setDecorations)
23+
24+
stub.setStatusBarItem({ key: 'foo' }, { text: 'status bar item' })
25+
sinon.assert.calledOnce(stub.setStatusBarItem)
2326
})
2427
})

src/codeEditor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export const createStubCodeEditor = ({
2323
decorations: sourcegraph.TextDocumentDecoration[]
2424
): void => undefined
2525
),
26+
setStatusBarItem: sinon.spy(
27+
(statusBarItemType: sourcegraph.StatusBarItemType, statusBarItem: sourcegraph.StatusBarItem): void =>
28+
undefined
29+
),
2630
})
2731
return codeEditor
2832
}

src/util.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'assert'
22
import { notImplemented } from './util'
33

4-
describe('notImplemted', () => {
4+
describe('notImplemented', () => {
55
it('throws', () => {
66
assert.throws(notImplemented, /not implemented/i)
77
})

yarn.lock

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4839,7 +4839,6 @@ npm@^6.14.8:
48394839
cmd-shim "^3.0.3"
48404840
columnify "~1.5.4"
48414841
config-chain "^1.1.12"
4842-
debuglog "*"
48434842
detect-indent "~5.0.0"
48444843
detect-newline "^2.1.0"
48454844
dezalgo "~1.0.3"
@@ -4854,7 +4853,6 @@ npm@^6.14.8:
48544853
has-unicode "~2.0.1"
48554854
hosted-git-info "^2.8.8"
48564855
iferr "^1.0.2"
4857-
imurmurhash "*"
48584856
infer-owner "^1.0.4"
48594857
inflight "~1.0.6"
48604858
inherits "^2.0.4"
@@ -4873,14 +4871,8 @@ npm@^6.14.8:
48734871
libnpx "^10.2.4"
48744872
lock-verify "^2.1.0"
48754873
lockfile "^1.0.4"
4876-
lodash._baseindexof "*"
48774874
lodash._baseuniq "~4.6.0"
4878-
lodash._bindcallback "*"
4879-
lodash._cacheindexof "*"
4880-
lodash._createcache "*"
4881-
lodash._getnative "*"
48824875
lodash.clonedeep "~4.5.0"
4883-
lodash.restparam "*"
48844876
lodash.union "~4.6.0"
48854877
lodash.uniq "~4.5.0"
48864878
lodash.without "~4.4.0"
@@ -6285,10 +6277,10 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
62856277
resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
62866278
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
62876279

6288-
sourcegraph@^25.0.0:
6289-
version "25.0.0"
6290-
resolved "https://registry.yarnpkg.com/sourcegraph/-/sourcegraph-25.0.0.tgz#5f16eb684ee23b59011e68d516df7755ebaa47f8"
6291-
integrity sha512-3deJcXdOdKoI5xZv4wiQXOnJw96I/BFLStwHHbUS1XlDP1yHHKQT3pKsTawm/YJ8CUirBYkIVsAA2rR/JYO4Ew==
6280+
sourcegraph@^25.2.0:
6281+
version "25.2.0"
6282+
resolved "https://registry.yarnpkg.com/sourcegraph/-/sourcegraph-25.2.0.tgz#7978b3ca154e2703828cd4bd2fdfbc3f7994bbe8"
6283+
integrity sha512-2yYJN8DMFrGesDfZvaYfXie86fHl3HtPRZ4XImQ6H4d7HuHHYEkVYxlbrOD4BUgMBsit5oVUPZ9Kspu0676QAA==
62926284

62936285
spawn-error-forwarder@~1.0.0:
62946286
version "1.0.0"

0 commit comments

Comments
 (0)