Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return updated items in resolve* operations #74

Merged
merged 1 commit into from
Apr 25, 2018
Merged
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
18 changes: 15 additions & 3 deletions src/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export class MonacoLanguages implements Languages {
},
resolveCompletionItem: provider.resolveCompletionItem ? (item, token) => {
const protocolItem = this.m2p.asCompletionItem(item);
return provider.resolveCompletionItem!(protocolItem, token).then(item => this.p2m.asCompletionItem(item));
return provider.resolveCompletionItem!(protocolItem, token).then(resolvedItem => {
const resolvedCompletionItem = this.p2m.asCompletionItem(resolvedItem);
Object.assign(item, resolvedCompletionItem);
return item;
});
} : undefined
};
}
Expand Down Expand Up @@ -270,7 +274,11 @@ export class MonacoLanguages implements Languages {
return codeLens;
}
const protocolCodeLens = this.m2p.asCodeLens(codeLens);
return provider.resolveCodeLens!(protocolCodeLens, token).then(result => this.p2m.asCodeLens(result))
return provider.resolveCodeLens!(protocolCodeLens, token).then(result => {
const resolvedCodeLens = this.p2m.asCodeLens(result);
Object.assign(codeLens, resolvedCodeLens);
return codeLens;
});
} : ((m, codeLens, t) => codeLens)
}
}
Expand Down Expand Up @@ -385,7 +393,11 @@ export class MonacoLanguages implements Languages {
// and the link doesn't have a url set
if (provider.resolveDocumentLink && (link.url === null || link.url === undefined)) {
const documentLink = this.m2p.asDocumentLink(link);
return provider.resolveDocumentLink(documentLink, token).then(result => this.p2m.asILink(result));
return provider.resolveDocumentLink(documentLink, token).then(result => {
const resolvedLink = this.p2m.asILink(result);
Object.assign(link, resolvedLink);
return link;
});
}
return link;
}
Expand Down