提交 3f2008de 编写于 作者: J Johannes Rieken

fix 'vscode.executeReferenceProvider' command

上级 bf804d1c
......@@ -245,7 +245,7 @@ class ExtHostApiCommands {
resource,
position: position && typeConverters.fromPosition(position)
};
return this._commands.executeCommand<modes.IReference[]>('_executeDocumentHighlights', args).then(value => {
return this._commands.executeCommand<modes.IReference[]>('_executeReferenceProvider', args).then(value => {
if (Array.isArray(value)) {
return value.map(typeConverters.location.to);
}
......
......@@ -190,7 +190,7 @@ suite('ExtHostLanguageFeatureCommands', function() {
// });
});
test('Definition, back and forth', function(done) {
test('Definition, back and forth', function() {
disposables.push(extHost.registerDefinitionProvider(defaultSelector, <vscode.DefinitionProvider>{
provideDefinition(doc: any): any {
......@@ -207,12 +207,38 @@ suite('ExtHostLanguageFeatureCommands', function() {
}
}));
threadService.sync().then(() => {
commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', model.getAssociatedResource(), new types.Position(0, 0)).then(values => {
return threadService.sync().then(() => {
return commands.executeCommand<vscode.Location[]>('vscode.executeDefinitionProvider', model.getAssociatedResource(), new types.Position(0, 0)).then(values => {
assert.equal(values.length, 4);
done();
}, done);
}, done);
for (let v of values) {
assert.ok(v.uri instanceof URI);
assert.ok(v.range instanceof types.Range);
}
});
});
});
// --- references
test('reference search, back and forth', function () {
disposables.push(extHost.registerReferenceProvider(defaultSelector, <vscode.ReferenceProvider>{
provideReferences(doc: any) {
return [
new types.Location(URI.parse('some:uri/path'), new types.Range(0, 1, 0, 5))
];
}
}));
return commands.executeCommand<vscode.Location[]>('vscode.executeReferenceProvider', model.getAssociatedResource(), new types.Position(0, 0)).then(values => {
assert.equal(values.length, 1);
let [first] = values;
assert.equal(first.uri.toString(), 'some:uri/path');
assert.equal(first.range.start.line, 0);
assert.equal(first.range.start.character, 1);
assert.equal(first.range.end.line, 0);
assert.equal(first.range.end.character, 5);
});
});
// --- outline
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册