|
5 | 5 |
|
6 | 6 | import * as vscode from 'vscode'; |
7 | 7 | import { getDocUri, activate, testCompletion, testHover, testDiagnostics, sleep } from './helper'; |
8 | | -import { Uri } from 'vscode'; |
9 | 8 |
|
10 | 9 | describe('Tests for schema provider feature', () => { |
11 | 10 | const docUri = getDocUri('completion/completion.yaml'); |
@@ -134,6 +133,23 @@ describe('Tests for schema provider feature', () => { |
134 | 133 | } |
135 | 134 | ] |
136 | 135 | }); |
| 136 | + }); |
| 137 | + |
| 138 | + it('Multiple contributors with one throwing an error', async () => { |
| 139 | + const client = await activate(docUri); |
| 140 | + client._customSchemaContributors = {}; |
| 141 | + client.registerContributor(SCHEMA2, onRequestSchema2URI, onRequestSchema2Content); |
| 142 | + client.registerContributor("schemathrowingerror", onRequestSchemaURIThrowError, onRequestSchemaContentThrowError); |
| 143 | + |
| 144 | + await testCompletion(docUri, new vscode.Position(0, 0), { |
| 145 | + items: [ |
| 146 | + { |
| 147 | + label: "apple", |
| 148 | + kind: 9, |
| 149 | + documentation: "An apple" |
| 150 | + } |
| 151 | + ] |
| 152 | + }); |
137 | 153 | }); |
138 | 154 | }); |
139 | 155 |
|
@@ -161,6 +177,14 @@ function onRequestSchema1URI(resource: string): string | undefined { |
161 | 177 | return undefined; |
162 | 178 | } |
163 | 179 |
|
| 180 | +function onRequestSchemaURIThrowError(resource: string): string | undefined { |
| 181 | + throw new Error('test what happens when an error is thrown and not caught'); |
| 182 | +} |
| 183 | + |
| 184 | +function onRequestSchemaContentThrowError(schemaUri: string): string | undefined { |
| 185 | + throw new Error('test what happens when an error is thrown and not caught'); |
| 186 | +} |
| 187 | + |
164 | 188 | function onRequestSchema1Content(schemaUri: string): string | undefined { |
165 | 189 | return schemaJSON; |
166 | 190 | } |
|
0 commit comments