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

Upstream inlay hints #11445

Merged
merged 16 commits into from
Mar 7, 2022
Prev Previous commit
Next Next commit
Add log messages
  • Loading branch information
lnicola committed Mar 4, 2022
commit 2ae8248ceec0fbf55c00c3b9e46ea319203d1df9
6 changes: 4 additions & 2 deletions editors/code/src/inlay_hints.ts
Original file line number Diff line number Diff line change
@@ -22,8 +22,10 @@ export function activateInlayHints(ctx: Ctx) {
this.hintsProvider = vscode.languages.registerInlayHintsProvider({ scheme: 'file', language: 'rust' }, new class implements vscode.InlayHintsProvider {
onDidChangeInlayHints = event;
async provideInlayHints(document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken): Promise<vscode.InlayHint[]> {
console.log(document.uri.toString());
const request = { textDocument: { uri: document.uri.toString() }, range: { start: range.start, end: range.end } };
const hints = await sendRequestWithRetry(ctx.client, ra.inlayHints, request, token).catch(_ => null)
const hints = await sendRequestWithRetry(ctx.client, ra.inlayHints, request, token).catch(_ => null);
console.log(hints);
if (hints == null) {
return [];
} else {
@@ -43,7 +45,7 @@ export function activateInlayHints(ctx: Ctx) {
this.hintsProvider = null;
this.updateHintsEventEmitter.dispose();
},
}
};

ctx.pushCleanup(maybeUpdater);

2 changes: 1 addition & 1 deletion editors/code/src/lsp_ext.ts
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, Te

export interface InlayHintsParams {
textDocument: lc.TextDocumentIdentifier;
range: lc.Range,
range: lc.Range;
}
export const inlayHints = new lc.RequestType<InlayHintsParams, InlayHint[], void>("rust-analyzer/inlayHints");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const inlayHints = new lc.RequestType<InlayHintsParams, InlayHint[], void>("rust-analyzer/inlayHints");
export const inlayHints = new lc.RequestType<InlayHintsParams, InlayHint[], void>("experimental/inlayHints");

Assuming this is still used