mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
fix #12688
This commit is contained in:
@@ -113,22 +113,12 @@ class DefinitionAdapter {
|
||||
let pos = TypeConverters.toPosition(position);
|
||||
return asWinJsPromise(token => this._provider.provideDefinition(doc, pos, token)).then(value => {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(DefinitionAdapter._convertLocation);
|
||||
return value.map(TypeConverters.location.from);
|
||||
} else if (value) {
|
||||
return DefinitionAdapter._convertLocation(value);
|
||||
return TypeConverters.location.from(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static _convertLocation(location: vscode.Location): modes.Location {
|
||||
if (!location) {
|
||||
return;
|
||||
}
|
||||
return <modes.Location>{
|
||||
uri: location.uri,
|
||||
range: TypeConverters.fromRange(location.range)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class HoverAdapter {
|
||||
@@ -208,17 +198,10 @@ class ReferenceAdapter {
|
||||
|
||||
return asWinJsPromise(token => this._provider.provideReferences(doc, pos, context, token)).then(value => {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(ReferenceAdapter._convertLocation);
|
||||
return value.map(TypeConverters.location.from);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static _convertLocation(location: vscode.Location): modes.Location {
|
||||
return <modes.Location>{
|
||||
uri: location.uri,
|
||||
range: TypeConverters.fromRange(location.range)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class QuickFixAdapter {
|
||||
|
||||
@@ -248,10 +248,10 @@ export function toSymbolInformation(bearing: IWorkspaceSymbol): types.SymbolInfo
|
||||
|
||||
|
||||
export const location = {
|
||||
from(value: types.Location): modes.Location {
|
||||
from(value: vscode.Location): modes.Location {
|
||||
return {
|
||||
range: fromRange(value.range),
|
||||
uri: value.uri
|
||||
range: value.range && fromRange(value.range),
|
||||
uri: <URI>value.uri
|
||||
};
|
||||
},
|
||||
to(value: modes.Location): types.Location {
|
||||
|
||||
Reference in New Issue
Block a user